Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(82)

Side by Side Diff: webrtc/modules/video_coding/main/source/decoding_state_unittest.cc

Issue 1438543002: Revert of Work on flexible mode and screen sharing. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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, FrameContinuityFlexibleModeKeyFrame) {
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& vp9_hdr = packet.codecSpecificHeader.codecHeader.VP9;
462 vp9_hdr.picture_id = 10;
463 vp9_hdr.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 dec_state.SetState(&frame);
474
475 // Key frame again
476 vp9_hdr.picture_id = 11;
477 frame.Reset();
478 EXPECT_LE(0, frame.InsertPacket(packet, 0, kNoErrors, frame_data));
479 EXPECT_TRUE(dec_state.ContinuousFrame(&frame));
480 dec_state.SetState(&frame);
481
482 // Ref to 11, continuous
483 frame.Reset();
484 packet.frameType = kVideoFrameDelta;
485 vp9_hdr.picture_id = 12;
486 vp9_hdr.num_ref_pics = 1;
487 vp9_hdr.pid_diff[0] = 1;
488 EXPECT_LE(0, frame.InsertPacket(packet, 0, kNoErrors, frame_data));
489 EXPECT_TRUE(dec_state.ContinuousFrame(&frame));
490 }
491
492 TEST(TestDecodingState, FrameContinuityFlexibleModeOutOfOrderFrames) {
493 VCMDecodingState dec_state;
494 VCMFrameBuffer frame;
495 VCMPacket packet;
496 packet.isFirstPacket = true;
497 packet.timestamp = 1;
498 packet.seqNum = 0xffff;
499 uint8_t data[] = "I need a data pointer for this test!";
500 packet.sizeBytes = sizeof(data);
501 packet.dataPtr = data;
502 packet.codecSpecificHeader.codec = kRtpVideoVp9;
503
504 RTPVideoHeaderVP9& vp9_hdr = packet.codecSpecificHeader.codecHeader.VP9;
505 vp9_hdr.picture_id = 10;
506 vp9_hdr.flexible_mode = true;
507
508 FrameData frame_data;
509 frame_data.rtt_ms = 0;
510 frame_data.rolling_average_packets_per_frame = -1;
511
512 // Key frame as first frame
513 packet.frameType = kVideoFrameKey;
514 EXPECT_LE(0, frame.InsertPacket(packet, 0, kNoErrors, frame_data));
515 EXPECT_TRUE(dec_state.ContinuousFrame(&frame));
516 dec_state.SetState(&frame);
517
518 // Ref to 10, continuous
519 frame.Reset();
520 packet.frameType = kVideoFrameDelta;
521 vp9_hdr.picture_id = 15;
522 vp9_hdr.num_ref_pics = 1;
523 vp9_hdr.pid_diff[0] = 5;
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 // Out of order, last id 15, this id 12, ref to 10, continuous
529 frame.Reset();
530 vp9_hdr.picture_id = 12;
531 vp9_hdr.pid_diff[0] = 2;
532 EXPECT_LE(0, frame.InsertPacket(packet, 0, kNoErrors, frame_data));
533 EXPECT_TRUE(dec_state.ContinuousFrame(&frame));
534 dec_state.SetState(&frame);
535
536 // Ref 10, 12, 15, continuous
537 frame.Reset();
538 vp9_hdr.picture_id = 20;
539 vp9_hdr.num_ref_pics = 3;
540 vp9_hdr.pid_diff[0] = 10;
541 vp9_hdr.pid_diff[1] = 8;
542 vp9_hdr.pid_diff[2] = 5;
543 EXPECT_LE(0, frame.InsertPacket(packet, 0, kNoErrors, frame_data));
544 EXPECT_TRUE(dec_state.ContinuousFrame(&frame));
545 }
546
547 TEST(TestDecodingState, FrameContinuityFlexibleModeGeneral) {
548 VCMDecodingState dec_state;
549 VCMFrameBuffer frame;
550 VCMPacket packet;
551 packet.isFirstPacket = true;
552 packet.timestamp = 1;
553 packet.seqNum = 0xffff;
554 uint8_t data[] = "I need a data pointer for this test!";
555 packet.sizeBytes = sizeof(data);
556 packet.dataPtr = data;
557 packet.codecSpecificHeader.codec = kRtpVideoVp9;
558
559 RTPVideoHeaderVP9& vp9_hdr = packet.codecSpecificHeader.codecHeader.VP9;
560 vp9_hdr.picture_id = 10;
561 vp9_hdr.flexible_mode = true;
562
563 FrameData frame_data;
564 frame_data.rtt_ms = 0;
565 frame_data.rolling_average_packets_per_frame = -1;
566
567 // Key frame as first frame
568 packet.frameType = kVideoFrameKey;
569 EXPECT_LE(0, frame.InsertPacket(packet, 0, kNoErrors, frame_data));
570 EXPECT_TRUE(dec_state.ContinuousFrame(&frame));
571
572 // Delta frame as first frame
573 frame.Reset();
574 packet.frameType = kVideoFrameDelta;
575 EXPECT_LE(0, frame.InsertPacket(packet, 0, kNoErrors, frame_data));
576 EXPECT_FALSE(dec_state.ContinuousFrame(&frame));
577
578 // Key frame then delta frame
579 frame.Reset();
580 packet.frameType = kVideoFrameKey;
581 EXPECT_LE(0, frame.InsertPacket(packet, 0, kNoErrors, frame_data));
582 dec_state.SetState(&frame);
583 frame.Reset();
584 packet.frameType = kVideoFrameDelta;
585 vp9_hdr.num_ref_pics = 1;
586 vp9_hdr.picture_id = 15;
587 vp9_hdr.pid_diff[0] = 5;
588 EXPECT_LE(0, frame.InsertPacket(packet, 0, kNoErrors, frame_data));
589 EXPECT_TRUE(dec_state.ContinuousFrame(&frame));
590 dec_state.SetState(&frame);
591
592 // Ref to 11, not continuous
593 frame.Reset();
594 vp9_hdr.picture_id = 16;
595 EXPECT_LE(0, frame.InsertPacket(packet, 0, kNoErrors, frame_data));
596 EXPECT_FALSE(dec_state.ContinuousFrame(&frame));
597
598 // Ref to 15, continuous
599 frame.Reset();
600 vp9_hdr.picture_id = 16;
601 vp9_hdr.pid_diff[0] = 1;
602 EXPECT_LE(0, frame.InsertPacket(packet, 0, kNoErrors, frame_data));
603 EXPECT_TRUE(dec_state.ContinuousFrame(&frame));
604 dec_state.SetState(&frame);
605
606 // Ref to 11 and 15, not continuous
607 frame.Reset();
608 vp9_hdr.picture_id = 20;
609 vp9_hdr.num_ref_pics = 2;
610 vp9_hdr.pid_diff[0] = 9;
611 vp9_hdr.pid_diff[1] = 5;
612 EXPECT_LE(0, frame.InsertPacket(packet, 0, kNoErrors, frame_data));
613 EXPECT_FALSE(dec_state.ContinuousFrame(&frame));
614
615 // Ref to 10, 15 and 16, continuous
616 frame.Reset();
617 vp9_hdr.picture_id = 22;
618 vp9_hdr.num_ref_pics = 3;
619 vp9_hdr.pid_diff[0] = 12;
620 vp9_hdr.pid_diff[1] = 7;
621 vp9_hdr.pid_diff[2] = 6;
622 EXPECT_LE(0, frame.InsertPacket(packet, 0, kNoErrors, frame_data));
623 EXPECT_TRUE(dec_state.ContinuousFrame(&frame));
624 dec_state.SetState(&frame);
625
626 // Key Frame, continuous
627 frame.Reset();
628 packet.frameType = kVideoFrameKey;
629 vp9_hdr.picture_id = VCMDecodingState::kFrameDecodedLength - 2;
630 vp9_hdr.num_ref_pics = 0;
631 EXPECT_LE(0, frame.InsertPacket(packet, 0, kNoErrors, frame_data));
632 EXPECT_TRUE(dec_state.ContinuousFrame(&frame));
633 dec_state.SetState(&frame);
634
635 // Frame at last index, ref to KF, continuous
636 frame.Reset();
637 packet.frameType = kVideoFrameDelta;
638 vp9_hdr.picture_id = VCMDecodingState::kFrameDecodedLength - 1;
639 vp9_hdr.num_ref_pics = 1;
640 vp9_hdr.pid_diff[0] = 1;
641 EXPECT_LE(0, frame.InsertPacket(packet, 0, kNoErrors, frame_data));
642 EXPECT_TRUE(dec_state.ContinuousFrame(&frame));
643 dec_state.SetState(&frame);
644
645 // Frame after wrapping buffer length, ref to last index, continuous
646 frame.Reset();
647 vp9_hdr.picture_id = 0;
648 vp9_hdr.num_ref_pics = 1;
649 vp9_hdr.pid_diff[0] = 1;
650 EXPECT_LE(0, frame.InsertPacket(packet, 0, kNoErrors, frame_data));
651 EXPECT_TRUE(dec_state.ContinuousFrame(&frame));
652 dec_state.SetState(&frame);
653
654 // Frame after wrapping start frame, ref to 0, continuous
655 frame.Reset();
656 vp9_hdr.picture_id = 20;
657 vp9_hdr.num_ref_pics = 1;
658 vp9_hdr.pid_diff[0] = 20;
659 EXPECT_LE(0, frame.InsertPacket(packet, 0, kNoErrors, frame_data));
660 EXPECT_TRUE(dec_state.ContinuousFrame(&frame));
661 dec_state.SetState(&frame);
662
663 // Frame after wrapping start frame, ref to 10, not continuous
664 frame.Reset();
665 vp9_hdr.picture_id = 23;
666 vp9_hdr.num_ref_pics = 1;
667 vp9_hdr.pid_diff[0] = 13;
668 EXPECT_LE(0, frame.InsertPacket(packet, 0, kNoErrors, frame_data));
669 EXPECT_FALSE(dec_state.ContinuousFrame(&frame));
670
671 // Key frame, continuous
672 frame.Reset();
673 packet.frameType = kVideoFrameKey;
674 vp9_hdr.picture_id = 25;
675 vp9_hdr.num_ref_pics = 0;
676 EXPECT_LE(0, frame.InsertPacket(packet, 0, kNoErrors, frame_data));
677 EXPECT_TRUE(dec_state.ContinuousFrame(&frame));
678 dec_state.SetState(&frame);
679
680 // Ref to KF, continuous
681 frame.Reset();
682 packet.frameType = kVideoFrameDelta;
683 vp9_hdr.picture_id = 26;
684 vp9_hdr.num_ref_pics = 1;
685 vp9_hdr.pid_diff[0] = 1;
686 EXPECT_LE(0, frame.InsertPacket(packet, 0, kNoErrors, frame_data));
687 EXPECT_TRUE(dec_state.ContinuousFrame(&frame));
688 dec_state.SetState(&frame);
689
690 // Ref to frame previous to KF, not continuous
691 frame.Reset();
692 vp9_hdr.picture_id = 30;
693 vp9_hdr.num_ref_pics = 1;
694 vp9_hdr.pid_diff[0] = 30;
695 EXPECT_LE(0, frame.InsertPacket(packet, 0, kNoErrors, frame_data));
696 EXPECT_FALSE(dec_state.ContinuousFrame(&frame));
697 }
698
699 } // namespace webrtc 449 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/video_coding/main/source/decoding_state.cc ('k') | webrtc/modules/video_coding/main/source/encoded_frame.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698