OLD | NEW |
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 Loading... |
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) { |
| 350 // Ignore fake transport delays in this test. |
| 351 sender_.transport_.SimulateNetworkDelay(0, &clock_); |
| 352 receiver_.transport_.SimulateNetworkDelay(0, &clock_); |
| 353 |
| 354 sender_.impl_->Process(); |
| 355 EXPECT_EQ(-1, sender_.RtcpSent().first_packet_time_ms); |
| 356 |
| 357 // Verify no SR is sent before media has been sent, RR should still be sent |
| 358 // from the receiving module though. |
| 359 clock_.AdvanceTimeMilliseconds(2000); |
| 360 int64_t current_time = clock_.TimeInMilliseconds(); |
| 361 sender_.impl_->Process(); |
| 362 receiver_.impl_->Process(); |
| 363 EXPECT_EQ(-1, sender_.RtcpSent().first_packet_time_ms); |
| 364 EXPECT_EQ(receiver_.RtcpSent().first_packet_time_ms, current_time); |
| 365 |
| 366 SendFrame(&sender_, kBaseLayerTid); |
| 367 EXPECT_EQ(sender_.RtcpSent().first_packet_time_ms, current_time); |
| 368 } |
| 369 |
349 TEST_F(RtpRtcpImplTest, RtcpPacketTypeCounter_Nack) { | 370 TEST_F(RtpRtcpImplTest, RtcpPacketTypeCounter_Nack) { |
350 EXPECT_EQ(-1, receiver_.RtcpSent().first_packet_time_ms); | 371 EXPECT_EQ(-1, receiver_.RtcpSent().first_packet_time_ms); |
351 EXPECT_EQ(-1, sender_.RtcpReceived().first_packet_time_ms); | 372 EXPECT_EQ(-1, sender_.RtcpReceived().first_packet_time_ms); |
352 EXPECT_EQ(0U, sender_.RtcpReceived().nack_packets); | 373 EXPECT_EQ(0U, sender_.RtcpReceived().nack_packets); |
353 EXPECT_EQ(0U, receiver_.RtcpSent().nack_packets); | 374 EXPECT_EQ(0U, receiver_.RtcpSent().nack_packets); |
354 | 375 |
355 // Receive module sends a NACK. | 376 // Receive module sends a NACK. |
356 const uint16_t kNackLength = 1; | 377 const uint16_t kNackLength = 1; |
357 uint16_t nack_list[kNackLength] = {123}; | 378 uint16_t nack_list[kNackLength] = {123}; |
358 EXPECT_EQ(0, receiver_.impl_->SendNACK(nack_list, kNackLength)); | 379 EXPECT_EQ(0, receiver_.impl_->SendNACK(nack_list, kNackLength)); |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
515 EXPECT_EQ(8U, receiver_.RtcpSent().nack_requests); | 536 EXPECT_EQ(8U, receiver_.RtcpSent().nack_requests); |
516 EXPECT_EQ(6U, receiver_.RtcpSent().unique_nack_requests); | 537 EXPECT_EQ(6U, receiver_.RtcpSent().unique_nack_requests); |
517 EXPECT_THAT(receiver_.LastNackListSent(), ElementsAre(11, 18, 20, 21)); | 538 EXPECT_THAT(receiver_.LastNackListSent(), ElementsAre(11, 18, 20, 21)); |
518 | 539 |
519 // Send module receives the request. | 540 // Send module receives the request. |
520 EXPECT_EQ(2U, sender_.RtcpReceived().nack_packets); | 541 EXPECT_EQ(2U, sender_.RtcpReceived().nack_packets); |
521 EXPECT_EQ(8U, sender_.RtcpReceived().nack_requests); | 542 EXPECT_EQ(8U, sender_.RtcpReceived().nack_requests); |
522 EXPECT_EQ(6U, sender_.RtcpReceived().unique_nack_requests); | 543 EXPECT_EQ(6U, sender_.RtcpReceived().unique_nack_requests); |
523 EXPECT_EQ(75, sender_.RtcpReceived().UniqueNackRequestsInPercent()); | 544 EXPECT_EQ(75, sender_.RtcpReceived().UniqueNackRequestsInPercent()); |
524 } | 545 } |
525 | |
526 } // namespace webrtc | 546 } // namespace webrtc |
OLD | NEW |