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

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

Issue 1165113002: Add support for fragmentation in RtcpPacket. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Fixed nit, plus buffer overflow in nack test Created 5 years, 6 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/rtcp_receiver_unittest.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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 211
212 void IncomingRtcpNack(const RtpRtcpModule* module, uint16_t sequence_number) { 212 void IncomingRtcpNack(const RtpRtcpModule* module, uint16_t sequence_number) {
213 bool sender = module->impl_->SSRC() == kSenderSsrc; 213 bool sender = module->impl_->SSRC() == kSenderSsrc;
214 rtcp::Nack nack; 214 rtcp::Nack nack;
215 uint16_t list[1]; 215 uint16_t list[1];
216 list[0] = sequence_number; 216 list[0] = sequence_number;
217 const uint16_t kListLength = sizeof(list) / sizeof(list[0]); 217 const uint16_t kListLength = sizeof(list) / sizeof(list[0]);
218 nack.From(sender ? kReceiverSsrc : kSenderSsrc); 218 nack.From(sender ? kReceiverSsrc : kSenderSsrc);
219 nack.To(sender ? kSenderSsrc : kReceiverSsrc); 219 nack.To(sender ? kSenderSsrc : kReceiverSsrc);
220 nack.WithList(list, kListLength); 220 nack.WithList(list, kListLength);
221 rtcp::RawPacket packet = nack.Build(); 221 rtc::scoped_ptr<rtcp::RawPacket> packet(nack.Build());
222 EXPECT_EQ(0, module->impl_->IncomingRtcpPacket(packet.buffer(), 222 EXPECT_EQ(0, module->impl_->IncomingRtcpPacket(packet->Buffer(),
223 packet.buffer_length())); 223 packet->Length()));
224 } 224 }
225 }; 225 };
226 226
227 TEST_F(RtpRtcpImplTest, SetSelectiveRetransmissions_BaseLayer) { 227 TEST_F(RtpRtcpImplTest, SetSelectiveRetransmissions_BaseLayer) {
228 sender_.impl_->SetSelectiveRetransmissions(kRetransmitBaseLayer); 228 sender_.impl_->SetSelectiveRetransmissions(kRetransmitBaseLayer);
229 EXPECT_EQ(kRetransmitBaseLayer, sender_.impl_->SelectiveRetransmissions()); 229 EXPECT_EQ(kRetransmitBaseLayer, sender_.impl_->SelectiveRetransmissions());
230 230
231 // Send frames. 231 // Send frames.
232 EXPECT_EQ(0, sender_.RtpSent()); 232 EXPECT_EQ(0, sender_.RtpSent());
233 SendFrame(&sender_, kBaseLayerTid); // kSequenceNumber 233 SendFrame(&sender_, kBaseLayerTid); // kSequenceNumber
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 EXPECT_THAT(receiver_.LastNackListSent(), ElementsAre(11, 18, 20, 21)); 516 EXPECT_THAT(receiver_.LastNackListSent(), ElementsAre(11, 18, 20, 21));
517 517
518 // Send module receives the request. 518 // Send module receives the request.
519 EXPECT_EQ(2U, sender_.RtcpReceived().nack_packets); 519 EXPECT_EQ(2U, sender_.RtcpReceived().nack_packets);
520 EXPECT_EQ(8U, sender_.RtcpReceived().nack_requests); 520 EXPECT_EQ(8U, sender_.RtcpReceived().nack_requests);
521 EXPECT_EQ(6U, sender_.RtcpReceived().unique_nack_requests); 521 EXPECT_EQ(6U, sender_.RtcpReceived().unique_nack_requests);
522 EXPECT_EQ(75, sender_.RtcpReceived().UniqueNackRequestsInPercent()); 522 EXPECT_EQ(75, sender_.RtcpReceived().UniqueNackRequestsInPercent());
523 } 523 }
524 524
525 } // namespace webrtc 525 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtcp_receiver_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698