OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 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 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 | 258 |
259 TEST_F(TestPacketBuffer, InsertDuplicatePacket) { | 259 TEST_F(TestPacketBuffer, InsertDuplicatePacket) { |
260 VCMPacket packet; | 260 VCMPacket packet; |
261 packet.seqNum = Rand(); | 261 packet.seqNum = Rand(); |
262 EXPECT_TRUE(packet_buffer_->InsertPacket(packet)); | 262 EXPECT_TRUE(packet_buffer_->InsertPacket(packet)); |
263 ++packet.seqNum; | 263 ++packet.seqNum; |
264 EXPECT_TRUE(packet_buffer_->InsertPacket(packet)); | 264 EXPECT_TRUE(packet_buffer_->InsertPacket(packet)); |
265 EXPECT_TRUE(packet_buffer_->InsertPacket(packet)); | 265 EXPECT_TRUE(packet_buffer_->InsertPacket(packet)); |
266 } | 266 } |
267 | 267 |
| 268 TEST_F(TestPacketBuffer, NackCount) { |
| 269 uint16_t seq_num = Rand(); |
| 270 |
| 271 VCMPacket packet; |
| 272 packet.codec = kVideoCodecGeneric; |
| 273 packet.seqNum = seq_num; |
| 274 packet.frameType = kVideoFrameKey; |
| 275 packet.isFirstPacket = true; |
| 276 packet.markerBit = false; |
| 277 packet.sizeBytes = 0; |
| 278 packet.dataPtr = nullptr; |
| 279 packet.timesNacked = 0; |
| 280 |
| 281 packet_buffer_->InsertPacket(packet); |
| 282 |
| 283 packet.seqNum++; |
| 284 packet.isFirstPacket = false; |
| 285 packet.timesNacked = 1; |
| 286 packet_buffer_->InsertPacket(packet); |
| 287 |
| 288 packet.seqNum++; |
| 289 packet.timesNacked = 3; |
| 290 packet_buffer_->InsertPacket(packet); |
| 291 |
| 292 packet.seqNum++; |
| 293 packet.markerBit = true; |
| 294 packet.timesNacked = 1; |
| 295 packet_buffer_->InsertPacket(packet); |
| 296 |
| 297 |
| 298 ASSERT_EQ(1UL, frames_from_callback_.size()); |
| 299 FrameObject* frame = frames_from_callback_.begin()->second.get(); |
| 300 RtpFrameObject* rtp_frame = static_cast<RtpFrameObject*>(frame); |
| 301 EXPECT_EQ(3, rtp_frame->times_nacked()); |
| 302 } |
| 303 |
| 304 TEST_F(TestPacketBuffer, FrameSize) { |
| 305 uint16_t seq_num = Rand(); |
| 306 uint8_t data[] = {1, 2, 3, 4, 5}; |
| 307 |
| 308 // seq_num , kf, frst, lst, size, data |
| 309 InsertGeneric(seq_num , kT, kT , kF , 5 , data); |
| 310 InsertGeneric(seq_num + 1, kT, kF , kF , 5 , data); |
| 311 InsertGeneric(seq_num + 2, kT, kF , kF , 5 , data); |
| 312 InsertGeneric(seq_num + 3, kT, kF , kT , 5 , data); |
| 313 |
| 314 ASSERT_EQ(1UL, frames_from_callback_.size()); |
| 315 EXPECT_EQ(20UL, frames_from_callback_.begin()->second->size); |
| 316 } |
| 317 |
268 TEST_F(TestPacketBuffer, ExpandBuffer) { | 318 TEST_F(TestPacketBuffer, ExpandBuffer) { |
269 uint16_t seq_num = Rand(); | 319 uint16_t seq_num = Rand(); |
270 | 320 |
271 for (int i = 0; i < kStartSize + 1; ++i) { | 321 for (int i = 0; i < kStartSize + 1; ++i) { |
272 // seq_num , kf, frst, lst | 322 // seq_num , kf, frst, lst |
273 InsertGeneric(seq_num + i, kT , kT, kT); | 323 InsertGeneric(seq_num + i, kT, kT , kT); |
274 } | 324 } |
275 } | 325 } |
276 | 326 |
277 TEST_F(TestPacketBuffer, ExpandBufferOverflow) { | 327 TEST_F(TestPacketBuffer, ExpandBufferOverflow) { |
278 uint16_t seq_num = Rand(); | 328 uint16_t seq_num = Rand(); |
279 | 329 |
280 for (int i = 0; i < kMaxSize; ++i) { | 330 for (int i = 0; i < kMaxSize; ++i) { |
281 // seq_num , kf, frst, lst | 331 // seq_num , kf, frst, lst |
282 InsertGeneric(seq_num + i, kT, kT , kT); | 332 InsertGeneric(seq_num + i, kT, kT , kT); |
283 } | 333 } |
(...skipping 1114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1398 CheckReferencesVp9(pid + 5, 1, pid + 4); | 1448 CheckReferencesVp9(pid + 5, 1, pid + 4); |
1399 CheckReferencesVp9(pid + 6, 0, pid + 4); | 1449 CheckReferencesVp9(pid + 6, 0, pid + 4); |
1400 CheckReferencesVp9(pid + 6, 1, pid + 5); | 1450 CheckReferencesVp9(pid + 6, 1, pid + 5); |
1401 CheckReferencesVp9(pid + 7, 1, pid + 6); | 1451 CheckReferencesVp9(pid + 7, 1, pid + 6); |
1402 CheckReferencesVp9(pid + 8, 0, pid + 6); | 1452 CheckReferencesVp9(pid + 8, 0, pid + 6); |
1403 CheckReferencesVp9(pid + 8, 1, pid + 7); | 1453 CheckReferencesVp9(pid + 8, 1, pid + 7); |
1404 } | 1454 } |
1405 | 1455 |
1406 } // namespace video_coding | 1456 } // namespace video_coding |
1407 } // namespace webrtc | 1457 } // namespace webrtc |
OLD | NEW |