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

Side by Side Diff: webrtc/modules/video_coding/session_info_unittest.cc

Issue 2380933003: Delete unused support for vp8 partitions. (Closed)
Patch Set: Created 4 years, 2 months 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
« no previous file with comments | « webrtc/modules/video_coding/session_info.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 enum { kPacketBufferSize = 10 }; 54 enum { kPacketBufferSize = 10 };
55 55
56 uint8_t packet_buffer_[kPacketBufferSize]; 56 uint8_t packet_buffer_[kPacketBufferSize];
57 uint8_t frame_buffer_[10 * kPacketBufferSize]; 57 uint8_t frame_buffer_[10 * kPacketBufferSize];
58 58
59 VCMSessionInfo session_; 59 VCMSessionInfo session_;
60 VCMPacket packet_; 60 VCMPacket packet_;
61 FrameData frame_data; 61 FrameData frame_data;
62 }; 62 };
63 63
64 class TestVP8Partitions : public TestSessionInfo {
65 protected:
66 enum { kMaxVP8Partitions = 9 };
67
68 virtual void SetUp() {
69 TestSessionInfo::SetUp();
70 vp8_header_ = &packet_header_.type.Video.codecHeader.VP8;
71 packet_header_.frameType = kVideoFrameDelta;
72 packet_header_.type.Video.codec = kRtpVideoVp8;
73 vp8_header_->InitRTPVideoHeaderVP8();
74 fragmentation_.VerifyAndAllocateFragmentationHeader(kMaxVP8Partitions);
75 }
76
77 bool VerifyPartition(int partition_id,
78 int packets_expected,
79 int start_value) {
80 EXPECT_EQ(packets_expected * packet_buffer_size(),
81 fragmentation_.fragmentationLength[partition_id]);
82 for (int i = 0; i < packets_expected; ++i) {
83 size_t packet_index = fragmentation_.fragmentationOffset[partition_id] +
84 i * packet_buffer_size();
85 if (packet_index + packet_buffer_size() > frame_buffer_size())
86 return false;
87 VerifyPacket(frame_buffer_ + packet_index, start_value + i);
88 }
89 return true;
90 }
91
92 WebRtcRTPHeader packet_header_;
93 RTPVideoHeaderVP8* vp8_header_;
94 RTPFragmentationHeader fragmentation_;
95 };
96
97 class TestNalUnits : public TestSessionInfo { 64 class TestNalUnits : public TestSessionInfo {
98 protected: 65 protected:
99 virtual void SetUp() { 66 virtual void SetUp() {
100 TestSessionInfo::SetUp(); 67 TestSessionInfo::SetUp();
101 packet_.codec = kVideoCodecVP8; 68 packet_.codec = kVideoCodecVP8;
102 } 69 }
103 70
104 bool VerifyNalu(int offset, int packets_expected, int start_value) { 71 bool VerifyNalu(int offset, int packets_expected, int start_value) {
105 EXPECT_GE(session_.SessionLength(), 72 EXPECT_GE(session_.SessionLength(),
106 packets_expected * packet_buffer_size()); 73 packets_expected * packet_buffer_size());
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 kNoErrors, frame_data))); 376 kNoErrors, frame_data)));
410 377
411 packet_.seqNum = 0x0009; 378 packet_.seqNum = 0x0009;
412 packet_.isFirstPacket = false; 379 packet_.isFirstPacket = false;
413 packet_.markerBit = false; 380 packet_.markerBit = false;
414 FillPacket(1); 381 FillPacket(1);
415 EXPECT_EQ( 382 EXPECT_EQ(
416 -3, session_.InsertPacket(packet_, frame_buffer_, kNoErrors, frame_data)); 383 -3, session_.InsertPacket(packet_, frame_buffer_, kNoErrors, frame_data));
417 } 384 }
418 385
419 TEST_F(TestVP8Partitions, TwoPartitionsOneLoss) {
420 // Partition 0 | Partition 1
421 // [ 0 ] [ 2 ] | [ 3 ]
422 packet_header_.type.Video.isFirstPacket = true;
423 vp8_header_->beginningOfPartition = true;
424 vp8_header_->partitionId = 0;
425 packet_header_.header.markerBit = false;
426 packet_header_.header.sequenceNumber = 0;
427 FillPacket(0);
428 VCMPacket* packet =
429 new VCMPacket(packet_buffer_, packet_buffer_size(), packet_header_);
430 EXPECT_EQ(packet_buffer_size(),
431 static_cast<size_t>(session_.InsertPacket(*packet, frame_buffer_,
432 kNoErrors, frame_data)));
433 delete packet;
434
435 packet_header_.type.Video.isFirstPacket = false;
436 vp8_header_->partitionId = 0;
437 vp8_header_->beginningOfPartition = false;
438 packet_header_.header.markerBit = false;
439 packet_header_.header.sequenceNumber += 2;
440 FillPacket(2);
441 packet = new VCMPacket(packet_buffer_, packet_buffer_size(), packet_header_);
442 EXPECT_EQ(packet_buffer_size(),
443 static_cast<size_t>(session_.InsertPacket(*packet, frame_buffer_,
444 kNoErrors, frame_data)));
445 delete packet;
446
447 packet_header_.type.Video.isFirstPacket = false;
448 vp8_header_->partitionId = 1;
449 vp8_header_->beginningOfPartition = true;
450 packet_header_.header.markerBit = true;
451 packet_header_.header.sequenceNumber += 1;
452 FillPacket(3);
453 packet = new VCMPacket(packet_buffer_, packet_buffer_size(), packet_header_);
454 EXPECT_EQ(packet_buffer_size(),
455 static_cast<size_t>(session_.InsertPacket(*packet, frame_buffer_,
456 kNoErrors, frame_data)));
457 delete packet;
458
459 // One packet should be removed (end of partition 0).
460 EXPECT_EQ(2 * packet_buffer_size(),
461 session_.BuildVP8FragmentationHeader(
462 frame_buffer_, frame_buffer_size(), &fragmentation_));
463 SCOPED_TRACE("Calling VerifyPartition");
464 EXPECT_TRUE(VerifyPartition(0, 1, 0));
465 SCOPED_TRACE("Calling VerifyPartition");
466 EXPECT_TRUE(VerifyPartition(1, 1, 3));
467 }
468
469 TEST_F(TestVP8Partitions, TwoPartitionsOneLoss2) {
470 // Partition 0 | Partition 1
471 // [ 1 ] [ 2 ] | [ 3 ] [ 5 ]
472 packet_header_.type.Video.isFirstPacket = true;
473 vp8_header_->beginningOfPartition = true;
474 vp8_header_->partitionId = 0;
475 packet_header_.header.markerBit = false;
476 packet_header_.header.sequenceNumber = 1;
477 FillPacket(1);
478 VCMPacket* packet =
479 new VCMPacket(packet_buffer_, packet_buffer_size(), packet_header_);
480 EXPECT_EQ(packet_buffer_size(),
481 static_cast<size_t>(session_.InsertPacket(*packet, frame_buffer_,
482 kNoErrors, frame_data)));
483 delete packet;
484
485 packet_header_.type.Video.isFirstPacket = false;
486 vp8_header_->partitionId = 0;
487 vp8_header_->beginningOfPartition = false;
488 packet_header_.header.markerBit = false;
489 packet_header_.header.sequenceNumber += 1;
490 FillPacket(2);
491 packet = new VCMPacket(packet_buffer_, packet_buffer_size(), packet_header_);
492 EXPECT_EQ(packet_buffer_size(),
493 static_cast<size_t>(session_.InsertPacket(*packet, frame_buffer_,
494 kNoErrors, frame_data)));
495 delete packet;
496
497 packet_header_.type.Video.isFirstPacket = false;
498 vp8_header_->partitionId = 1;
499 vp8_header_->beginningOfPartition = true;
500 packet_header_.header.markerBit = false;
501 packet_header_.header.sequenceNumber += 1;
502 FillPacket(3);
503 packet = new VCMPacket(packet_buffer_, packet_buffer_size(), packet_header_);
504 EXPECT_EQ(packet_buffer_size(),
505 static_cast<size_t>(session_.InsertPacket(*packet, frame_buffer_,
506 kNoErrors, frame_data)));
507 delete packet;
508
509 packet_header_.type.Video.isFirstPacket = false;
510 vp8_header_->partitionId = 1;
511 vp8_header_->beginningOfPartition = false;
512 packet_header_.header.markerBit = true;
513 packet_header_.header.sequenceNumber += 2;
514 FillPacket(5);
515 packet = new VCMPacket(packet_buffer_, packet_buffer_size(), packet_header_);
516 EXPECT_EQ(packet_buffer_size(),
517 static_cast<size_t>(session_.InsertPacket(*packet, frame_buffer_,
518 kNoErrors, frame_data)));
519 delete packet;
520
521 // One packet should be removed (end of partition 2), 3 left.
522 EXPECT_EQ(3 * packet_buffer_size(),
523 session_.BuildVP8FragmentationHeader(
524 frame_buffer_, frame_buffer_size(), &fragmentation_));
525 SCOPED_TRACE("Calling VerifyPartition");
526 EXPECT_TRUE(VerifyPartition(0, 2, 1));
527 SCOPED_TRACE("Calling VerifyPartition");
528 EXPECT_TRUE(VerifyPartition(1, 1, 3));
529 }
530
531 TEST_F(TestVP8Partitions, TwoPartitionsNoLossWrap) {
532 // Partition 0 | Partition 1
533 // [ fffd ] [ fffe ] | [ ffff ] [ 0 ]
534 packet_header_.type.Video.isFirstPacket = true;
535 vp8_header_->beginningOfPartition = true;
536 vp8_header_->partitionId = 0;
537 packet_header_.header.markerBit = false;
538 packet_header_.header.sequenceNumber = 0xfffd;
539 FillPacket(0);
540 VCMPacket* packet =
541 new VCMPacket(packet_buffer_, packet_buffer_size(), packet_header_);
542 EXPECT_EQ(packet_buffer_size(),
543 static_cast<size_t>(session_.InsertPacket(*packet, frame_buffer_,
544 kNoErrors, frame_data)));
545 delete packet;
546
547 packet_header_.type.Video.isFirstPacket = false;
548 vp8_header_->partitionId = 0;
549 vp8_header_->beginningOfPartition = false;
550 packet_header_.header.markerBit = false;
551 packet_header_.header.sequenceNumber += 1;
552 FillPacket(1);
553 packet = new VCMPacket(packet_buffer_, packet_buffer_size(), packet_header_);
554 EXPECT_EQ(packet_buffer_size(),
555 static_cast<size_t>(session_.InsertPacket(*packet, frame_buffer_,
556 kNoErrors, frame_data)));
557 delete packet;
558
559 packet_header_.type.Video.isFirstPacket = false;
560 vp8_header_->partitionId = 1;
561 vp8_header_->beginningOfPartition = true;
562 packet_header_.header.markerBit = false;
563 packet_header_.header.sequenceNumber += 1;
564 FillPacket(2);
565 packet = new VCMPacket(packet_buffer_, packet_buffer_size(), packet_header_);
566 EXPECT_EQ(packet_buffer_size(),
567 static_cast<size_t>(session_.InsertPacket(*packet, frame_buffer_,
568 kNoErrors, frame_data)));
569 delete packet;
570
571 packet_header_.type.Video.isFirstPacket = false;
572 vp8_header_->partitionId = 1;
573 vp8_header_->beginningOfPartition = false;
574 packet_header_.header.markerBit = true;
575 packet_header_.header.sequenceNumber += 1;
576 FillPacket(3);
577 packet = new VCMPacket(packet_buffer_, packet_buffer_size(), packet_header_);
578 EXPECT_EQ(packet_buffer_size(),
579 static_cast<size_t>(session_.InsertPacket(*packet, frame_buffer_,
580 kNoErrors, frame_data)));
581 delete packet;
582
583 // No packet should be removed.
584 EXPECT_EQ(4 * packet_buffer_size(),
585 session_.BuildVP8FragmentationHeader(
586 frame_buffer_, frame_buffer_size(), &fragmentation_));
587 SCOPED_TRACE("Calling VerifyPartition");
588 EXPECT_TRUE(VerifyPartition(0, 2, 0));
589 SCOPED_TRACE("Calling VerifyPartition");
590 EXPECT_TRUE(VerifyPartition(1, 2, 2));
591 }
592
593 TEST_F(TestVP8Partitions, TwoPartitionsLossWrap) {
594 // Partition 0 | Partition 1
595 // [ fffd ] [ fffe ] | [ ffff ] [ 1 ]
596 packet_header_.type.Video.isFirstPacket = true;
597 vp8_header_->beginningOfPartition = true;
598 vp8_header_->partitionId = 0;
599 packet_header_.header.markerBit = false;
600 packet_header_.header.sequenceNumber = 0xfffd;
601 FillPacket(0);
602 VCMPacket* packet =
603 new VCMPacket(packet_buffer_, packet_buffer_size(), packet_header_);
604 EXPECT_EQ(packet_buffer_size(),
605 static_cast<size_t>(session_.InsertPacket(*packet, frame_buffer_,
606 kNoErrors, frame_data)));
607 delete packet;
608
609 packet_header_.type.Video.isFirstPacket = false;
610 vp8_header_->partitionId = 0;
611 vp8_header_->beginningOfPartition = false;
612 packet_header_.header.markerBit = false;
613 packet_header_.header.sequenceNumber += 1;
614 FillPacket(1);
615 packet = new VCMPacket(packet_buffer_, packet_buffer_size(), packet_header_);
616 EXPECT_EQ(packet_buffer_size(),
617 static_cast<size_t>(session_.InsertPacket(*packet, frame_buffer_,
618 kNoErrors, frame_data)));
619 delete packet;
620
621 packet_header_.type.Video.isFirstPacket = false;
622 vp8_header_->partitionId = 1;
623 vp8_header_->beginningOfPartition = true;
624 packet_header_.header.markerBit = false;
625 packet_header_.header.sequenceNumber += 1;
626 FillPacket(2);
627 packet = new VCMPacket(packet_buffer_, packet_buffer_size(), packet_header_);
628 EXPECT_EQ(packet_buffer_size(),
629 static_cast<size_t>(session_.InsertPacket(*packet, frame_buffer_,
630 kNoErrors, frame_data)));
631 delete packet;
632
633 packet_header_.type.Video.isFirstPacket = false;
634 vp8_header_->partitionId = 1;
635 vp8_header_->beginningOfPartition = false;
636 packet_header_.header.markerBit = true;
637 packet_header_.header.sequenceNumber += 2;
638 FillPacket(3);
639 packet = new VCMPacket(packet_buffer_, packet_buffer_size(), packet_header_);
640 EXPECT_EQ(packet_buffer_size(),
641 static_cast<size_t>(session_.InsertPacket(*packet, frame_buffer_,
642 kNoErrors, frame_data)));
643 delete packet;
644
645 // One packet should be removed from the last partition
646 EXPECT_EQ(3 * packet_buffer_size(),
647 session_.BuildVP8FragmentationHeader(
648 frame_buffer_, frame_buffer_size(), &fragmentation_));
649 SCOPED_TRACE("Calling VerifyPartition");
650 EXPECT_TRUE(VerifyPartition(0, 2, 0));
651 SCOPED_TRACE("Calling VerifyPartition");
652 EXPECT_TRUE(VerifyPartition(1, 1, 2));
653 }
654
655 TEST_F(TestVP8Partitions, ThreePartitionsOneMissing) {
656 // Partition 1 |Partition 2 | Partition 3
657 // [ 1 ] [ 2 ] | | [ 5 ] | [ 6 ]
658 packet_header_.type.Video.isFirstPacket = true;
659 vp8_header_->beginningOfPartition = true;
660 vp8_header_->partitionId = 0;
661 packet_header_.header.markerBit = false;
662 packet_header_.header.sequenceNumber = 1;
663 FillPacket(1);
664 VCMPacket* packet =
665 new VCMPacket(packet_buffer_, packet_buffer_size(), packet_header_);
666 EXPECT_EQ(packet_buffer_size(),
667 static_cast<size_t>(session_.InsertPacket(*packet, frame_buffer_,
668 kNoErrors, frame_data)));
669 delete packet;
670
671 packet_header_.type.Video.isFirstPacket = false;
672 vp8_header_->partitionId = 0;
673 vp8_header_->beginningOfPartition = false;
674 packet_header_.header.markerBit = false;
675 packet_header_.header.sequenceNumber += 1;
676 FillPacket(2);
677 packet = new VCMPacket(packet_buffer_, packet_buffer_size(), packet_header_);
678 EXPECT_EQ(packet_buffer_size(),
679 static_cast<size_t>(session_.InsertPacket(*packet, frame_buffer_,
680 kNoErrors, frame_data)));
681 delete packet;
682
683 packet_header_.type.Video.isFirstPacket = false;
684 vp8_header_->partitionId = 2;
685 vp8_header_->beginningOfPartition = true;
686 packet_header_.header.markerBit = false;
687 packet_header_.header.sequenceNumber += 3;
688 FillPacket(5);
689 packet = new VCMPacket(packet_buffer_, packet_buffer_size(), packet_header_);
690 EXPECT_EQ(packet_buffer_size(),
691 static_cast<size_t>(session_.InsertPacket(*packet, frame_buffer_,
692 kNoErrors, frame_data)));
693 delete packet;
694
695 packet_header_.type.Video.isFirstPacket = false;
696 vp8_header_->partitionId = 2;
697 vp8_header_->beginningOfPartition = false;
698 packet_header_.header.markerBit = true;
699 packet_header_.header.sequenceNumber += 1;
700 FillPacket(6);
701 packet = new VCMPacket(packet_buffer_, packet_buffer_size(), packet_header_);
702 EXPECT_EQ(packet_buffer_size(),
703 static_cast<size_t>(session_.InsertPacket(*packet, frame_buffer_,
704 kNoErrors, frame_data)));
705 delete packet;
706
707 // No packet should be removed.
708 EXPECT_EQ(4 * packet_buffer_size(),
709 session_.BuildVP8FragmentationHeader(
710 frame_buffer_, frame_buffer_size(), &fragmentation_));
711 SCOPED_TRACE("Calling VerifyPartition");
712 EXPECT_TRUE(VerifyPartition(0, 2, 1));
713 SCOPED_TRACE("Calling VerifyPartition");
714 EXPECT_TRUE(VerifyPartition(2, 2, 5));
715 }
716
717 TEST_F(TestVP8Partitions, ThreePartitionsLossInSecond) {
718 // Partition 0 |Partition 1 | Partition 2
719 // [ 1 ] [ 2 ] | [ 4 ] [ 5 ] | [ 6 ] [ 7 ]
720 packet_header_.type.Video.isFirstPacket = true;
721 vp8_header_->beginningOfPartition = true;
722 vp8_header_->partitionId = 0;
723 packet_header_.header.markerBit = false;
724 packet_header_.header.sequenceNumber = 1;
725 FillPacket(1);
726 VCMPacket* packet =
727 new VCMPacket(packet_buffer_, packet_buffer_size(), packet_header_);
728 EXPECT_EQ(packet_buffer_size(),
729 static_cast<size_t>(session_.InsertPacket(*packet, frame_buffer_,
730 kNoErrors, frame_data)));
731 delete packet;
732
733 packet_header_.type.Video.isFirstPacket = false;
734 vp8_header_->partitionId = 0;
735 vp8_header_->beginningOfPartition = false;
736 packet_header_.header.markerBit = false;
737 packet_header_.header.sequenceNumber += 1;
738 FillPacket(2);
739 packet = new VCMPacket(packet_buffer_, packet_buffer_size(), packet_header_);
740 EXPECT_EQ(packet_buffer_size(),
741 static_cast<size_t>(session_.InsertPacket(*packet, frame_buffer_,
742 kNoErrors, frame_data)));
743 delete packet;
744
745 packet_header_.type.Video.isFirstPacket = false;
746 vp8_header_->partitionId = 1;
747 vp8_header_->beginningOfPartition = false;
748 packet_header_.header.markerBit = false;
749 packet_header_.header.sequenceNumber += 2;
750 FillPacket(4);
751 packet = new VCMPacket(packet_buffer_, packet_buffer_size(), packet_header_);
752 EXPECT_EQ(packet_buffer_size(),
753 static_cast<size_t>(session_.InsertPacket(*packet, frame_buffer_,
754 kNoErrors, frame_data)));
755 delete packet;
756
757 packet_header_.type.Video.isFirstPacket = false;
758 vp8_header_->partitionId = 1;
759 vp8_header_->beginningOfPartition = false;
760 packet_header_.header.markerBit = false;
761 packet_header_.header.sequenceNumber += 1;
762 FillPacket(5);
763 packet = new VCMPacket(packet_buffer_, packet_buffer_size(), packet_header_);
764 EXPECT_EQ(packet_buffer_size(),
765 static_cast<size_t>(session_.InsertPacket(*packet, frame_buffer_,
766 kNoErrors, frame_data)));
767 delete packet;
768
769 packet_header_.type.Video.isFirstPacket = false;
770 vp8_header_->partitionId = 2;
771 vp8_header_->beginningOfPartition = true;
772 packet_header_.header.markerBit = false;
773 packet_header_.header.sequenceNumber += 1;
774 FillPacket(6);
775 packet = new VCMPacket(packet_buffer_, packet_buffer_size(), packet_header_);
776 EXPECT_EQ(packet_buffer_size(),
777 static_cast<size_t>(session_.InsertPacket(*packet, frame_buffer_,
778 kNoErrors, frame_data)));
779 delete packet;
780
781 packet_header_.type.Video.isFirstPacket = false;
782 vp8_header_->partitionId = 2;
783 vp8_header_->beginningOfPartition = false;
784 packet_header_.header.markerBit = true;
785 packet_header_.header.sequenceNumber += 1;
786 FillPacket(7);
787 packet = new VCMPacket(packet_buffer_, packet_buffer_size(), packet_header_);
788 EXPECT_EQ(packet_buffer_size(),
789 static_cast<size_t>(session_.InsertPacket(*packet, frame_buffer_,
790 kNoErrors, frame_data)));
791 delete packet;
792
793 // 2 partitions left. 2 packets removed from second partition
794 EXPECT_EQ(4 * packet_buffer_size(),
795 session_.BuildVP8FragmentationHeader(
796 frame_buffer_, frame_buffer_size(), &fragmentation_));
797 SCOPED_TRACE("Calling VerifyPartition");
798 EXPECT_TRUE(VerifyPartition(0, 2, 1));
799 SCOPED_TRACE("Calling VerifyPartition");
800 EXPECT_TRUE(VerifyPartition(2, 2, 6));
801 }
802
803 TEST_F(TestVP8Partitions, AggregationOverTwoPackets) {
804 // Partition 0 | Partition 1 | Partition 2
805 // [ 0 | ] [ 1 ] | [ 2 ]
806 packet_header_.type.Video.isFirstPacket = true;
807 vp8_header_->beginningOfPartition = true;
808 vp8_header_->partitionId = 0;
809 packet_header_.header.markerBit = false;
810 packet_header_.header.sequenceNumber = 0;
811 FillPacket(0);
812 VCMPacket* packet =
813 new VCMPacket(packet_buffer_, packet_buffer_size(), packet_header_);
814 EXPECT_EQ(packet_buffer_size(),
815 static_cast<size_t>(session_.InsertPacket(*packet, frame_buffer_,
816 kNoErrors, frame_data)));
817 delete packet;
818
819 packet_header_.type.Video.isFirstPacket = false;
820 vp8_header_->partitionId = 1;
821 vp8_header_->beginningOfPartition = false;
822 packet_header_.header.markerBit = false;
823 packet_header_.header.sequenceNumber += 1;
824 FillPacket(1);
825 packet = new VCMPacket(packet_buffer_, packet_buffer_size(), packet_header_);
826 EXPECT_EQ(packet_buffer_size(),
827 static_cast<size_t>(session_.InsertPacket(*packet, frame_buffer_,
828 kNoErrors, frame_data)));
829 delete packet;
830
831 packet_header_.type.Video.isFirstPacket = false;
832 vp8_header_->partitionId = 2;
833 vp8_header_->beginningOfPartition = true;
834 packet_header_.header.markerBit = true;
835 packet_header_.header.sequenceNumber += 1;
836 FillPacket(2);
837 packet = new VCMPacket(packet_buffer_, packet_buffer_size(), packet_header_);
838 EXPECT_EQ(packet_buffer_size(),
839 static_cast<size_t>(session_.InsertPacket(*packet, frame_buffer_,
840 kNoErrors, frame_data)));
841 delete packet;
842
843 // No packets removed.
844 EXPECT_EQ(3 * packet_buffer_size(),
845 session_.BuildVP8FragmentationHeader(
846 frame_buffer_, frame_buffer_size(), &fragmentation_));
847 SCOPED_TRACE("Calling VerifyPartition");
848 EXPECT_TRUE(VerifyPartition(0, 2, 0));
849 // This partition is aggregated in partition 0
850 SCOPED_TRACE("Calling VerifyPartition");
851 EXPECT_TRUE(VerifyPartition(1, 0, 0));
852 SCOPED_TRACE("Calling VerifyPartition");
853 EXPECT_TRUE(VerifyPartition(2, 1, 2));
854 }
855
856 TEST_F(TestNalUnits, OnlyReceivedEmptyPacket) { 386 TEST_F(TestNalUnits, OnlyReceivedEmptyPacket) {
857 packet_.isFirstPacket = false; 387 packet_.isFirstPacket = false;
858 packet_.completeNALU = kNaluComplete; 388 packet_.completeNALU = kNaluComplete;
859 packet_.frameType = kEmptyFrame; 389 packet_.frameType = kEmptyFrame;
860 packet_.sizeBytes = 0; 390 packet_.sizeBytes = 0;
861 packet_.seqNum = 0; 391 packet_.seqNum = 0;
862 packet_.markerBit = false; 392 packet_.markerBit = false;
863 EXPECT_EQ( 393 EXPECT_EQ(
864 0, session_.InsertPacket(packet_, frame_buffer_, kNoErrors, frame_data)); 394 0, session_.InsertPacket(packet_, frame_buffer_, kNoErrors, frame_data));
865 395
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
1021 FillPacket(1); 551 FillPacket(1);
1022 EXPECT_EQ(packet_buffer_size(), 552 EXPECT_EQ(packet_buffer_size(),
1023 static_cast<size_t>(session_.InsertPacket(packet_, frame_buffer_, 553 static_cast<size_t>(session_.InsertPacket(packet_, frame_buffer_,
1024 kNoErrors, frame_data))); 554 kNoErrors, frame_data)));
1025 555
1026 EXPECT_EQ(2 * packet_buffer_size(), session_.MakeDecodable()); 556 EXPECT_EQ(2 * packet_buffer_size(), session_.MakeDecodable());
1027 EXPECT_EQ(0U, session_.SessionLength()); 557 EXPECT_EQ(0U, session_.SessionLength());
1028 } 558 }
1029 559
1030 } // namespace webrtc 560 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/video_coding/session_info.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698