Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2011 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 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 439 EXPECT_TRUE(dec_state.ContinuousFrame(&frame)); | 439 EXPECT_TRUE(dec_state.ContinuousFrame(&frame)); |
| 440 frame.Reset(); | 440 frame.Reset(); |
| 441 // Testing only gap in tl0PicIdx when tl0PicIdx in continuous. | 441 // Testing only gap in tl0PicIdx when tl0PicIdx in continuous. |
| 442 packet.codecSpecificHeader.codecHeader.VP8.tl0PicIdx += 3; | 442 packet.codecSpecificHeader.codecHeader.VP8.tl0PicIdx += 3; |
| 443 packet.codecSpecificHeader.codecHeader.VP8.temporalIdx++; | 443 packet.codecSpecificHeader.codecHeader.VP8.temporalIdx++; |
| 444 packet.codecSpecificHeader.codecHeader.VP8.tl0PicIdx = 1; | 444 packet.codecSpecificHeader.codecHeader.VP8.tl0PicIdx = 1; |
| 445 EXPECT_LE(0, frame.InsertPacket(packet, 0, kNoErrors, frame_data)); | 445 EXPECT_LE(0, frame.InsertPacket(packet, 0, kNoErrors, frame_data)); |
| 446 EXPECT_FALSE(dec_state.ContinuousFrame(&frame)); | 446 EXPECT_FALSE(dec_state.ContinuousFrame(&frame)); |
| 447 } | 447 } |
| 448 | 448 |
| 449 TEST(TestDecodingState, FrameContinuityFlexibleMode) { | |
| 450 VCMDecodingState dec_state; | |
| 451 VCMFrameBuffer frame; | |
| 452 VCMPacket packet; | |
| 453 packet.isFirstPacket = true; | |
| 454 packet.timestamp = 1; | |
| 455 packet.seqNum = 0xffff; | |
| 456 uint8_t data[] = "I need a data pointer for this test!"; | |
| 457 packet.sizeBytes = sizeof(data); | |
| 458 packet.dataPtr = data; | |
| 459 packet.codecSpecificHeader.codec = kRtpVideoVp9; | |
| 460 | |
| 461 RTPVideoHeaderVP9& Vp9Hdr = packet.codecSpecificHeader.codecHeader.VP9; | |
|
åsapersson
2015/11/06 10:19:34
nit: vp9_hdr
philipel1
2015/11/06 14:35:16
Done.
| |
| 462 Vp9Hdr.picture_id = 10; | |
| 463 Vp9Hdr.flexible_mode = true; | |
| 464 | |
| 465 FrameData frame_data; | |
| 466 frame_data.rtt_ms = 0; | |
| 467 frame_data.rolling_average_packets_per_frame = -1; | |
| 468 | |
| 469 // Key frame as first frame | |
| 470 packet.frameType = kVideoFrameKey; | |
| 471 EXPECT_LE(0, frame.InsertPacket(packet, 0, kNoErrors, frame_data)); | |
| 472 EXPECT_TRUE(dec_state.ContinuousFrame(&frame)); | |
| 473 | |
| 474 // Delta frame as first frame | |
| 475 frame.Reset(); | |
| 476 packet.frameType = kVideoFrameDelta; | |
| 477 EXPECT_LE(0, frame.InsertPacket(packet, 0, kNoErrors, frame_data)); | |
| 478 EXPECT_FALSE(dec_state.ContinuousFrame(&frame)); | |
| 479 | |
| 480 // Key frame then delta frame | |
| 481 frame.Reset(); | |
| 482 packet.frameType = kVideoFrameKey; | |
| 483 EXPECT_LE(0, frame.InsertPacket(packet, 0, kNoErrors, frame_data)); | |
| 484 dec_state.SetState(&frame); | |
| 485 frame.Reset(); | |
| 486 packet.frameType = kVideoFrameDelta; | |
| 487 Vp9Hdr.num_ref_pics = 1; | |
| 488 Vp9Hdr.picture_id = 15; | |
| 489 Vp9Hdr.pid_diff[0] = 5; | |
| 490 EXPECT_LE(0, frame.InsertPacket(packet, 0, kNoErrors, frame_data)); | |
| 491 EXPECT_TRUE(dec_state.ContinuousFrame(&frame)); | |
| 492 dec_state.SetState(&frame); | |
| 493 | |
| 494 // Ref to 11, not continuous | |
| 495 frame.Reset(); | |
| 496 Vp9Hdr.picture_id = 16; | |
| 497 EXPECT_LE(0, frame.InsertPacket(packet, 0, kNoErrors, frame_data)); | |
| 498 EXPECT_FALSE(dec_state.ContinuousFrame(&frame)); | |
| 499 | |
| 500 // Ref to 15, continuous | |
| 501 frame.Reset(); | |
| 502 Vp9Hdr.picture_id = 16; | |
| 503 Vp9Hdr.pid_diff[0] = 1; | |
| 504 EXPECT_LE(0, frame.InsertPacket(packet, 0, kNoErrors, frame_data)); | |
| 505 EXPECT_TRUE(dec_state.ContinuousFrame(&frame)); | |
| 506 dec_state.SetState(&frame); | |
| 507 | |
| 508 // Ref to 11 and 15, not continuous | |
| 509 frame.Reset(); | |
| 510 Vp9Hdr.picture_id = 20; | |
| 511 Vp9Hdr.num_ref_pics = 2; | |
| 512 Vp9Hdr.pid_diff[0] = 9; | |
| 513 Vp9Hdr.pid_diff[1] = 5; | |
| 514 EXPECT_LE(0, frame.InsertPacket(packet, 0, kNoErrors, frame_data)); | |
| 515 EXPECT_FALSE(dec_state.ContinuousFrame(&frame)); | |
| 516 | |
| 517 // Ref to 10, 15 and 16, continuous | |
| 518 frame.Reset(); | |
| 519 Vp9Hdr.picture_id = 22; | |
| 520 Vp9Hdr.num_ref_pics = 3; | |
| 521 Vp9Hdr.pid_diff[0] = 12; | |
| 522 Vp9Hdr.pid_diff[1] = 7; | |
| 523 Vp9Hdr.pid_diff[2] = 6; | |
| 524 EXPECT_LE(0, frame.InsertPacket(packet, 0, kNoErrors, frame_data)); | |
| 525 EXPECT_TRUE(dec_state.ContinuousFrame(&frame)); | |
| 526 dec_state.SetState(&frame); | |
| 527 | |
| 528 // Frame at last index, ref to 10, continuous | |
| 529 frame.Reset(); | |
| 530 Vp9Hdr.picture_id = VCMDecodingState::kFrameDecodedLength - 1; | |
| 531 Vp9Hdr.num_ref_pics = 1; | |
| 532 Vp9Hdr.pid_diff[0] = VCMDecodingState::kFrameDecodedLength - 11; | |
| 533 EXPECT_LE(0, frame.InsertPacket(packet, 0, kNoErrors, frame_data)); | |
| 534 EXPECT_TRUE(dec_state.ContinuousFrame(&frame)); | |
| 535 dec_state.SetState(&frame); | |
| 536 | |
| 537 // Frame after wrapping buffer length, ref to 10 and last index, continuous | |
| 538 frame.Reset(); | |
| 539 Vp9Hdr.picture_id = 0; | |
| 540 Vp9Hdr.num_ref_pics = 2; | |
| 541 Vp9Hdr.pid_diff[0] = 1; | |
| 542 Vp9Hdr.pid_diff[1] = VCMDecodingState::kFrameDecodedLength - 10; | |
| 543 EXPECT_LE(0, frame.InsertPacket(packet, 0, kNoErrors, frame_data)); | |
| 544 EXPECT_TRUE(dec_state.ContinuousFrame(&frame)); | |
| 545 dec_state.SetState(&frame); | |
| 546 | |
| 547 // Frame after wrapping start frame, ref to 0, continuous | |
|
åsapersson
2015/11/06 10:19:34
Would this work if for example pid_diff was 10. Wo
philipel1
2015/11/06 14:35:16
Yes, that would incorrectly report the frame as co
| |
| 548 frame.Reset(); | |
| 549 Vp9Hdr.picture_id = 20; | |
| 550 Vp9Hdr.num_ref_pics = 1; | |
| 551 Vp9Hdr.pid_diff[0] = 20; | |
| 552 EXPECT_LE(0, frame.InsertPacket(packet, 0, kNoErrors, frame_data)); | |
| 553 EXPECT_TRUE(dec_state.ContinuousFrame(&frame)); | |
| 554 dec_state.SetState(&frame); | |
| 555 | |
| 556 // Frame after wrapping start frame, ref to 10, not continuous | |
| 557 frame.Reset(); | |
| 558 Vp9Hdr.picture_id = 23; | |
| 559 Vp9Hdr.num_ref_pics = 1; | |
| 560 Vp9Hdr.pid_diff[0] = 13; | |
| 561 EXPECT_LE(0, frame.InsertPacket(packet, 0, kNoErrors, frame_data)); | |
| 562 EXPECT_FALSE(dec_state.ContinuousFrame(&frame)); | |
| 563 | |
| 564 // Key frame, continuous | |
| 565 frame.Reset(); | |
| 566 packet.frameType = kVideoFrameKey; | |
| 567 Vp9Hdr.picture_id = 25; | |
| 568 Vp9Hdr.num_ref_pics = 0; | |
| 569 EXPECT_LE(0, frame.InsertPacket(packet, 0, kNoErrors, frame_data)); | |
| 570 EXPECT_TRUE(dec_state.ContinuousFrame(&frame)); | |
| 571 dec_state.SetState(&frame); | |
| 572 | |
| 573 // Ref to frame previous to KF, not continuous | |
| 574 frame.Reset(); | |
| 575 packet.frameType = kVideoFrameDelta; | |
| 576 Vp9Hdr.picture_id = 30; | |
| 577 Vp9Hdr.num_ref_pics = 1; | |
| 578 Vp9Hdr.pid_diff[0] = 30; | |
| 579 EXPECT_LE(0, frame.InsertPacket(packet, 0, kNoErrors, frame_data)); | |
| 580 EXPECT_FALSE(dec_state.ContinuousFrame(&frame)); | |
| 581 } | |
| 582 | |
| 449 } // namespace webrtc | 583 } // namespace webrtc |
| OLD | NEW |