diff --git a/src/modules/rtp_rtcp/source/rtp_format_vp8.cc b/src/modules/rtp_rtcp/source/rtp_format_vp8.cc index 5f5153d24..0654a1678 100644 --- a/src/modules/rtp_rtcp/source/rtp_format_vp8.cc +++ b/src/modules/rtp_rtcp/source/rtp_format_vp8.cc @@ -28,6 +28,7 @@ const bool RtpFormatVp8::separate_first_modes_[kNumModes] = RtpFormatVp8::RtpFormatVp8(const WebRtc_UWord8* payload_data, WebRtc_UWord32 payload_size, const RTPVideoHeaderVP8& hdr_info, + int max_payload_len, const RTPFragmentationHeader& fragmentation, VP8PacketizerMode mode) : payload_data_(payload_data), @@ -41,13 +42,15 @@ RtpFormatVp8::RtpFormatVp8(const WebRtc_UWord8* payload_data, balance_(balance_modes_[mode]), separate_first_(separate_first_modes_[mode]), hdr_info_(hdr_info), - first_partition_in_packet_(0) { + first_partition_in_packet_(0), + max_payload_len_(max_payload_len) { part_info_ = fragmentation; } RtpFormatVp8::RtpFormatVp8(const WebRtc_UWord8* payload_data, WebRtc_UWord32 payload_size, - const RTPVideoHeaderVP8& hdr_info) + const RTPVideoHeaderVP8& hdr_info, + int max_payload_len) : payload_data_(payload_data), payload_size_(static_cast(payload_size)), part_info_(), @@ -60,7 +63,8 @@ RtpFormatVp8::RtpFormatVp8(const WebRtc_UWord8* payload_data, balance_(balance_modes_[kSloppy]), separate_first_(separate_first_modes_[kSloppy]), hdr_info_(hdr_info), - first_partition_in_packet_(0) { + first_partition_in_packet_(0), + max_payload_len_(max_payload_len) { part_info_.VerifyAndAllocateFragmentationHeader(1); part_info_.fragmentationLength[0] = payload_size; part_info_.fragmentationOffset[0] = 0; @@ -89,9 +93,10 @@ int RtpFormatVp8::CalcNextSize(int max_payload_len, int remaining_bytes, } } -int RtpFormatVp8::NextPacket(int max_payload_len, WebRtc_UWord8* buffer, - int* bytes_to_send, bool* last_packet) { - if (max_payload_len < vp8_fixed_payload_descriptor_bytes_ +int RtpFormatVp8::NextPacket(WebRtc_UWord8* buffer, + int* bytes_to_send, + bool* last_packet) { + if (max_payload_len_ < vp8_fixed_payload_descriptor_bytes_ + PayloadDescriptorExtraLength() + 1) { // The provided payload length is not long enough for the payload // descriptor and one payload byte. Return an error. @@ -103,7 +108,7 @@ int RtpFormatVp8::NextPacket(int max_payload_len, WebRtc_UWord8* buffer, int remaining_in_partition = part_info_.fragmentationOffset[part_ix_] - payload_bytes_sent_ + part_info_.fragmentationLength[part_ix_] + PayloadDescriptorExtraLength(); - int rem_payload_len = max_payload_len - vp8_fixed_payload_descriptor_bytes_; + int rem_payload_len = max_payload_len_ - vp8_fixed_payload_descriptor_bytes_; first_partition_in_packet_ = part_ix_; if (first_partition_in_packet_ > 8) return -1; @@ -139,7 +144,7 @@ int RtpFormatVp8::NextPacket(int max_payload_len, WebRtc_UWord8* buffer, send_bytes -= PayloadDescriptorExtraLength(); // Remove extra length again. assert(send_bytes > 0); // Write the payload header and the payload to buffer. - *bytes_to_send = WriteHeaderAndPayload(send_bytes, buffer, max_payload_len); + *bytes_to_send = WriteHeaderAndPayload(send_bytes, buffer, max_payload_len_); if (*bytes_to_send < 0) { return -1; } diff --git a/src/modules/rtp_rtcp/source/rtp_format_vp8.h b/src/modules/rtp_rtcp/source/rtp_format_vp8.h index cd0bc7c8c..f736307b1 100644 --- a/src/modules/rtp_rtcp/source/rtp_format_vp8.h +++ b/src/modules/rtp_rtcp/source/rtp_format_vp8.h @@ -46,6 +46,7 @@ class RtpFormatVp8 { RtpFormatVp8(const WebRtc_UWord8* payload_data, WebRtc_UWord32 payload_size, const RTPVideoHeaderVP8& hdr_info, + int max_payload_len, const RTPFragmentationHeader& fragmentation, VP8PacketizerMode mode); @@ -53,7 +54,8 @@ class RtpFormatVp8 { // The payload_data must be exactly one encoded VP8 frame. RtpFormatVp8(const WebRtc_UWord8* payload_data, WebRtc_UWord32 payload_size, - const RTPVideoHeaderVP8& hdr_info); + const RTPVideoHeaderVP8& hdr_info, + int max_payload_len); // Get the next payload with VP8 payload header. // max_payload_len limits the sum length of payload and VP8 payload header. @@ -64,8 +66,9 @@ class RtpFormatVp8 { // next packet). Returns the partition index from which the first payload // byte in the packet is taken, with the first partition having index 0; // returns negative on error. - int NextPacket(int max_payload_len, WebRtc_UWord8* buffer, - int* bytes_to_send, bool* last_packet); + int NextPacket(WebRtc_UWord8* buffer, + int* bytes_to_send, + bool* last_packet); private: enum AggregationMode { @@ -155,6 +158,7 @@ class RtpFormatVp8 { bool separate_first_; const RTPVideoHeaderVP8 hdr_info_; int first_partition_in_packet_; + int max_payload_len_; }; } // namespace diff --git a/src/modules/rtp_rtcp/source/rtp_format_vp8_test_helper.cc b/src/modules/rtp_rtcp/source/rtp_format_vp8_test_helper.cc index 4c9e38638..35d9109ec 100644 --- a/src/modules/rtp_rtcp/source/rtp_format_vp8_test_helper.cc +++ b/src/modules/rtp_rtcp/source/rtp_format_vp8_test_helper.cc @@ -64,7 +64,6 @@ void RtpFormatVp8TestHelper::GetAllPacketsAndCheck( const int* expected_sizes, const int* expected_part, const bool* expected_frag_start, - const int* max_size, int expected_num_packets) { ASSERT_TRUE(inited_); int send_bytes = 0; @@ -74,10 +73,11 @@ void RtpFormatVp8TestHelper::GetAllPacketsAndCheck( ss << "Checking packet " << i; SCOPED_TRACE(ss.str()); EXPECT_EQ(expected_part[i], - packetizer->NextPacket(max_size[i], buffer_, &send_bytes, &last)); + packetizer->NextPacket(buffer_, &send_bytes, &last)); CheckPacket(send_bytes, expected_sizes[i], last, expected_frag_start[i]); } + EXPECT_TRUE(last); } // Payload descriptor @@ -237,7 +237,7 @@ void RtpFormatVp8TestHelper::CheckPacket(int send_bytes, int expect_bytes, bool last, bool frag_start) { - EXPECT_EQ(send_bytes, expect_bytes); + EXPECT_EQ(expect_bytes, send_bytes); CheckHeader(frag_start); CheckPayload(send_bytes); CheckLast(last); diff --git a/src/modules/rtp_rtcp/source/rtp_format_vp8_test_helper.h b/src/modules/rtp_rtcp/source/rtp_format_vp8_test_helper.h index 8e8fad1d2..f9bf686a6 100644 --- a/src/modules/rtp_rtcp/source/rtp_format_vp8_test_helper.h +++ b/src/modules/rtp_rtcp/source/rtp_format_vp8_test_helper.h @@ -36,7 +36,6 @@ class RtpFormatVp8TestHelper { const int* expected_sizes, const int* expected_part, const bool* expected_frag_start, - const int* max_size, int expected_num_packets); uint8_t* payload_data() const { return payload_data_; } diff --git a/src/modules/rtp_rtcp/source/rtp_format_vp8_unittest.cc b/src/modules/rtp_rtcp/source/rtp_format_vp8_unittest.cc index f2c028c5d..11060e0d5 100644 --- a/src/modules/rtp_rtcp/source/rtp_format_vp8_unittest.cc +++ b/src/modules/rtp_rtcp/source/rtp_format_vp8_unittest.cc @@ -33,11 +33,6 @@ class RtpFormatVp8Test : public ::testing::Test { protected: RtpFormatVp8Test() : helper_(NULL) {} virtual void TearDown() { delete helper_; } - bool Init() { - const int kSizeVector[] = {10, 10, 10}; - const int kNumPartitions = sizeof(kSizeVector) / sizeof(kSizeVector[0]); - return Init(kSizeVector, kNumPartitions); - } bool Init(const int* partition_sizes, int num_partitions) { hdr_info_.pictureId = kNoPictureId; hdr_info_.nonReference = false; @@ -55,21 +50,24 @@ class RtpFormatVp8Test : public ::testing::Test { }; TEST_F(RtpFormatVp8Test, TestStrictMode) { - ASSERT_TRUE(Init()); + const int kSizeVector[] = {10, 8, 27}; + const int kNumPartitions = sizeof(kSizeVector) / sizeof(kSizeVector[0]); + ASSERT_TRUE(Init(kSizeVector, kNumPartitions)); hdr_info_.pictureId = 200; // > 0x7F should produce 2-byte PictureID. + const int kMaxSize = 13; RtpFormatVp8 packetizer = RtpFormatVp8(helper_->payload_data(), helper_->payload_size(), hdr_info_, + kMaxSize, *(helper_->fragmentation()), kStrict); // The expected sizes are obtained by running a verified good implementation. - const int kExpectedSizes[] = {8, 10, 14, 5, 5, 7, 5}; + const int kExpectedSizes[] = {8, 10, 12, 11, 13, 8, 11}; const int kExpectedPart[] = {0, 0, 1, 2, 2, 2, 2}; const bool kExpectedFragStart[] = {true, false, true, true, false, false, false}; - const int kMaxSize[] = {13, 13, 20, 7, 7, 7, 7}; const int kExpectedNum = sizeof(kExpectedSizes) / sizeof(kExpectedSizes[0]); COMPILE_ASSERT(kExpectedNum == sizeof(kExpectedPart) / sizeof(kExpectedPart[0]), @@ -77,28 +75,29 @@ TEST_F(RtpFormatVp8Test, TestStrictMode) { COMPILE_ASSERT(kExpectedNum == sizeof(kExpectedFragStart) / sizeof(kExpectedFragStart[0]), kExpectedFragStart_wrong_size); - COMPILE_ASSERT(kExpectedNum == sizeof(kMaxSize) / sizeof(kMaxSize[0]), - kMaxSize_wrong_size); helper_->GetAllPacketsAndCheck(&packetizer, kExpectedSizes, kExpectedPart, - kExpectedFragStart, kMaxSize, kExpectedNum); + kExpectedFragStart, kExpectedNum); } TEST_F(RtpFormatVp8Test, TestAggregateMode) { - ASSERT_TRUE(Init()); + const int kSizeVector[] = {60, 10, 10}; + const int kNumPartitions = sizeof(kSizeVector) / sizeof(kSizeVector[0]); + ASSERT_TRUE(Init(kSizeVector, kNumPartitions)); hdr_info_.pictureId = 20; // <= 0x7F should produce 1-byte PictureID. + const int kMaxSize = 25; RtpFormatVp8 packetizer = RtpFormatVp8(helper_->payload_data(), helper_->payload_size(), hdr_info_, + kMaxSize, *(helper_->fragmentation()), kAggregate); // The expected sizes are obtained by running a verified good implementation. - const int kExpectedSizes[] = {7, 5, 7, 23}; + const int kExpectedSizes[] = {22, 23, 24, 23}; const int kExpectedPart[] = {0, 0, 0, 1}; const bool kExpectedFragStart[] = {true, false, false, true}; - const int kMaxSize[] = {8, 8, 8, 25}; const int kExpectedNum = sizeof(kExpectedSizes) / sizeof(kExpectedSizes[0]); COMPILE_ASSERT(kExpectedNum == sizeof(kExpectedPart) / sizeof(kExpectedPart[0]), @@ -106,20 +105,22 @@ TEST_F(RtpFormatVp8Test, TestAggregateMode) { COMPILE_ASSERT(kExpectedNum == sizeof(kExpectedFragStart) / sizeof(kExpectedFragStart[0]), kExpectedFragStart_wrong_size); - COMPILE_ASSERT(kExpectedNum == sizeof(kMaxSize) / sizeof(kMaxSize[0]), - kMaxSize_wrong_size); helper_->GetAllPacketsAndCheck(&packetizer, kExpectedSizes, kExpectedPart, - kExpectedFragStart, kMaxSize, kExpectedNum); + kExpectedFragStart, kExpectedNum); } TEST_F(RtpFormatVp8Test, TestSloppyMode) { - ASSERT_TRUE(Init()); + const int kSizeVector[] = {10, 10, 10}; + const int kNumPartitions = sizeof(kSizeVector) / sizeof(kSizeVector[0]); + ASSERT_TRUE(Init(kSizeVector, kNumPartitions)); hdr_info_.pictureId = kNoPictureId; // No PictureID. + const int kMaxSize = 9; RtpFormatVp8 packetizer = RtpFormatVp8(helper_->payload_data(), helper_->payload_size(), hdr_info_, + kMaxSize, *(helper_->fragmentation()), kSloppy); @@ -127,7 +128,6 @@ TEST_F(RtpFormatVp8Test, TestSloppyMode) { const int kExpectedSizes[] = {9, 9, 9, 7}; const int kExpectedPart[] = {0, 0, 1, 2}; const bool kExpectedFragStart[] = {true, false, false, false}; - const int kMaxSize[] = {9, 9, 9, 9}; const int kExpectedNum = sizeof(kExpectedSizes) / sizeof(kExpectedSizes[0]); COMPILE_ASSERT(kExpectedNum == sizeof(kExpectedPart) / sizeof(kExpectedPart[0]), @@ -135,28 +135,29 @@ TEST_F(RtpFormatVp8Test, TestSloppyMode) { COMPILE_ASSERT(kExpectedNum == sizeof(kExpectedFragStart) / sizeof(kExpectedFragStart[0]), kExpectedFragStart_wrong_size); - COMPILE_ASSERT(kExpectedNum == sizeof(kMaxSize) / sizeof(kMaxSize[0]), - kMaxSize_wrong_size); helper_->GetAllPacketsAndCheck(&packetizer, kExpectedSizes, kExpectedPart, - kExpectedFragStart, kMaxSize, kExpectedNum); + kExpectedFragStart, kExpectedNum); } // Verify that sloppy mode is forced if fragmentation info is missing. TEST_F(RtpFormatVp8Test, TestSloppyModeFallback) { - ASSERT_TRUE(Init()); + const int kSizeVector[] = {10, 10, 10}; + const int kNumPartitions = sizeof(kSizeVector) / sizeof(kSizeVector[0]); + ASSERT_TRUE(Init(kSizeVector, kNumPartitions)); hdr_info_.pictureId = 200; // > 0x7F should produce 2-byte PictureID + const int kMaxSize = 12; // Small enough to produce 4 packets. RtpFormatVp8 packetizer = RtpFormatVp8(helper_->payload_data(), helper_->payload_size(), - hdr_info_); + hdr_info_, + kMaxSize); // Expecting three full packets, and one with the remainder. - const int kExpectedSizes[] = {10, 10, 10, 7}; + const int kExpectedSizes[] = {12, 12, 12, 10}; const int kExpectedPart[] = {0, 0, 0, 0}; // Always 0 for sloppy mode. // Frag start only true for first packet in sloppy mode. const bool kExpectedFragStart[] = {true, false, false, false}; - const int kMaxSize[] = {10, 10, 10, 7}; // Small enough to produce 4 packets. const int kExpectedNum = sizeof(kExpectedSizes) / sizeof(kExpectedSizes[0]); COMPILE_ASSERT(kExpectedNum == sizeof(kExpectedPart) / sizeof(kExpectedPart[0]), @@ -164,29 +165,30 @@ TEST_F(RtpFormatVp8Test, TestSloppyModeFallback) { COMPILE_ASSERT(kExpectedNum == sizeof(kExpectedFragStart) / sizeof(kExpectedFragStart[0]), kExpectedFragStart_wrong_size); - COMPILE_ASSERT(kExpectedNum == sizeof(kMaxSize) / sizeof(kMaxSize[0]), - kMaxSize_wrong_size); helper_->set_sloppy_partitioning(true); helper_->GetAllPacketsAndCheck(&packetizer, kExpectedSizes, kExpectedPart, - kExpectedFragStart, kMaxSize, kExpectedNum); + kExpectedFragStart, kExpectedNum); } // Verify that non-reference bit is set. Sloppy mode fallback is expected. TEST_F(RtpFormatVp8Test, TestNonReferenceBit) { - ASSERT_TRUE(Init()); + const int kSizeVector[] = {10, 10, 10}; + const int kNumPartitions = sizeof(kSizeVector) / sizeof(kSizeVector[0]); + ASSERT_TRUE(Init(kSizeVector, kNumPartitions)); hdr_info_.nonReference = true; + const int kMaxSize = 25; // Small enough to produce two packets. RtpFormatVp8 packetizer = RtpFormatVp8(helper_->payload_data(), helper_->payload_size(), - hdr_info_); + hdr_info_, + kMaxSize); // Sloppy mode => First packet full; other not. const int kExpectedSizes[] = {25, 7}; const int kExpectedPart[] = {0, 0}; // Always 0 for sloppy mode. // Frag start only true for first packet in sloppy mode. const bool kExpectedFragStart[] = {true, false}; - const int kMaxSize[] = {25, 25}; // Small enough to produce two packets. const int kExpectedNum = sizeof(kExpectedSizes) / sizeof(kExpectedSizes[0]); COMPILE_ASSERT(kExpectedNum == sizeof(kExpectedPart) / sizeof(kExpectedPart[0]), @@ -194,24 +196,27 @@ TEST_F(RtpFormatVp8Test, TestNonReferenceBit) { COMPILE_ASSERT(kExpectedNum == sizeof(kExpectedFragStart) / sizeof(kExpectedFragStart[0]), kExpectedFragStart_wrong_size); - COMPILE_ASSERT(kExpectedNum == sizeof(kMaxSize) / sizeof(kMaxSize[0]), - kMaxSize_wrong_size); helper_->set_sloppy_partitioning(true); helper_->GetAllPacketsAndCheck(&packetizer, kExpectedSizes, kExpectedPart, - kExpectedFragStart, kMaxSize, kExpectedNum); + kExpectedFragStart, kExpectedNum); } // Verify Tl0PicIdx and TID fields, and layerSync bit. TEST_F(RtpFormatVp8Test, TestTl0PicIdxAndTID) { - ASSERT_TRUE(Init()); + const int kSizeVector[] = {10, 10, 10}; + const int kNumPartitions = sizeof(kSizeVector) / sizeof(kSizeVector[0]); + ASSERT_TRUE(Init(kSizeVector, kNumPartitions)); hdr_info_.tl0PicIdx = 117; hdr_info_.temporalIdx = 2; hdr_info_.layerSync = true; + // kMaxSize is only limited by allocated buffer size. + const int kMaxSize = helper_->buffer_size(); RtpFormatVp8 packetizer = RtpFormatVp8(helper_->payload_data(), helper_->payload_size(), hdr_info_, + kMaxSize, *(helper_->fragmentation()), kAggregate); @@ -219,8 +224,6 @@ TEST_F(RtpFormatVp8Test, TestTl0PicIdxAndTID) { const int kExpectedSizes[1] = {helper_->payload_size() + 4}; const int kExpectedPart[1] = {0}; // Packet starts with partition 0. const bool kExpectedFragStart[1] = {true}; - // kMaxSize is only limited by allocated buffer size. - const int kMaxSize[1] = {helper_->buffer_size()}; const int kExpectedNum = sizeof(kExpectedSizes) / sizeof(kExpectedSizes[0]); COMPILE_ASSERT(kExpectedNum == sizeof(kExpectedPart) / sizeof(kExpectedPart[0]), @@ -228,21 +231,24 @@ TEST_F(RtpFormatVp8Test, TestTl0PicIdxAndTID) { COMPILE_ASSERT(kExpectedNum == sizeof(kExpectedFragStart) / sizeof(kExpectedFragStart[0]), kExpectedFragStart_wrong_size); - COMPILE_ASSERT(kExpectedNum == sizeof(kMaxSize) / sizeof(kMaxSize[0]), - kMaxSize_wrong_size); helper_->GetAllPacketsAndCheck(&packetizer, kExpectedSizes, kExpectedPart, - kExpectedFragStart, kMaxSize, kExpectedNum); + kExpectedFragStart, kExpectedNum); } // Verify KeyIdx field. TEST_F(RtpFormatVp8Test, TestKeyIdx) { - ASSERT_TRUE(Init()); + const int kSizeVector[] = {10, 10, 10}; + const int kNumPartitions = sizeof(kSizeVector) / sizeof(kSizeVector[0]); + ASSERT_TRUE(Init(kSizeVector, kNumPartitions)); hdr_info_.keyIdx = 17; + // kMaxSize is only limited by allocated buffer size. + const int kMaxSize = helper_->buffer_size(); RtpFormatVp8 packetizer = RtpFormatVp8(helper_->payload_data(), helper_->payload_size(), hdr_info_, + kMaxSize, *(helper_->fragmentation()), kAggregate); @@ -250,8 +256,6 @@ TEST_F(RtpFormatVp8Test, TestKeyIdx) { const int kExpectedSizes[1] = {helper_->payload_size() + 3}; const int kExpectedPart[1] = {0}; // Packet starts with partition 0. const bool kExpectedFragStart[1] = {true}; - // kMaxSize is only limited by allocated buffer size. - const int kMaxSize[1] = {helper_->buffer_size()}; const int kExpectedNum = sizeof(kExpectedSizes) / sizeof(kExpectedSizes[0]); COMPILE_ASSERT(kExpectedNum == sizeof(kExpectedPart) / sizeof(kExpectedPart[0]), @@ -259,22 +263,25 @@ TEST_F(RtpFormatVp8Test, TestKeyIdx) { COMPILE_ASSERT(kExpectedNum == sizeof(kExpectedFragStart) / sizeof(kExpectedFragStart[0]), kExpectedFragStart_wrong_size); - COMPILE_ASSERT(kExpectedNum == sizeof(kMaxSize) / sizeof(kMaxSize[0]), - kMaxSize_wrong_size); helper_->GetAllPacketsAndCheck(&packetizer, kExpectedSizes, kExpectedPart, - kExpectedFragStart, kMaxSize, kExpectedNum); + kExpectedFragStart, kExpectedNum); } // Verify TID field and KeyIdx field in combination. TEST_F(RtpFormatVp8Test, TestTIDAndKeyIdx) { - ASSERT_TRUE(Init()); + const int kSizeVector[] = {10, 10, 10}; + const int kNumPartitions = sizeof(kSizeVector) / sizeof(kSizeVector[0]); + ASSERT_TRUE(Init(kSizeVector, kNumPartitions)); hdr_info_.temporalIdx = 1; hdr_info_.keyIdx = 5; + // kMaxSize is only limited by allocated buffer size. + const int kMaxSize = helper_->buffer_size(); RtpFormatVp8 packetizer = RtpFormatVp8(helper_->payload_data(), helper_->payload_size(), hdr_info_, + kMaxSize, *(helper_->fragmentation()), kAggregate); @@ -282,8 +289,6 @@ TEST_F(RtpFormatVp8Test, TestTIDAndKeyIdx) { const int kExpectedSizes[1] = {helper_->payload_size() + 3}; const int kExpectedPart[1] = {0}; // Packet starts with partition 0. const bool kExpectedFragStart[1] = {true}; - // kMaxSize is only limited by allocated buffer size. - const int kMaxSize[1] = {helper_->buffer_size()}; const int kExpectedNum = sizeof(kExpectedSizes) / sizeof(kExpectedSizes[0]); COMPILE_ASSERT(kExpectedNum == sizeof(kExpectedPart) / sizeof(kExpectedPart[0]), @@ -291,11 +296,9 @@ TEST_F(RtpFormatVp8Test, TestTIDAndKeyIdx) { COMPILE_ASSERT(kExpectedNum == sizeof(kExpectedFragStart) / sizeof(kExpectedFragStart[0]), kExpectedFragStart_wrong_size); - COMPILE_ASSERT(kExpectedNum == sizeof(kMaxSize) / sizeof(kMaxSize[0]), - kMaxSize_wrong_size); helper_->GetAllPacketsAndCheck(&packetizer, kExpectedSizes, kExpectedPart, - kExpectedFragStart, kMaxSize, kExpectedNum); + kExpectedFragStart, kExpectedNum); } } // namespace diff --git a/src/modules/rtp_rtcp/source/rtp_sender_video.cc b/src/modules/rtp_rtcp/source/rtp_sender_video.cc index c675e0a2f..8d43e9fb2 100644 --- a/src/modules/rtp_rtcp/source/rtp_sender_video.cc +++ b/src/modules/rtp_rtcp/source/rtp_sender_video.cc @@ -1279,7 +1279,7 @@ RTPSenderVideo::SendVP8(const FrameType frameType, assert(rtpTypeHdr); RtpFormatVp8 packetizer(data, payloadBytesToSend, rtpTypeHdr->VP8, - *fragmentation, kAggregate); + maxPayloadLengthVP8, *fragmentation, kAggregate); bool last = false; _numberFirstPartition = 0; @@ -1289,8 +1289,7 @@ RTPSenderVideo::SendVP8(const FrameType frameType, WebRtc_UWord8 dataBuffer[IP_PACKET_SIZE] = {0}; int payloadBytesInPacket = 0; int packetStartPartition = - packetizer.NextPacket(maxPayloadLengthVP8, - &dataBuffer[rtpHeaderLength], + packetizer.NextPacket(&dataBuffer[rtpHeaderLength], &payloadBytesInPacket, &last); if (packetStartPartition == 0) { diff --git a/src/modules/rtp_rtcp/source/rtp_utility_test.cc b/src/modules/rtp_rtcp/source/rtp_utility_test.cc index 41cdae741..5446dbb0e 100644 --- a/src/modules/rtp_rtcp/source/rtp_utility_test.cc +++ b/src/modules/rtp_rtcp/source/rtp_utility_test.cc @@ -252,10 +252,10 @@ TEST(ParseVP8Test, TestWithPacketizer) { inputHeader.layerSync = false; inputHeader.tl0PicIdx = kNoTl0PicIdx; // Disable. inputHeader.keyIdx = 31; - RtpFormatVp8 packetizer = RtpFormatVp8(payload, 10, inputHeader); + RtpFormatVp8 packetizer = RtpFormatVp8(payload, 10, inputHeader, 20); bool last; int send_bytes; - ASSERT_EQ(0, packetizer.NextPacket(20, packet, &send_bytes, &last)); + ASSERT_EQ(0, packetizer.NextPacket(packet, &send_bytes, &last)); ASSERT_TRUE(last); RTPPayloadParser rtpPayloadParser(kRtpVp8Video, packet, send_bytes, 0);