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

Side by Side Diff: webrtc/video/rampup_tests.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
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtp_utility.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 remote_bitrate_estimator_->IncomingPacket(clock_->TimeInMilliseconds(), 124 remote_bitrate_estimator_->IncomingPacket(clock_->TimeInMilliseconds(),
125 length - 12, header, true); 125 length - 12, header, true);
126 if (remote_bitrate_estimator_->TimeUntilNextProcess() <= 0) { 126 if (remote_bitrate_estimator_->TimeUntilNextProcess() <= 0) {
127 remote_bitrate_estimator_->Process(); 127 remote_bitrate_estimator_->Process();
128 } 128 }
129 total_sent_ += length; 129 total_sent_ += length;
130 padding_sent_ += header.paddingLength; 130 padding_sent_ += header.paddingLength;
131 ++total_packets_sent_; 131 ++total_packets_sent_;
132 if (header.paddingLength > 0) 132 if (header.paddingLength > 0)
133 ++padding_packets_sent_; 133 ++padding_packets_sent_;
134 if (rtx_media_ssrcs_.find(header.ssrc) != rtx_media_ssrcs_.end()) { 134 // Handle RTX retransmission, but only for non-padding-only packets.
135 if (rtx_media_ssrcs_.find(header.ssrc) != rtx_media_ssrcs_.end() &&
136 header.headerLength + header.paddingLength != length) {
135 rtx_media_sent_ += length - header.headerLength - header.paddingLength; 137 rtx_media_sent_ += length - header.headerLength - header.paddingLength;
136 if (header.paddingLength == 0) 138 if (header.paddingLength == 0)
137 ++rtx_media_packets_sent_; 139 ++rtx_media_packets_sent_;
138 uint8_t restored_packet[kMaxPacketSize]; 140 uint8_t restored_packet[kMaxPacketSize];
139 uint8_t* restored_packet_ptr = restored_packet; 141 uint8_t* restored_packet_ptr = restored_packet;
140 size_t restored_length = length; 142 size_t restored_length = length;
141 EXPECT_TRUE(payload_registry_->RestoreOriginalPacket( 143 EXPECT_TRUE(payload_registry_->RestoreOriginalPacket(
142 &restored_packet_ptr, packet, &restored_length, 144 &restored_packet_ptr, packet, &restored_length,
143 rtx_media_ssrcs_[header.ssrc], header)); 145 rtx_media_ssrcs_[header.ssrc], header));
144 length = restored_length; 146 EXPECT_TRUE(
145 EXPECT_TRUE(rtp_parser_->Parse( 147 rtp_parser_->Parse(restored_packet_ptr, restored_length, &header));
146 restored_packet, static_cast<int>(length), &header));
147 } else { 148 } else {
148 rtp_rtcp_->SetRemoteSSRC(header.ssrc); 149 rtp_rtcp_->SetRemoteSSRC(header.ssrc);
149 } 150 }
150 return true; 151 return true;
151 } 152 }
152 153
153 bool StreamObserver::SendRtcp(const uint8_t* packet, size_t length) { 154 bool StreamObserver::SendRtcp(const uint8_t* packet, size_t length) {
154 return true; 155 return true;
155 } 156 }
156 157
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 552
552 TEST_F(RampUpTest, AbsSendTimeSimulcastByRedWithRtx) { 553 TEST_F(RampUpTest, AbsSendTimeSimulcastByRedWithRtx) {
553 RunRampUpTest(3, 0, RtpExtension::kAbsSendTime, true, true); 554 RunRampUpTest(3, 0, RtpExtension::kAbsSendTime, true, true);
554 } 555 }
555 556
556 TEST_F(RampUpTest, AbsSendTimeSingleStreamWithHighStartBitrate) { 557 TEST_F(RampUpTest, AbsSendTimeSingleStreamWithHighStartBitrate) {
557 RunRampUpTest(1, 0.9 * kSingleStreamTargetBps, RtpExtension::kAbsSendTime, 558 RunRampUpTest(1, 0.9 * kSingleStreamTargetBps, RtpExtension::kAbsSendTime,
558 false, false); 559 false, false);
559 } 560 }
560 } // namespace webrtc 561 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtp_utility.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698