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

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

Issue 1726573003: Fixed busy loop in case of partially malformed rtcp packet (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 10 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 | « no previous file | webrtc/modules/rtp_rtcp/source/rtcp_utility.cc » ('j') | 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) 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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 rtc::scoped_ptr<RemoteBitrateEstimator> remote_bitrate_estimator_; 150 rtc::scoped_ptr<RemoteBitrateEstimator> remote_bitrate_estimator_;
151 }; 151 };
152 152
153 153
154 TEST_F(RtcpReceiverTest, BrokenPacketIsIgnored) { 154 TEST_F(RtcpReceiverTest, BrokenPacketIsIgnored) {
155 const uint8_t bad_packet[] = {0, 0, 0, 0}; 155 const uint8_t bad_packet[] = {0, 0, 0, 0};
156 EXPECT_EQ(0, InjectRtcpPacket(bad_packet, sizeof(bad_packet))); 156 EXPECT_EQ(0, InjectRtcpPacket(bad_packet, sizeof(bad_packet)));
157 EXPECT_EQ(0U, rtcp_packet_info_.rtcpPacketTypeFlags); 157 EXPECT_EQ(0U, rtcp_packet_info_.rtcpPacketTypeFlags);
158 } 158 }
159 159
160 TEST_F(RtcpReceiverTest, InvalidFeedbackPacketIsIgnored) {
161 // Too short feedback packet.
162 const uint8_t bad_packet[] = {0x80, RTCPUtility::PT_RTPFB, 0, 0};
163 EXPECT_EQ(0, InjectRtcpPacket(bad_packet, sizeof(bad_packet)));
164 EXPECT_EQ(0U, rtcp_packet_info_.rtcpPacketTypeFlags);
165 }
166
160 TEST_F(RtcpReceiverTest, InjectSrPacket) { 167 TEST_F(RtcpReceiverTest, InjectSrPacket) {
161 const uint32_t kSenderSsrc = 0x10203; 168 const uint32_t kSenderSsrc = 0x10203;
162 rtcp::SenderReport sr; 169 rtcp::SenderReport sr;
163 sr.From(kSenderSsrc); 170 sr.From(kSenderSsrc);
164 rtc::Buffer packet = sr.Build(); 171 rtc::Buffer packet = sr.Build();
165 EXPECT_EQ(0, InjectRtcpPacket(packet.data(), packet.size())); 172 EXPECT_EQ(0, InjectRtcpPacket(packet.data(), packet.size()));
166 // The parser will note the remote SSRC on a SR from other than his 173 // The parser will note the remote SSRC on a SR from other than his
167 // expected peer, but will not flag that he's gotten a packet. 174 // expected peer, but will not flag that he's gotten a packet.
168 EXPECT_EQ(kSenderSsrc, rtcp_packet_info_.remoteSSRC); 175 EXPECT_EQ(kSenderSsrc, rtcp_packet_info_.remoteSSRC);
169 EXPECT_EQ(0U, kRtcpSr & rtcp_packet_info_.rtcpPacketTypeFlags); 176 EXPECT_EQ(0U, kRtcpSr & rtcp_packet_info_.rtcpPacketTypeFlags);
(...skipping 981 matching lines...) Expand 10 before | Expand all | Expand 10 after
1151 1158
1152 // Transport feedback should be ignored, but next packet should work. 1159 // Transport feedback should be ignored, but next packet should work.
1153 EXPECT_EQ(0u, rtcp_packet_info_.rtcpPacketTypeFlags & kRtcpTransportFeedback); 1160 EXPECT_EQ(0u, rtcp_packet_info_.rtcpPacketTypeFlags & kRtcpTransportFeedback);
1154 EXPECT_NE(0u, rtcp_packet_info_.rtcpPacketTypeFlags & kRtcpRemb); 1161 EXPECT_NE(0u, rtcp_packet_info_.rtcpPacketTypeFlags & kRtcpRemb);
1155 EXPECT_EQ(kBitrateBps, rtcp_packet_info_.receiverEstimatedMaxBitrate); 1162 EXPECT_EQ(kBitrateBps, rtcp_packet_info_.receiverEstimatedMaxBitrate);
1156 } 1163 }
1157 1164
1158 } // Anonymous namespace 1165 } // Anonymous namespace
1159 1166
1160 } // namespace webrtc 1167 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | webrtc/modules/rtp_rtcp/source/rtcp_utility.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698