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

Side by Side Diff: webrtc/modules/rtp_rtcp/source/rtp_format_vp8_unittest.cc

Issue 2999063002: Add flag enabling more packets to be retransmittable. (Closed)
Patch Set: whitespace Created 3 years, 3 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
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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 hdr_info_.nonReference = false; 88 hdr_info_.nonReference = false;
89 hdr_info_.temporalIdx = kNoTemporalIdx; 89 hdr_info_.temporalIdx = kNoTemporalIdx;
90 hdr_info_.layerSync = false; 90 hdr_info_.layerSync = false;
91 hdr_info_.tl0PicIdx = kNoTl0PicIdx; 91 hdr_info_.tl0PicIdx = kNoTl0PicIdx;
92 hdr_info_.keyIdx = kNoKeyIdx; 92 hdr_info_.keyIdx = kNoKeyIdx;
93 if (helper_ != NULL) 93 if (helper_ != NULL)
94 return false; 94 return false;
95 helper_ = new test::RtpFormatVp8TestHelper(&hdr_info_); 95 helper_ = new test::RtpFormatVp8TestHelper(&hdr_info_);
96 return helper_->Init(partition_sizes, num_partitions); 96 return helper_->Init(partition_sizes, num_partitions);
97 } 97 }
98
99 RTPVideoHeaderVP8 hdr_info_; 98 RTPVideoHeaderVP8 hdr_info_;
100 test::RtpFormatVp8TestHelper* helper_; 99 test::RtpFormatVp8TestHelper* helper_;
101 }; 100 };
102 101
103 TEST_F(RtpPacketizerVp8Test, TestStrictMode) { 102 TEST_F(RtpPacketizerVp8Test, TestStrictMode) {
104 const size_t kSizeVector[] = {10, 8, 27}; 103 const size_t kSizeVector[] = {10, 8, 27};
105 const size_t kNumPartitions = GTEST_ARRAY_SIZE_(kSizeVector); 104 const size_t kNumPartitions = GTEST_ARRAY_SIZE_(kSizeVector);
106 ASSERT_TRUE(Init(kSizeVector, kNumPartitions)); 105 ASSERT_TRUE(Init(kSizeVector, kNumPartitions));
107 106
108 hdr_info_.pictureId = 200; 107 hdr_info_.pictureId = 200;
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 CHECK_ARRAY_SIZE(kExpectedNum, kExpectedFragStart); 522 CHECK_ARRAY_SIZE(kExpectedNum, kExpectedFragStart);
524 ASSERT_EQ(num_packets, kExpectedNum); 523 ASSERT_EQ(num_packets, kExpectedNum);
525 524
526 helper_->GetAllPacketsAndCheck(&packetizer, 525 helper_->GetAllPacketsAndCheck(&packetizer,
527 kExpectedSizes, 526 kExpectedSizes,
528 kExpectedPart, 527 kExpectedPart,
529 kExpectedFragStart, 528 kExpectedFragStart,
530 kExpectedNum); 529 kExpectedNum);
531 } 530 }
532 531
532 TEST_F(RtpPacketizerVp8Test, RetransmitNoTL) {
533 hdr_info_.temporalIdx = kNoTemporalIdx;
534 RtpPacketizerVp8 packetizer(hdr_info_, 1500, 0, kAggregate);
535
536 EXPECT_EQ(kDontRetransmit, packetizer.GetStorageType(kRetransmitOff));
537 EXPECT_EQ(kAllowRetransmission,
538 packetizer.GetStorageType(kRetransmitBaseLayer));
539 EXPECT_EQ(kAllowRetransmission,
540 packetizer.GetStorageType(kRetransmitHigherLayers));
541 EXPECT_EQ(kAllowRetransmission,
542 packetizer.GetStorageType(kConditionallyRetransmitHigherLayers));
543 EXPECT_EQ(kAllowRetransmission,
544 packetizer.GetStorageType(kRetransmitAllPackets));
545 }
546
547 TEST_F(RtpPacketizerVp8Test, RetransmitTL0) {
548 hdr_info_.temporalIdx = 0;
549 RtpPacketizerVp8 packetizer(hdr_info_, 1500, 0, kAggregate);
550
551 EXPECT_EQ(kDontRetransmit, packetizer.GetStorageType(kRetransmitOff));
552 EXPECT_EQ(kAllowRetransmission,
553 packetizer.GetStorageType(kRetransmitBaseLayer));
554 EXPECT_EQ(kDontRetransmit,
555 packetizer.GetStorageType(kRetransmitHigherLayers));
556 EXPECT_EQ(kAllowRetransmission,
557 packetizer.GetStorageType(kRetransmitBaseLayer |
558 kRetransmitHigherLayers));
559 EXPECT_EQ(kDontRetransmit,
560 packetizer.GetStorageType(kConditionallyRetransmitHigherLayers));
561 EXPECT_EQ(kAllowRetransmission,
562 packetizer.GetStorageType(kRetransmitBaseLayer |
563 kConditionallyRetransmitHigherLayers));
564 EXPECT_EQ(kAllowRetransmission,
565 packetizer.GetStorageType(kRetransmitAllPackets));
566 }
567
568 TEST_F(RtpPacketizerVp8Test, RetransmitTL1_2) {
danilchap 2017/08/29 17:31:19 _ is discouraged in test names. https://github.com
sprang_webrtc 2017/08/31 15:54:28 Done.
569 for (int tid = 1; tid <= 2; ++tid) {
570 hdr_info_.temporalIdx = tid;
571 RtpPacketizerVp8 packetizer(hdr_info_, 1500, 0, kAggregate);
572
573 EXPECT_EQ(kDontRetransmit, packetizer.GetStorageType(kRetransmitOff));
574 EXPECT_EQ(kDontRetransmit, packetizer.GetStorageType(kRetransmitBaseLayer));
575 EXPECT_EQ(kAllowRetransmission,
576 packetizer.GetStorageType(kRetransmitHigherLayers));
577 EXPECT_EQ(kAllowRetransmission,
578 packetizer.GetStorageType(kRetransmitBaseLayer |
579 kRetransmitHigherLayers));
580 EXPECT_EQ(kDontRetransmit,
581 packetizer.GetStorageType(kConditionallyRetransmitHigherLayers));
582 EXPECT_EQ(kDontRetransmit,
583 packetizer.GetStorageType(kRetransmitBaseLayer |
584 kConditionallyRetransmitHigherLayers));
585 EXPECT_EQ(kAllowRetransmission,
586 packetizer.GetStorageType(kRetransmitAllPackets));
587 }
588 }
589
590 TEST_F(RtpPacketizerVp8Test, RetransmitTL3) {
danilchap 2017/08/29 17:31:19 how TL3 is different from TL2/TL1?
sprang_webrtc 2017/08/31 15:54:28 It was only different in an earlier revision of th
591 hdr_info_.temporalIdx = 3;
592 RtpPacketizerVp8 packetizer(hdr_info_, 1500, 0, kAggregate);
593
594 EXPECT_EQ(kDontRetransmit, packetizer.GetStorageType(kRetransmitOff));
595 EXPECT_EQ(kDontRetransmit, packetizer.GetStorageType(kRetransmitBaseLayer));
596 EXPECT_EQ(kAllowRetransmission,
597 packetizer.GetStorageType(kRetransmitHigherLayers));
598 EXPECT_EQ(kAllowRetransmission,
599 packetizer.GetStorageType(kRetransmitBaseLayer |
600 kRetransmitHigherLayers));
601 EXPECT_EQ(kDontRetransmit,
602 packetizer.GetStorageType(kConditionallyRetransmitHigherLayers));
603 EXPECT_EQ(kDontRetransmit,
604 packetizer.GetStorageType(kRetransmitBaseLayer |
605 kConditionallyRetransmitHigherLayers));
606 EXPECT_EQ(kAllowRetransmission,
607 packetizer.GetStorageType(kRetransmitAllPackets));
608 }
609
533 class RtpDepacketizerVp8Test : public ::testing::Test { 610 class RtpDepacketizerVp8Test : public ::testing::Test {
534 protected: 611 protected:
535 RtpDepacketizerVp8Test() 612 RtpDepacketizerVp8Test()
536 : depacketizer_(RtpDepacketizer::Create(kRtpVideoVp8)) {} 613 : depacketizer_(RtpDepacketizer::Create(kRtpVideoVp8)) {}
537 614
538 void ExpectPacket(RtpDepacketizer::ParsedPayload* parsed_payload, 615 void ExpectPacket(RtpDepacketizer::ParsedPayload* parsed_payload,
539 const uint8_t* data, 616 const uint8_t* data,
540 size_t length) { 617 size_t length) {
541 ASSERT_TRUE(parsed_payload != NULL); 618 ASSERT_TRUE(parsed_payload != NULL);
542 EXPECT_THAT(std::vector<uint8_t>( 619 EXPECT_THAT(std::vector<uint8_t>(
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
722 input_header.layerSync); 799 input_header.layerSync);
723 } 800 }
724 801
725 TEST_F(RtpDepacketizerVp8Test, TestEmptyPayload) { 802 TEST_F(RtpDepacketizerVp8Test, TestEmptyPayload) {
726 // Using a wild pointer to crash on accesses from inside the depacketizer. 803 // Using a wild pointer to crash on accesses from inside the depacketizer.
727 uint8_t* garbage_ptr = reinterpret_cast<uint8_t*>(0x4711); 804 uint8_t* garbage_ptr = reinterpret_cast<uint8_t*>(0x4711);
728 RtpDepacketizer::ParsedPayload payload; 805 RtpDepacketizer::ParsedPayload payload;
729 EXPECT_FALSE(depacketizer_->Parse(&payload, garbage_ptr, 0)); 806 EXPECT_FALSE(depacketizer_->Parse(&payload, garbage_ptr, 0));
730 } 807 }
731 } // namespace webrtc 808 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698