OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 memset(&header, 0, sizeof(header)); | 116 memset(&header, 0, sizeof(header)); |
117 header.frameType = kEmptyFrame; | 117 header.frameType = kEmptyFrame; |
118 header.header.markerBit = false; | 118 header.header.markerBit = false; |
119 header.header.paddingLength = kPaddingSize; | 119 header.header.paddingLength = kPaddingSize; |
120 header.header.payloadType = kUnusedPayloadType; | 120 header.header.payloadType = kUnusedPayloadType; |
121 header.header.ssrc = 1; | 121 header.header.ssrc = 1; |
122 header.header.headerLength = 12; | 122 header.header.headerLength = 12; |
123 header.type.Video.codec = kRtpVideoVp8; | 123 header.type.Video.codec = kRtpVideoVp8; |
124 // Insert one video frame to get one frame decoded. | 124 // Insert one video frame to get one frame decoded. |
125 header.frameType = kVideoFrameKey; | 125 header.frameType = kVideoFrameKey; |
126 header.type.Video.isFirstPacket = true; | 126 header.type.Video.is_first_packet_in_frame = true; |
127 header.header.markerBit = true; | 127 header.header.markerBit = true; |
128 InsertAndVerifyDecodableFrame(payload, kFrameSize, &header); | 128 InsertAndVerifyDecodableFrame(payload, kFrameSize, &header); |
129 clock_.AdvanceTimeMilliseconds(33); | 129 clock_.AdvanceTimeMilliseconds(33); |
130 header.header.timestamp += 3000; | 130 header.header.timestamp += 3000; |
131 | 131 |
132 header.frameType = kEmptyFrame; | 132 header.frameType = kEmptyFrame; |
133 header.type.Video.isFirstPacket = false; | 133 header.type.Video.is_first_packet_in_frame = false; |
134 header.header.markerBit = false; | 134 header.header.markerBit = false; |
135 // Insert padding frames. | 135 // Insert padding frames. |
136 for (int i = 0; i < 10; ++i) { | 136 for (int i = 0; i < 10; ++i) { |
137 // Lose one packet from the 6th frame. | 137 // Lose one packet from the 6th frame. |
138 if (i == 5) { | 138 if (i == 5) { |
139 ++header.header.sequenceNumber; | 139 ++header.header.sequenceNumber; |
140 } | 140 } |
141 // Lose the 4th frame. | 141 // Lose the 4th frame. |
142 if (i == 3) { | 142 if (i == 3) { |
143 header.header.sequenceNumber += 5; | 143 header.header.sequenceNumber += 5; |
(...skipping 15 matching lines...) Expand all Loading... |
159 TEST_F(TestVideoReceiver, PaddingOnlyAndVideo) { | 159 TEST_F(TestVideoReceiver, PaddingOnlyAndVideo) { |
160 EXPECT_EQ(0, receiver_->SetVideoProtection(kProtectionNack, true)); | 160 EXPECT_EQ(0, receiver_->SetVideoProtection(kProtectionNack, true)); |
161 EXPECT_EQ( | 161 EXPECT_EQ( |
162 0, receiver_->RegisterPacketRequestCallback(&packet_request_callback_)); | 162 0, receiver_->RegisterPacketRequestCallback(&packet_request_callback_)); |
163 const size_t kFrameSize = 1200; | 163 const size_t kFrameSize = 1200; |
164 const size_t kPaddingSize = 220; | 164 const size_t kPaddingSize = 220; |
165 const uint8_t payload[kFrameSize] = {0}; | 165 const uint8_t payload[kFrameSize] = {0}; |
166 WebRtcRTPHeader header; | 166 WebRtcRTPHeader header; |
167 memset(&header, 0, sizeof(header)); | 167 memset(&header, 0, sizeof(header)); |
168 header.frameType = kEmptyFrame; | 168 header.frameType = kEmptyFrame; |
169 header.type.Video.isFirstPacket = false; | 169 header.type.Video.is_first_packet_in_frame = false; |
170 header.header.markerBit = false; | 170 header.header.markerBit = false; |
171 header.header.paddingLength = kPaddingSize; | 171 header.header.paddingLength = kPaddingSize; |
172 header.header.payloadType = kUnusedPayloadType; | 172 header.header.payloadType = kUnusedPayloadType; |
173 header.header.ssrc = 1; | 173 header.header.ssrc = 1; |
174 header.header.headerLength = 12; | 174 header.header.headerLength = 12; |
175 header.type.Video.codec = kRtpVideoVp8; | 175 header.type.Video.codec = kRtpVideoVp8; |
176 header.type.Video.codecHeader.VP8.pictureId = -1; | 176 header.type.Video.codecHeader.VP8.pictureId = -1; |
177 header.type.Video.codecHeader.VP8.tl0PicIdx = -1; | 177 header.type.Video.codecHeader.VP8.tl0PicIdx = -1; |
178 for (int i = 0; i < 3; ++i) { | 178 for (int i = 0; i < 3; ++i) { |
179 // Insert 2 video frames. | 179 // Insert 2 video frames. |
180 for (int j = 0; j < 2; ++j) { | 180 for (int j = 0; j < 2; ++j) { |
181 if (i == 0 && j == 0) // First frame should be a key frame. | 181 if (i == 0 && j == 0) // First frame should be a key frame. |
182 header.frameType = kVideoFrameKey; | 182 header.frameType = kVideoFrameKey; |
183 else | 183 else |
184 header.frameType = kVideoFrameDelta; | 184 header.frameType = kVideoFrameDelta; |
185 header.type.Video.isFirstPacket = true; | 185 header.type.Video.is_first_packet_in_frame = true; |
186 header.header.markerBit = true; | 186 header.header.markerBit = true; |
187 InsertAndVerifyDecodableFrame(payload, kFrameSize, &header); | 187 InsertAndVerifyDecodableFrame(payload, kFrameSize, &header); |
188 clock_.AdvanceTimeMilliseconds(33); | 188 clock_.AdvanceTimeMilliseconds(33); |
189 header.header.timestamp += 3000; | 189 header.header.timestamp += 3000; |
190 } | 190 } |
191 | 191 |
192 // Insert 2 padding only frames. | 192 // Insert 2 padding only frames. |
193 header.frameType = kEmptyFrame; | 193 header.frameType = kEmptyFrame; |
194 header.type.Video.isFirstPacket = false; | 194 header.type.Video.is_first_packet_in_frame = false; |
195 header.header.markerBit = false; | 195 header.header.markerBit = false; |
196 for (int j = 0; j < 2; ++j) { | 196 for (int j = 0; j < 2; ++j) { |
197 // InsertAndVerifyPaddingFrame(payload, &header); | 197 // InsertAndVerifyPaddingFrame(payload, &header); |
198 clock_.AdvanceTimeMilliseconds(33); | 198 clock_.AdvanceTimeMilliseconds(33); |
199 header.header.timestamp += 3000; | 199 header.header.timestamp += 3000; |
200 } | 200 } |
201 } | 201 } |
202 } | 202 } |
203 | 203 |
204 TEST_F(TestVideoReceiver, ReceiverDelay) { | 204 TEST_F(TestVideoReceiver, ReceiverDelay) { |
205 EXPECT_EQ(0, receiver_->SetMinReceiverDelay(0)); | 205 EXPECT_EQ(0, receiver_->SetMinReceiverDelay(0)); |
206 EXPECT_EQ(0, receiver_->SetMinReceiverDelay(5000)); | 206 EXPECT_EQ(0, receiver_->SetMinReceiverDelay(5000)); |
207 EXPECT_EQ(-1, receiver_->SetMinReceiverDelay(-100)); | 207 EXPECT_EQ(-1, receiver_->SetMinReceiverDelay(-100)); |
208 EXPECT_EQ(-1, receiver_->SetMinReceiverDelay(10010)); | 208 EXPECT_EQ(-1, receiver_->SetMinReceiverDelay(10010)); |
209 } | 209 } |
210 | 210 |
211 } // namespace | 211 } // namespace |
212 } // namespace vcm | 212 } // namespace vcm |
213 } // namespace webrtc | 213 } // namespace webrtc |
OLD | NEW |