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
This commit is contained in:
henrik.lundin@webrtc.org 2014-11-24 12:36:58 +00:00
parent dde19a6f60
commit aff1751c96

View File

@ -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);