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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 memset(&header, 0, sizeof(header)); | 112 memset(&header, 0, sizeof(header)); |
113 header.frameType = kEmptyFrame; | 113 header.frameType = kEmptyFrame; |
114 header.header.markerBit = false; | 114 header.header.markerBit = false; |
115 header.header.paddingLength = kPaddingSize; | 115 header.header.paddingLength = kPaddingSize; |
116 header.header.payloadType = kUnusedPayloadType; | 116 header.header.payloadType = kUnusedPayloadType; |
117 header.header.ssrc = 1; | 117 header.header.ssrc = 1; |
118 header.header.headerLength = 12; | 118 header.header.headerLength = 12; |
119 header.type.Video.codec = kRtpVideoVp8; | 119 header.type.Video.codec = kRtpVideoVp8; |
120 // Insert one video frame to get one frame decoded. | 120 // Insert one video frame to get one frame decoded. |
121 header.frameType = kVideoFrameKey; | 121 header.frameType = kVideoFrameKey; |
122 header.type.Video.isFirstPacket = true; | 122 header.type.Video.is_first_packet_in_frame = true; |
123 header.header.markerBit = true; | 123 header.header.markerBit = true; |
124 InsertAndVerifyDecodableFrame(payload, kFrameSize, &header); | 124 InsertAndVerifyDecodableFrame(payload, kFrameSize, &header); |
125 clock_.AdvanceTimeMilliseconds(33); | 125 clock_.AdvanceTimeMilliseconds(33); |
126 header.header.timestamp += 3000; | 126 header.header.timestamp += 3000; |
127 | 127 |
128 header.frameType = kEmptyFrame; | 128 header.frameType = kEmptyFrame; |
129 header.type.Video.isFirstPacket = false; | 129 header.type.Video.is_first_packet_in_frame = false; |
130 header.header.markerBit = false; | 130 header.header.markerBit = false; |
131 // Insert padding frames. | 131 // Insert padding frames. |
132 for (int i = 0; i < 10; ++i) { | 132 for (int i = 0; i < 10; ++i) { |
133 // Lose one packet from the 6th frame. | 133 // Lose one packet from the 6th frame. |
134 if (i == 5) { | 134 if (i == 5) { |
135 ++header.header.sequenceNumber; | 135 ++header.header.sequenceNumber; |
136 } | 136 } |
137 // Lose the 4th frame. | 137 // Lose the 4th frame. |
138 if (i == 3) { | 138 if (i == 3) { |
139 header.header.sequenceNumber += 5; | 139 header.header.sequenceNumber += 5; |
(...skipping 15 matching lines...) Expand all Loading... |
155 TEST_F(TestVideoReceiver, PaddingOnlyAndVideo) { | 155 TEST_F(TestVideoReceiver, PaddingOnlyAndVideo) { |
156 EXPECT_EQ(0, receiver_->SetVideoProtection(kProtectionNack, true)); | 156 EXPECT_EQ(0, receiver_->SetVideoProtection(kProtectionNack, true)); |
157 EXPECT_EQ( | 157 EXPECT_EQ( |
158 0, receiver_->RegisterPacketRequestCallback(&packet_request_callback_)); | 158 0, receiver_->RegisterPacketRequestCallback(&packet_request_callback_)); |
159 const size_t kFrameSize = 1200; | 159 const size_t kFrameSize = 1200; |
160 const size_t kPaddingSize = 220; | 160 const size_t kPaddingSize = 220; |
161 const uint8_t payload[kFrameSize] = {0}; | 161 const uint8_t payload[kFrameSize] = {0}; |
162 WebRtcRTPHeader header; | 162 WebRtcRTPHeader header; |
163 memset(&header, 0, sizeof(header)); | 163 memset(&header, 0, sizeof(header)); |
164 header.frameType = kEmptyFrame; | 164 header.frameType = kEmptyFrame; |
165 header.type.Video.isFirstPacket = false; | 165 header.type.Video.is_first_packet_in_frame = false; |
166 header.header.markerBit = false; | 166 header.header.markerBit = false; |
167 header.header.paddingLength = kPaddingSize; | 167 header.header.paddingLength = kPaddingSize; |
168 header.header.payloadType = kUnusedPayloadType; | 168 header.header.payloadType = kUnusedPayloadType; |
169 header.header.ssrc = 1; | 169 header.header.ssrc = 1; |
170 header.header.headerLength = 12; | 170 header.header.headerLength = 12; |
171 header.type.Video.codec = kRtpVideoVp8; | 171 header.type.Video.codec = kRtpVideoVp8; |
172 header.type.Video.codecHeader.VP8.pictureId = -1; | 172 header.type.Video.codecHeader.VP8.pictureId = -1; |
173 header.type.Video.codecHeader.VP8.tl0PicIdx = -1; | 173 header.type.Video.codecHeader.VP8.tl0PicIdx = -1; |
174 for (int i = 0; i < 3; ++i) { | 174 for (int i = 0; i < 3; ++i) { |
175 // Insert 2 video frames. | 175 // Insert 2 video frames. |
176 for (int j = 0; j < 2; ++j) { | 176 for (int j = 0; j < 2; ++j) { |
177 if (i == 0 && j == 0) // First frame should be a key frame. | 177 if (i == 0 && j == 0) // First frame should be a key frame. |
178 header.frameType = kVideoFrameKey; | 178 header.frameType = kVideoFrameKey; |
179 else | 179 else |
180 header.frameType = kVideoFrameDelta; | 180 header.frameType = kVideoFrameDelta; |
181 header.type.Video.isFirstPacket = true; | 181 header.type.Video.is_first_packet_in_frame = true; |
182 header.header.markerBit = true; | 182 header.header.markerBit = true; |
183 InsertAndVerifyDecodableFrame(payload, kFrameSize, &header); | 183 InsertAndVerifyDecodableFrame(payload, kFrameSize, &header); |
184 clock_.AdvanceTimeMilliseconds(33); | 184 clock_.AdvanceTimeMilliseconds(33); |
185 header.header.timestamp += 3000; | 185 header.header.timestamp += 3000; |
186 } | 186 } |
187 | 187 |
188 // Insert 2 padding only frames. | 188 // Insert 2 padding only frames. |
189 header.frameType = kEmptyFrame; | 189 header.frameType = kEmptyFrame; |
190 header.type.Video.isFirstPacket = false; | 190 header.type.Video.is_first_packet_in_frame = false; |
191 header.header.markerBit = false; | 191 header.header.markerBit = false; |
192 for (int j = 0; j < 2; ++j) { | 192 for (int j = 0; j < 2; ++j) { |
193 // InsertAndVerifyPaddingFrame(payload, &header); | 193 // InsertAndVerifyPaddingFrame(payload, &header); |
194 clock_.AdvanceTimeMilliseconds(33); | 194 clock_.AdvanceTimeMilliseconds(33); |
195 header.header.timestamp += 3000; | 195 header.header.timestamp += 3000; |
196 } | 196 } |
197 } | 197 } |
198 } | 198 } |
199 | 199 |
200 TEST_F(TestVideoReceiver, ReceiverDelay) { | 200 TEST_F(TestVideoReceiver, ReceiverDelay) { |
201 EXPECT_EQ(0, receiver_->SetMinReceiverDelay(0)); | 201 EXPECT_EQ(0, receiver_->SetMinReceiverDelay(0)); |
202 EXPECT_EQ(0, receiver_->SetMinReceiverDelay(5000)); | 202 EXPECT_EQ(0, receiver_->SetMinReceiverDelay(5000)); |
203 EXPECT_EQ(-1, receiver_->SetMinReceiverDelay(-100)); | 203 EXPECT_EQ(-1, receiver_->SetMinReceiverDelay(-100)); |
204 EXPECT_EQ(-1, receiver_->SetMinReceiverDelay(10010)); | 204 EXPECT_EQ(-1, receiver_->SetMinReceiverDelay(10010)); |
205 } | 205 } |
206 | 206 |
207 } // namespace | 207 } // namespace |
208 } // namespace vcm | 208 } // namespace vcm |
209 } // namespace webrtc | 209 } // namespace webrtc |
OLD | NEW |