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

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

Issue 1491843004: [rtp_rtcp] RTT intermidiate calculation use ntp time instead of milliseconds. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase 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
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 625 matching lines...) Expand 10 before | Expand all | Expand 10 after
636 636
637 TEST_F(RtcpSenderTest, TestNoXrRrtrSentIfNotEnabled) { 637 TEST_F(RtcpSenderTest, TestNoXrRrtrSentIfNotEnabled) {
638 rtcp_sender_->SetRTCPStatus(RtcpMode::kCompound); 638 rtcp_sender_->SetRTCPStatus(RtcpMode::kCompound);
639 EXPECT_EQ(0, rtcp_sender_->SetSendingStatus(feedback_state(), false)); 639 EXPECT_EQ(0, rtcp_sender_->SetSendingStatus(feedback_state(), false));
640 rtcp_sender_->SendRtcpXrReceiverReferenceTime(false); 640 rtcp_sender_->SendRtcpXrReceiverReferenceTime(false);
641 EXPECT_EQ(0, rtcp_sender_->SendRTCP(feedback_state(), kRtcpReport)); 641 EXPECT_EQ(0, rtcp_sender_->SendRTCP(feedback_state(), kRtcpReport));
642 EXPECT_EQ(0, parser()->xr_header()->num_packets()); 642 EXPECT_EQ(0, parser()->xr_header()->num_packets());
643 EXPECT_EQ(0, parser()->rrtr()->num_packets()); 643 EXPECT_EQ(0, parser()->rrtr()->num_packets());
644 } 644 }
645 645
646 TEST_F(RtcpSenderTest, TestSendTimeOfXrRrtr) {
647 rtcp_sender_->SetRTCPStatus(RtcpMode::kCompound);
648 RTCPSender::FeedbackState feedback_state = rtp_rtcp_impl_->GetFeedbackState();
649 EXPECT_EQ(0, rtcp_sender_->SetSendingStatus(feedback_state, false));
650 rtcp_sender_->SendRtcpXrReceiverReferenceTime(true);
651 uint32_t ntp_sec;
652 uint32_t ntp_frac;
653 clock_.CurrentNtp(ntp_sec, ntp_frac);
654 uint32_t initial_mid_ntp = RTCPUtility::MidNtp(ntp_sec, ntp_frac);
655
656 // No packet sent.
657 int64_t time_ms;
658 EXPECT_FALSE(rtcp_sender_->SendTimeOfXrRrReport(initial_mid_ntp, &time_ms));
659
660 // Send XR RR packets.
661 for (int i = 0; i <= RTCP_NUMBER_OF_SR; ++i) {
662 EXPECT_EQ(0, rtcp_sender_->SendRTCP(feedback_state, kRtcpReport));
663 EXPECT_EQ(i + 1, test_transport_.parser_.rrtr()->num_packets());
664 clock_.CurrentNtp(ntp_sec, ntp_frac);
665 uint32_t mid_ntp = RTCPUtility::MidNtp(ntp_sec, ntp_frac);
666 EXPECT_TRUE(rtcp_sender_->SendTimeOfXrRrReport(mid_ntp, &time_ms));
667 EXPECT_EQ(clock_.CurrentNtpInMilliseconds(), time_ms);
668 clock_.AdvanceTimeMilliseconds(1000);
669 }
670 // The first report should no longer be stored.
671 EXPECT_FALSE(rtcp_sender_->SendTimeOfXrRrReport(initial_mid_ntp, &time_ms));
672 }
673
674 TEST_F(RtcpSenderTest, TestRegisterRtcpPacketTypeObserver) { 646 TEST_F(RtcpSenderTest, TestRegisterRtcpPacketTypeObserver) {
675 RtcpPacketTypeCounterObserverImpl observer; 647 RtcpPacketTypeCounterObserverImpl observer;
676 rtcp_sender_.reset(new RTCPSender(false, &clock_, receive_statistics_.get(), 648 rtcp_sender_.reset(new RTCPSender(false, &clock_, receive_statistics_.get(),
677 &observer, nullptr, &test_transport_)); 649 &observer, nullptr, &test_transport_));
678 rtcp_sender_->SetRemoteSSRC(kRemoteSsrc); 650 rtcp_sender_->SetRemoteSSRC(kRemoteSsrc);
679 rtcp_sender_->SetRTCPStatus(RtcpMode::kReducedSize); 651 rtcp_sender_->SetRTCPStatus(RtcpMode::kReducedSize);
680 EXPECT_EQ(0, rtcp_sender_->SendRTCP(feedback_state(), kRtcpPli)); 652 EXPECT_EQ(0, rtcp_sender_->SendRTCP(feedback_state(), kRtcpPli));
681 EXPECT_EQ(1, parser()->pli()->num_packets()); 653 EXPECT_EQ(1, parser()->pli()->num_packets());
682 EXPECT_EQ(kRemoteSsrc, observer.ssrc_); 654 EXPECT_EQ(kRemoteSsrc, observer.ssrc_);
683 EXPECT_EQ(1U, observer.counter_.pli_packets); 655 EXPECT_EQ(1U, observer.counter_.pli_packets);
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
799 rtcp_sender_->SetRemoteSSRC(kRemoteSsrc); 771 rtcp_sender_->SetRemoteSSRC(kRemoteSsrc);
800 772
801 // Set up XR VoIP metric to be included with BYE 773 // Set up XR VoIP metric to be included with BYE
802 rtcp_sender_->SetRTCPStatus(RtcpMode::kCompound); 774 rtcp_sender_->SetRTCPStatus(RtcpMode::kCompound);
803 RTCPVoIPMetric metric; 775 RTCPVoIPMetric metric;
804 EXPECT_EQ(0, rtcp_sender_->SetRTCPVoIPMetrics(&metric)); 776 EXPECT_EQ(0, rtcp_sender_->SetRTCPVoIPMetrics(&metric));
805 EXPECT_EQ(0, rtcp_sender_->SendRTCP(feedback_state(), kRtcpBye)); 777 EXPECT_EQ(0, rtcp_sender_->SendRTCP(feedback_state(), kRtcpBye));
806 } 778 }
807 779
808 } // namespace webrtc 780 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtcp_sender.cc ('k') | webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698