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

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

Issue 1506103006: Prevent RTCP SR to be sent with bogus timestamp. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years 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) 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 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 EXPECT_EQ(0, sender_.impl_->SendRTCP(kRtcpReport)); 339 EXPECT_EQ(0, sender_.impl_->SendRTCP(kRtcpReport));
340 340
341 // Verify RTT. 341 // Verify RTT.
342 EXPECT_EQ(0, receiver_.rtt_stats_.LastProcessedRtt()); 342 EXPECT_EQ(0, receiver_.rtt_stats_.LastProcessedRtt());
343 EXPECT_EQ(0, receiver_.impl_->rtt_ms()); 343 EXPECT_EQ(0, receiver_.impl_->rtt_ms());
344 receiver_.impl_->Process(); 344 receiver_.impl_->Process();
345 EXPECT_EQ(2 * kOneWayNetworkDelayMs, receiver_.rtt_stats_.LastProcessedRtt()); 345 EXPECT_EQ(2 * kOneWayNetworkDelayMs, receiver_.rtt_stats_.LastProcessedRtt());
346 EXPECT_EQ(2 * kOneWayNetworkDelayMs, receiver_.impl_->rtt_ms()); 346 EXPECT_EQ(2 * kOneWayNetworkDelayMs, receiver_.impl_->rtt_ms());
347 } 347 }
348 348
349 TEST_F(RtpRtcpImplTest, NoSrBeforeMedia) {
stefan-webrtc 2015/12/10 08:05:40 Do you think there's anything else to test, such a
mflodman 2015/12/10 08:59:53 I added a test verifying the receive module still
350 sender_.impl_->Process();
351 EXPECT_EQ(-1, sender_.RtcpSent().first_packet_time_ms);
352 clock_.AdvanceTimeMilliseconds(2000);
353 int64_t current_time = clock_.TimeInMilliseconds();
354 sender_.impl_->Process();
355 EXPECT_EQ(-1, sender_.RtcpSent().first_packet_time_ms);
356 SendFrame(&sender_, kBaseLayerTid);
357 // sender_.impl_->Process();
mflodman 2015/12/10 06:08:20 Depending on the answer to the other comment, I'll
358 EXPECT_EQ(sender_.RtcpSent().first_packet_time_ms, current_time);
359 }
360
349 TEST_F(RtpRtcpImplTest, RtcpPacketTypeCounter_Nack) { 361 TEST_F(RtpRtcpImplTest, RtcpPacketTypeCounter_Nack) {
350 EXPECT_EQ(-1, receiver_.RtcpSent().first_packet_time_ms); 362 EXPECT_EQ(-1, receiver_.RtcpSent().first_packet_time_ms);
351 EXPECT_EQ(-1, sender_.RtcpReceived().first_packet_time_ms); 363 EXPECT_EQ(-1, sender_.RtcpReceived().first_packet_time_ms);
352 EXPECT_EQ(0U, sender_.RtcpReceived().nack_packets); 364 EXPECT_EQ(0U, sender_.RtcpReceived().nack_packets);
353 EXPECT_EQ(0U, receiver_.RtcpSent().nack_packets); 365 EXPECT_EQ(0U, receiver_.RtcpSent().nack_packets);
354 366
355 // Receive module sends a NACK. 367 // Receive module sends a NACK.
356 const uint16_t kNackLength = 1; 368 const uint16_t kNackLength = 1;
357 uint16_t nack_list[kNackLength] = {123}; 369 uint16_t nack_list[kNackLength] = {123};
358 EXPECT_EQ(0, receiver_.impl_->SendNACK(nack_list, kNackLength)); 370 EXPECT_EQ(0, receiver_.impl_->SendNACK(nack_list, kNackLength));
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 EXPECT_EQ(8U, receiver_.RtcpSent().nack_requests); 527 EXPECT_EQ(8U, receiver_.RtcpSent().nack_requests);
516 EXPECT_EQ(6U, receiver_.RtcpSent().unique_nack_requests); 528 EXPECT_EQ(6U, receiver_.RtcpSent().unique_nack_requests);
517 EXPECT_THAT(receiver_.LastNackListSent(), ElementsAre(11, 18, 20, 21)); 529 EXPECT_THAT(receiver_.LastNackListSent(), ElementsAre(11, 18, 20, 21));
518 530
519 // Send module receives the request. 531 // Send module receives the request.
520 EXPECT_EQ(2U, sender_.RtcpReceived().nack_packets); 532 EXPECT_EQ(2U, sender_.RtcpReceived().nack_packets);
521 EXPECT_EQ(8U, sender_.RtcpReceived().nack_requests); 533 EXPECT_EQ(8U, sender_.RtcpReceived().nack_requests);
522 EXPECT_EQ(6U, sender_.RtcpReceived().unique_nack_requests); 534 EXPECT_EQ(6U, sender_.RtcpReceived().unique_nack_requests);
523 EXPECT_EQ(75, sender_.RtcpReceived().UniqueNackRequestsInPercent()); 535 EXPECT_EQ(75, sender_.RtcpReceived().UniqueNackRequestsInPercent());
524 } 536 }
525
526 } // namespace webrtc 537 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698