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

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

Issue 1496883002: rtcp::Rrtr block moved into own file and got Parse function (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase 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) 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 602 matching lines...) Expand 10 before | Expand all | Expand 10 after
613 rtcp::Xr xr; 613 rtcp::Xr xr;
614 xr.From(0x2345); 614 xr.From(0x2345);
615 xr.WithVoipMetric(&voip_metric); 615 xr.WithVoipMetric(&voip_metric);
616 rtc::scoped_ptr<rtcp::RawPacket> packet(xr.Build()); 616 rtc::scoped_ptr<rtcp::RawPacket> packet(xr.Build());
617 EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length())); 617 EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length()));
618 EXPECT_EQ(0U, rtcp_packet_info_.rtcpPacketTypeFlags); 618 EXPECT_EQ(0U, rtcp_packet_info_.rtcpPacketTypeFlags);
619 } 619 }
620 620
621 TEST_F(RtcpReceiverTest, InjectXrReceiverReferenceTimePacket) { 621 TEST_F(RtcpReceiverTest, InjectXrReceiverReferenceTimePacket) {
622 rtcp::Rrtr rrtr; 622 rtcp::Rrtr rrtr;
623 rrtr.WithNtpSec(0x10203); 623 rrtr.WithNtp(NtpTime(0x10203, 0x40506));
624 rrtr.WithNtpFrac(0x40506);
625 rtcp::Xr xr; 624 rtcp::Xr xr;
626 xr.From(0x2345); 625 xr.From(0x2345);
627 xr.WithRrtr(&rrtr); 626 xr.WithRrtr(&rrtr);
628 627
629 rtc::scoped_ptr<rtcp::RawPacket> packet(xr.Build()); 628 rtc::scoped_ptr<rtcp::RawPacket> packet(xr.Build());
630 EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length())); 629 EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length()));
631 EXPECT_EQ(kRtcpXrReceiverReferenceTime, 630 EXPECT_EQ(kRtcpXrReceiverReferenceTime,
632 rtcp_packet_info_.rtcpPacketTypeFlags); 631 rtcp_packet_info_.rtcpPacketTypeFlags);
633 } 632 }
634 633
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
749 EXPECT_FALSE(rtcp_receiver_->GetAndResetXrRrRtt(&rtt_ms)); 748 EXPECT_FALSE(rtcp_receiver_->GetAndResetXrRrRtt(&rtt_ms));
750 } 749 }
751 750
752 TEST_F(RtcpReceiverTest, LastReceivedXrReferenceTimeInfoInitiallyFalse) { 751 TEST_F(RtcpReceiverTest, LastReceivedXrReferenceTimeInfoInitiallyFalse) {
753 RtcpReceiveTimeInfo info; 752 RtcpReceiveTimeInfo info;
754 EXPECT_FALSE(rtcp_receiver_->LastReceivedXrReferenceTimeInfo(&info)); 753 EXPECT_FALSE(rtcp_receiver_->LastReceivedXrReferenceTimeInfo(&info));
755 } 754 }
756 755
757 TEST_F(RtcpReceiverTest, GetLastReceivedXrReferenceTimeInfo) { 756 TEST_F(RtcpReceiverTest, GetLastReceivedXrReferenceTimeInfo) {
758 const uint32_t kSenderSsrc = 0x123456; 757 const uint32_t kSenderSsrc = 0x123456;
759 const uint32_t kNtpSec = 0x10203; 758 const NtpTime kNtp(0x10203, 0x40506);
760 const uint32_t kNtpFrac = 0x40506; 759 const uint32_t kNtpMid =
761 const uint32_t kNtpMid = RTCPUtility::MidNtp(kNtpSec, kNtpFrac); 760 RTCPUtility::MidNtp(kNtp.seconds(), kNtp.fractions());
762 761
763 rtcp::Rrtr rrtr; 762 rtcp::Rrtr rrtr;
764 rrtr.WithNtpSec(kNtpSec); 763 rrtr.WithNtp(kNtp);
765 rrtr.WithNtpFrac(kNtpFrac);
766 rtcp::Xr xr; 764 rtcp::Xr xr;
767 xr.From(kSenderSsrc); 765 xr.From(kSenderSsrc);
768 xr.WithRrtr(&rrtr); 766 xr.WithRrtr(&rrtr);
769 rtc::scoped_ptr<rtcp::RawPacket> packet(xr.Build()); 767 rtc::scoped_ptr<rtcp::RawPacket> packet(xr.Build());
770 EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length())); 768 EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length()));
771 EXPECT_EQ(kRtcpXrReceiverReferenceTime, 769 EXPECT_EQ(kRtcpXrReceiverReferenceTime,
772 rtcp_packet_info_.rtcpPacketTypeFlags); 770 rtcp_packet_info_.rtcpPacketTypeFlags);
773 771
774 RtcpReceiveTimeInfo info; 772 RtcpReceiveTimeInfo info;
775 EXPECT_TRUE(rtcp_receiver_->LastReceivedXrReferenceTimeInfo(&info)); 773 EXPECT_TRUE(rtcp_receiver_->LastReceivedXrReferenceTimeInfo(&info));
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
1093 1091
1094 // Transport feedback should be ignored, but next packet should work. 1092 // Transport feedback should be ignored, but next packet should work.
1095 EXPECT_EQ(0u, rtcp_packet_info_.rtcpPacketTypeFlags & kRtcpTransportFeedback); 1093 EXPECT_EQ(0u, rtcp_packet_info_.rtcpPacketTypeFlags & kRtcpTransportFeedback);
1096 EXPECT_NE(0u, rtcp_packet_info_.rtcpPacketTypeFlags & kRtcpRemb); 1094 EXPECT_NE(0u, rtcp_packet_info_.rtcpPacketTypeFlags & kRtcpRemb);
1097 EXPECT_EQ(kBitrateBps, rtcp_packet_info_.receiverEstimatedMaxBitrate); 1095 EXPECT_EQ(kBitrateBps, rtcp_packet_info_.receiverEstimatedMaxBitrate);
1098 } 1096 }
1099 1097
1100 } // Anonymous namespace 1098 } // Anonymous namespace
1101 1099
1102 } // namespace webrtc 1100 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtcp_packet_unittest.cc ('k') | webrtc/modules/rtp_rtcp/source/rtcp_sender.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698