From aff1751c961c3efdae250309c6231de8925d77b0 Mon Sep 17 00:00:00 2001 From: "henrik.lundin@webrtc.org" Date: Mon, 24 Nov 2014 12:36:58 +0000 Subject: [PATCH] Add new test for VP8 packetizer to test tight partitions It was discovered that if remaining_bytes is an exact multiple of max_payload_len in RtpPacketizerVp8::CalcNextSize, then the packetizer will produce too many packets (i.e., split the payload into more packets than needed). This CL adds a test to trigger the problem. BUG=4019 R=stefan@webrtc.org Review URL: https://webrtc-codereview.appspot.com/24289004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@7739 4adac7df-926f-26a2-2b94-8c16560cd09d --- .../source/rtp_format_vp8_unittest.cc | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/webrtc/modules/rtp_rtcp/source/rtp_format_vp8_unittest.cc b/webrtc/modules/rtp_rtcp/source/rtp_format_vp8_unittest.cc index 84b880daad..d2416b29a4 100644 --- a/webrtc/modules/rtp_rtcp/source/rtp_format_vp8_unittest.cc +++ b/webrtc/modules/rtp_rtcp/source/rtp_format_vp8_unittest.cc @@ -125,6 +125,32 @@ TEST_F(RtpPacketizerVp8Test, TestStrictMode) { kExpectedNum); } +// Verify that we get a minimal number of packets if the partition plus header +// size fits exactly in the maximum packet size. +// Test is disabled: https://code.google.com/p/webrtc/issues/detail?id=4019. +TEST_F(RtpPacketizerVp8Test, DISABLED_TestStrictEqualTightPartitions) { + const size_t kSizeVector[] = {10, 10, 10}; + const size_t kNumPartitions = GTEST_ARRAY_SIZE_(kSizeVector); + ASSERT_TRUE(Init(kSizeVector, kNumPartitions)); + + hdr_info_.pictureId = 200; // > 0x7F should produce 2-byte PictureID. + const int kMaxSize = 14; + RtpPacketizerVp8 packetizer(hdr_info_, kMaxSize, kStrict); + packetizer.SetPayloadData(helper_->payload_data(), helper_->payload_size(), + helper_->fragmentation()); + + // The expected sizes are obtained by running a verified good implementation. + const size_t kExpectedSizes[] = {14, 14, 14}; + const int kExpectedPart[] = {0, 1, 2}; + const bool kExpectedFragStart[] = {true, true, true}; + const size_t kExpectedNum = GTEST_ARRAY_SIZE_(kExpectedSizes); + CHECK_ARRAY_SIZE(kExpectedNum, kExpectedPart); + CHECK_ARRAY_SIZE(kExpectedNum, kExpectedFragStart); + + helper_->GetAllPacketsAndCheck(&packetizer, kExpectedSizes, kExpectedPart, + kExpectedFragStart, kExpectedNum); +} + TEST_F(RtpPacketizerVp8Test, TestAggregateMode) { const size_t kSizeVector[] = {60, 10, 10}; const size_t kNumPartitions = GTEST_ARRAY_SIZE_(kSizeVector);