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

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

Issue 1220863002: Fail RTP parsing on excessive padding length. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: move paddingLength to + side Created 5 years, 5 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 752 matching lines...) Expand 10 before | Expand all | Expand 10 after
763 const size_t kPaddingBytes = 100; 763 const size_t kPaddingBytes = 100;
764 const size_t kMaxPaddingLength = 224; // Value taken from rtp_sender.cc. 764 const size_t kMaxPaddingLength = 224; // Value taken from rtp_sender.cc.
765 // Padding will be forced to full packets. 765 // Padding will be forced to full packets.
766 EXPECT_EQ(kMaxPaddingLength, rtp_sender_->TimeToSendPadding(kPaddingBytes)); 766 EXPECT_EQ(kMaxPaddingLength, rtp_sender_->TimeToSendPadding(kPaddingBytes));
767 767
768 // Process send bucket. Padding should now be sent. 768 // Process send bucket. Padding should now be sent.
769 EXPECT_EQ(++total_packets_sent, transport_.packets_sent_); 769 EXPECT_EQ(++total_packets_sent, transport_.packets_sent_);
770 EXPECT_EQ(kMaxPaddingLength + rtp_header_len, 770 EXPECT_EQ(kMaxPaddingLength + rtp_header_len,
771 transport_.last_sent_packet_len_); 771 transport_.last_sent_packet_len_);
772 // Parse sent packet. 772 // Parse sent packet.
773 ASSERT_TRUE(rtp_parser->Parse(transport_.last_sent_packet_, kPaddingBytes, 773 ASSERT_TRUE(rtp_parser->Parse(transport_.last_sent_packet_,
774 transport_.last_sent_packet_len_,
774 &rtp_header)); 775 &rtp_header));
776 EXPECT_EQ(kMaxPaddingLength, rtp_header.paddingLength);
775 777
776 // Verify sequence number and timestamp. 778 // Verify sequence number and timestamp.
777 EXPECT_EQ(seq_num++, rtp_header.sequenceNumber); 779 EXPECT_EQ(seq_num++, rtp_header.sequenceNumber);
778 EXPECT_EQ(timestamp, rtp_header.timestamp); 780 EXPECT_EQ(timestamp, rtp_header.timestamp);
779 // Verify transmission time offset. 781 // Verify transmission time offset.
780 EXPECT_EQ(0, rtp_header.extension.transmissionTimeOffset); 782 EXPECT_EQ(0, rtp_header.extension.transmissionTimeOffset);
781 uint64_t expected_send_time = 783 uint64_t expected_send_time =
782 ConvertMsToAbsSendTime(fake_clock_.TimeInMilliseconds()); 784 ConvertMsToAbsSendTime(fake_clock_.TimeInMilliseconds());
783 EXPECT_EQ(expected_send_time, rtp_header.extension.absoluteSendTime); 785 EXPECT_EQ(expected_send_time, rtp_header.extension.absoluteSendTime);
784 fake_clock_.AdvanceTimeMilliseconds(kPaddingPeriodMs); 786 fake_clock_.AdvanceTimeMilliseconds(kPaddingPeriodMs);
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after
1366 reinterpret_cast<uint8_t*>(transport_.sent_packets_[0]->data()), 1368 reinterpret_cast<uint8_t*>(transport_.sent_packets_[0]->data()),
1367 transport_.sent_packets_[0]->size(), true, &map, kSeqNum, hdr.rotation); 1369 transport_.sent_packets_[0]->size(), true, &map, kSeqNum, hdr.rotation);
1368 1370
1369 // Verify that this packet does have CVO byte. 1371 // Verify that this packet does have CVO byte.
1370 VerifyCVOPacket( 1372 VerifyCVOPacket(
1371 reinterpret_cast<uint8_t*>(transport_.sent_packets_[1]->data()), 1373 reinterpret_cast<uint8_t*>(transport_.sent_packets_[1]->data()),
1372 transport_.sent_packets_[1]->size(), true, &map, kSeqNum + 1, 1374 transport_.sent_packets_[1]->size(), true, &map, kSeqNum + 1,
1373 hdr.rotation); 1375 hdr.rotation);
1374 } 1376 }
1375 } // namespace webrtc 1377 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtp_receiver_video.cc ('k') | webrtc/modules/rtp_rtcp/source/rtp_utility.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698