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 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 clock_.AdvanceTimeMilliseconds(1000); | 302 clock_.AdvanceTimeMilliseconds(1000); |
303 EXPECT_EQ(0, receiver_.impl_->SendRTCP(kRtcpReport)); | 303 EXPECT_EQ(0, receiver_.impl_->SendRTCP(kRtcpReport)); |
304 | 304 |
305 // Verify RTT. | 305 // Verify RTT. |
306 int64_t rtt; | 306 int64_t rtt; |
307 int64_t avg_rtt; | 307 int64_t avg_rtt; |
308 int64_t min_rtt; | 308 int64_t min_rtt; |
309 int64_t max_rtt; | 309 int64_t max_rtt; |
310 EXPECT_EQ(0, | 310 EXPECT_EQ(0, |
311 sender_.impl_->RTT(kReceiverSsrc, &rtt, &avg_rtt, &min_rtt, &max_rtt)); | 311 sender_.impl_->RTT(kReceiverSsrc, &rtt, &avg_rtt, &min_rtt, &max_rtt)); |
312 EXPECT_EQ(2 * kOneWayNetworkDelayMs, rtt); | 312 EXPECT_NEAR(2 * kOneWayNetworkDelayMs, rtt, 1); |
313 EXPECT_EQ(2 * kOneWayNetworkDelayMs, avg_rtt); | 313 EXPECT_NEAR(2 * kOneWayNetworkDelayMs, avg_rtt, 1); |
314 EXPECT_EQ(2 * kOneWayNetworkDelayMs, min_rtt); | 314 EXPECT_NEAR(2 * kOneWayNetworkDelayMs, min_rtt, 1); |
315 EXPECT_EQ(2 * kOneWayNetworkDelayMs, max_rtt); | 315 EXPECT_NEAR(2 * kOneWayNetworkDelayMs, max_rtt, 1); |
316 | 316 |
317 // No RTT from other ssrc. | 317 // No RTT from other ssrc. |
318 EXPECT_EQ(-1, | 318 EXPECT_EQ(-1, |
319 sender_.impl_->RTT(kReceiverSsrc+1, &rtt, &avg_rtt, &min_rtt, &max_rtt)); | 319 sender_.impl_->RTT(kReceiverSsrc+1, &rtt, &avg_rtt, &min_rtt, &max_rtt)); |
320 | 320 |
321 // Verify RTT from rtt_stats config. | 321 // Verify RTT from rtt_stats config. |
322 EXPECT_EQ(0, sender_.rtt_stats_.LastProcessedRtt()); | 322 EXPECT_EQ(0, sender_.rtt_stats_.LastProcessedRtt()); |
323 EXPECT_EQ(0, sender_.impl_->rtt_ms()); | 323 EXPECT_EQ(0, sender_.impl_->rtt_ms()); |
324 sender_.impl_->Process(); | 324 sender_.impl_->Process(); |
325 EXPECT_EQ(2 * kOneWayNetworkDelayMs, sender_.rtt_stats_.LastProcessedRtt()); | 325 EXPECT_NEAR(2 * kOneWayNetworkDelayMs, sender_.rtt_stats_.LastProcessedRtt(), |
326 EXPECT_EQ(2 * kOneWayNetworkDelayMs, sender_.impl_->rtt_ms()); | 326 1); |
| 327 EXPECT_NEAR(2 * kOneWayNetworkDelayMs, sender_.impl_->rtt_ms(), 1); |
327 } | 328 } |
328 | 329 |
329 TEST_F(RtpRtcpImplTest, SetRtcpXrRrtrStatus) { | 330 TEST_F(RtpRtcpImplTest, SetRtcpXrRrtrStatus) { |
330 EXPECT_FALSE(receiver_.impl_->RtcpXrRrtrStatus()); | 331 EXPECT_FALSE(receiver_.impl_->RtcpXrRrtrStatus()); |
331 receiver_.impl_->SetRtcpXrRrtrStatus(true); | 332 receiver_.impl_->SetRtcpXrRrtrStatus(true); |
332 EXPECT_TRUE(receiver_.impl_->RtcpXrRrtrStatus()); | 333 EXPECT_TRUE(receiver_.impl_->RtcpXrRrtrStatus()); |
333 } | 334 } |
334 | 335 |
335 TEST_F(RtpRtcpImplTest, RttForReceiverOnly) { | 336 TEST_F(RtpRtcpImplTest, RttForReceiverOnly) { |
336 receiver_.impl_->SetRtcpXrRrtrStatus(true); | 337 receiver_.impl_->SetRtcpXrRrtrStatus(true); |
337 | 338 |
338 // Receiver module should send a Receiver time reference report (RTRR). | 339 // Receiver module should send a Receiver time reference report (RTRR). |
339 EXPECT_EQ(0, receiver_.impl_->SendRTCP(kRtcpReport)); | 340 EXPECT_EQ(0, receiver_.impl_->SendRTCP(kRtcpReport)); |
340 | 341 |
341 // Sender module should send a response to the last received RTRR (DLRR). | 342 // Sender module should send a response to the last received RTRR (DLRR). |
342 clock_.AdvanceTimeMilliseconds(1000); | 343 clock_.AdvanceTimeMilliseconds(1000); |
343 EXPECT_EQ(0, sender_.impl_->SendRTCP(kRtcpReport)); | 344 EXPECT_EQ(0, sender_.impl_->SendRTCP(kRtcpReport)); |
344 | 345 |
345 // Verify RTT. | 346 // Verify RTT. |
346 EXPECT_EQ(0, receiver_.rtt_stats_.LastProcessedRtt()); | 347 EXPECT_EQ(0, receiver_.rtt_stats_.LastProcessedRtt()); |
347 EXPECT_EQ(0, receiver_.impl_->rtt_ms()); | 348 EXPECT_EQ(0, receiver_.impl_->rtt_ms()); |
348 receiver_.impl_->Process(); | 349 receiver_.impl_->Process(); |
349 EXPECT_EQ(2 * kOneWayNetworkDelayMs, receiver_.rtt_stats_.LastProcessedRtt()); | 350 EXPECT_NEAR(2 * kOneWayNetworkDelayMs, |
350 EXPECT_EQ(2 * kOneWayNetworkDelayMs, receiver_.impl_->rtt_ms()); | 351 receiver_.rtt_stats_.LastProcessedRtt(), 1); |
| 352 EXPECT_NEAR(2 * kOneWayNetworkDelayMs, receiver_.impl_->rtt_ms(), 1); |
351 } | 353 } |
352 | 354 |
353 TEST_F(RtpRtcpImplTest, NoSrBeforeMedia) { | 355 TEST_F(RtpRtcpImplTest, NoSrBeforeMedia) { |
354 // Ignore fake transport delays in this test. | 356 // Ignore fake transport delays in this test. |
355 sender_.transport_.SimulateNetworkDelay(0, &clock_); | 357 sender_.transport_.SimulateNetworkDelay(0, &clock_); |
356 receiver_.transport_.SimulateNetworkDelay(0, &clock_); | 358 receiver_.transport_.SimulateNetworkDelay(0, &clock_); |
357 | 359 |
358 sender_.impl_->Process(); | 360 sender_.impl_->Process(); |
359 EXPECT_EQ(-1, sender_.RtcpSent().first_packet_time_ms); | 361 EXPECT_EQ(-1, sender_.RtcpSent().first_packet_time_ms); |
360 | 362 |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
541 EXPECT_EQ(6U, receiver_.RtcpSent().unique_nack_requests); | 543 EXPECT_EQ(6U, receiver_.RtcpSent().unique_nack_requests); |
542 EXPECT_THAT(receiver_.LastNackListSent(), ElementsAre(11, 18, 20, 21)); | 544 EXPECT_THAT(receiver_.LastNackListSent(), ElementsAre(11, 18, 20, 21)); |
543 | 545 |
544 // Send module receives the request. | 546 // Send module receives the request. |
545 EXPECT_EQ(2U, sender_.RtcpReceived().nack_packets); | 547 EXPECT_EQ(2U, sender_.RtcpReceived().nack_packets); |
546 EXPECT_EQ(8U, sender_.RtcpReceived().nack_requests); | 548 EXPECT_EQ(8U, sender_.RtcpReceived().nack_requests); |
547 EXPECT_EQ(6U, sender_.RtcpReceived().unique_nack_requests); | 549 EXPECT_EQ(6U, sender_.RtcpReceived().unique_nack_requests); |
548 EXPECT_EQ(75, sender_.RtcpReceived().UniqueNackRequestsInPercent()); | 550 EXPECT_EQ(75, sender_.RtcpReceived().UniqueNackRequestsInPercent()); |
549 } | 551 } |
550 } // namespace webrtc | 552 } // namespace webrtc |
OLD | NEW |