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

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

Issue 1579213005: [rtp_rtcp] rtcp::Xr moved into own file and renamed to ExtendedReports on the way (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 11 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
11 11
12 /* 12 /*
13 * This file includes unit tests for the RTCPReceiver. 13 * This file includes unit tests for the RTCPReceiver.
14 */ 14 */
15 #include "testing/gmock/include/gmock/gmock.h" 15 #include "testing/gmock/include/gmock/gmock.h"
16 #include "testing/gtest/include/gtest/gtest.h" 16 #include "testing/gtest/include/gtest/gtest.h"
17 17
18 #include "webrtc/common_types.h" 18 #include "webrtc/common_types.h"
19 #include "webrtc/modules/remote_bitrate_estimator/include/mock/mock_remote_bitra te_observer.h" 19 #include "webrtc/modules/remote_bitrate_estimator/include/mock/mock_remote_bitra te_observer.h"
20 #include "webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_singl e_stream.h" 20 #include "webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_singl e_stream.h"
21 #include "webrtc/modules/rtp_rtcp/source/byte_io.h" 21 #include "webrtc/modules/rtp_rtcp/source/byte_io.h"
22 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet.h" 22 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet.h"
23 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/app.h" 23 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/app.h"
24 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/bye.h" 24 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/bye.h"
25 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/extended_jitter_report.h" 25 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/extended_jitter_report.h"
26 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/extended_reports.h"
26 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/pli.h" 27 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/pli.h"
27 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/receiver_report.h" 28 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/receiver_report.h"
28 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/sli.h" 29 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/sli.h"
29 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmbr.h" 30 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmbr.h"
30 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.h" 31 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.h"
31 #include "webrtc/modules/rtp_rtcp/source/rtcp_receiver.h" 32 #include "webrtc/modules/rtp_rtcp/source/rtcp_receiver.h"
32 #include "webrtc/modules/rtp_rtcp/source/rtcp_sender.h" 33 #include "webrtc/modules/rtp_rtcp/source/rtcp_sender.h"
33 #include "webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.h" 34 #include "webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.h"
34 #include "webrtc/modules/rtp_rtcp/source/rtp_utility.h" 35 #include "webrtc/modules/rtp_rtcp/source/rtp_utility.h"
35 36
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 569
569 TEST_F(RtcpReceiverTest, InjectSliPacket) { 570 TEST_F(RtcpReceiverTest, InjectSliPacket) {
570 rtcp::Sli sli; 571 rtcp::Sli sli;
571 sli.WithPictureId(40); 572 sli.WithPictureId(40);
572 rtc::scoped_ptr<rtcp::RawPacket> packet(sli.Build()); 573 rtc::scoped_ptr<rtcp::RawPacket> packet(sli.Build());
573 EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length())); 574 EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length()));
574 EXPECT_EQ(kRtcpSli, rtcp_packet_info_.rtcpPacketTypeFlags); 575 EXPECT_EQ(kRtcpSli, rtcp_packet_info_.rtcpPacketTypeFlags);
575 EXPECT_EQ(40, rtcp_packet_info_.sliPictureId); 576 EXPECT_EQ(40, rtcp_packet_info_.sliPictureId);
576 } 577 }
577 578
578 TEST_F(RtcpReceiverTest, XrPacketWithZeroReportBlocksIgnored) { 579 TEST_F(RtcpReceiverTest, ExtendedReportsPacketWithZeroReportBlocksIgnored) {
579 rtcp::Xr xr; 580 rtcp::ExtendedReports xr;
580 xr.From(0x2345); 581 xr.From(0x2345);
581 rtc::scoped_ptr<rtcp::RawPacket> packet(xr.Build()); 582 rtc::scoped_ptr<rtcp::RawPacket> packet(xr.Build());
582 EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length())); 583 EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length()));
583 EXPECT_EQ(0U, rtcp_packet_info_.rtcpPacketTypeFlags); 584 EXPECT_EQ(0U, rtcp_packet_info_.rtcpPacketTypeFlags);
584 } 585 }
585 586
586 TEST_F(RtcpReceiverTest, InjectXrVoipPacket) { 587 TEST_F(RtcpReceiverTest, InjectExtendedReportsVoipPacket) {
587 const uint32_t kSourceSsrc = 0x123456; 588 const uint32_t kSourceSsrc = 0x123456;
588 std::set<uint32_t> ssrcs; 589 std::set<uint32_t> ssrcs;
589 ssrcs.insert(kSourceSsrc); 590 ssrcs.insert(kSourceSsrc);
590 rtcp_receiver_->SetSsrcs(kSourceSsrc, ssrcs); 591 rtcp_receiver_->SetSsrcs(kSourceSsrc, ssrcs);
591 592
592 const uint8_t kLossRate = 123; 593 const uint8_t kLossRate = 123;
593 rtcp::VoipMetric voip_metric; 594 rtcp::VoipMetric voip_metric;
594 voip_metric.To(kSourceSsrc); 595 voip_metric.To(kSourceSsrc);
595 RTCPVoIPMetric metric; 596 RTCPVoIPMetric metric;
596 metric.lossRate = kLossRate; 597 metric.lossRate = kLossRate;
597 voip_metric.WithVoipMetric(metric); 598 voip_metric.WithVoipMetric(metric);
598 rtcp::Xr xr; 599 rtcp::ExtendedReports xr;
599 xr.From(0x2345); 600 xr.From(0x2345);
600 xr.WithVoipMetric(&voip_metric); 601 xr.WithVoipMetric(&voip_metric);
601 rtc::scoped_ptr<rtcp::RawPacket> packet(xr.Build()); 602 rtc::scoped_ptr<rtcp::RawPacket> packet(xr.Build());
602 EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length())); 603 EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length()));
603 ASSERT_TRUE(rtcp_packet_info_.VoIPMetric != nullptr); 604 ASSERT_TRUE(rtcp_packet_info_.VoIPMetric != nullptr);
604 EXPECT_EQ(kLossRate, rtcp_packet_info_.VoIPMetric->lossRate); 605 EXPECT_EQ(kLossRate, rtcp_packet_info_.VoIPMetric->lossRate);
605 EXPECT_EQ(kRtcpXrVoipMetric, rtcp_packet_info_.rtcpPacketTypeFlags); 606 EXPECT_EQ(kRtcpXrVoipMetric, rtcp_packet_info_.rtcpPacketTypeFlags);
606 } 607 }
607 608
608 TEST_F(RtcpReceiverTest, XrVoipPacketNotToUsIgnored) { 609 TEST_F(RtcpReceiverTest, ExtendedReportsVoipPacketNotToUsIgnored) {
609 const uint32_t kSourceSsrc = 0x123456; 610 const uint32_t kSourceSsrc = 0x123456;
610 std::set<uint32_t> ssrcs; 611 std::set<uint32_t> ssrcs;
611 ssrcs.insert(kSourceSsrc); 612 ssrcs.insert(kSourceSsrc);
612 rtcp_receiver_->SetSsrcs(kSourceSsrc, ssrcs); 613 rtcp_receiver_->SetSsrcs(kSourceSsrc, ssrcs);
613 614
614 rtcp::VoipMetric voip_metric; 615 rtcp::VoipMetric voip_metric;
615 voip_metric.To(kSourceSsrc + 1); 616 voip_metric.To(kSourceSsrc + 1);
616 rtcp::Xr xr; 617 rtcp::ExtendedReports xr;
617 xr.From(0x2345); 618 xr.From(0x2345);
618 xr.WithVoipMetric(&voip_metric); 619 xr.WithVoipMetric(&voip_metric);
619 rtc::scoped_ptr<rtcp::RawPacket> packet(xr.Build()); 620 rtc::scoped_ptr<rtcp::RawPacket> packet(xr.Build());
620 EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length())); 621 EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length()));
621 EXPECT_EQ(0U, rtcp_packet_info_.rtcpPacketTypeFlags); 622 EXPECT_EQ(0U, rtcp_packet_info_.rtcpPacketTypeFlags);
622 } 623 }
623 624
624 TEST_F(RtcpReceiverTest, InjectXrReceiverReferenceTimePacket) { 625 TEST_F(RtcpReceiverTest, InjectExtendedReportsReceiverReferenceTimePacket) {
625 rtcp::Rrtr rrtr; 626 rtcp::Rrtr rrtr;
626 rrtr.WithNtp(NtpTime(0x10203, 0x40506)); 627 rrtr.WithNtp(NtpTime(0x10203, 0x40506));
627 rtcp::Xr xr; 628 rtcp::ExtendedReports xr;
628 xr.From(0x2345); 629 xr.From(0x2345);
629 xr.WithRrtr(&rrtr); 630 xr.WithRrtr(&rrtr);
630 631
631 rtc::scoped_ptr<rtcp::RawPacket> packet(xr.Build()); 632 rtc::scoped_ptr<rtcp::RawPacket> packet(xr.Build());
632 EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length())); 633 EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length()));
633 EXPECT_EQ(kRtcpXrReceiverReferenceTime, 634 EXPECT_EQ(kRtcpXrReceiverReferenceTime,
634 rtcp_packet_info_.rtcpPacketTypeFlags); 635 rtcp_packet_info_.rtcpPacketTypeFlags);
635 } 636 }
636 637
637 TEST_F(RtcpReceiverTest, XrDlrrPacketNotToUsIgnored) { 638 TEST_F(RtcpReceiverTest, ExtendedReportsDlrrPacketNotToUsIgnored) {
638 const uint32_t kSourceSsrc = 0x123456; 639 const uint32_t kSourceSsrc = 0x123456;
639 std::set<uint32_t> ssrcs; 640 std::set<uint32_t> ssrcs;
640 ssrcs.insert(kSourceSsrc); 641 ssrcs.insert(kSourceSsrc);
641 rtcp_receiver_->SetSsrcs(kSourceSsrc, ssrcs); 642 rtcp_receiver_->SetSsrcs(kSourceSsrc, ssrcs);
642 643
643 rtcp::Dlrr dlrr; 644 rtcp::Dlrr dlrr;
644 dlrr.WithDlrrItem(kSourceSsrc + 1, 0x12345, 0x67890); 645 dlrr.WithDlrrItem(kSourceSsrc + 1, 0x12345, 0x67890);
645 rtcp::Xr xr; 646 rtcp::ExtendedReports xr;
646 xr.From(0x2345); 647 xr.From(0x2345);
647 xr.WithDlrr(&dlrr); 648 xr.WithDlrr(&dlrr);
648 rtc::scoped_ptr<rtcp::RawPacket> packet(xr.Build()); 649 rtc::scoped_ptr<rtcp::RawPacket> packet(xr.Build());
649 EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length())); 650 EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length()));
650 EXPECT_EQ(0U, rtcp_packet_info_.rtcpPacketTypeFlags); 651 EXPECT_EQ(0U, rtcp_packet_info_.rtcpPacketTypeFlags);
651 EXPECT_FALSE(rtcp_packet_info_.xr_dlrr_item); 652 EXPECT_FALSE(rtcp_packet_info_.xr_dlrr_item);
652 } 653 }
653 654
654 TEST_F(RtcpReceiverTest, InjectXrDlrrPacketWithSubBlock) { 655 TEST_F(RtcpReceiverTest, InjectExtendedReportsDlrrPacketWithSubBlock) {
655 const uint32_t kSourceSsrc = 0x123456; 656 const uint32_t kSourceSsrc = 0x123456;
656 std::set<uint32_t> ssrcs; 657 std::set<uint32_t> ssrcs;
657 ssrcs.insert(kSourceSsrc); 658 ssrcs.insert(kSourceSsrc);
658 rtcp_receiver_->SetSsrcs(kSourceSsrc, ssrcs); 659 rtcp_receiver_->SetSsrcs(kSourceSsrc, ssrcs);
659 660
660 rtcp::Dlrr dlrr; 661 rtcp::Dlrr dlrr;
661 dlrr.WithDlrrItem(kSourceSsrc, 0x12345, 0x67890); 662 dlrr.WithDlrrItem(kSourceSsrc, 0x12345, 0x67890);
662 rtcp::Xr xr; 663 rtcp::ExtendedReports xr;
663 xr.From(0x2345); 664 xr.From(0x2345);
664 xr.WithDlrr(&dlrr); 665 xr.WithDlrr(&dlrr);
665 rtc::scoped_ptr<rtcp::RawPacket> packet(xr.Build()); 666 rtc::scoped_ptr<rtcp::RawPacket> packet(xr.Build());
666 EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length())); 667 EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length()));
667 // The parser should note the DLRR report block item, but not flag the packet 668 // The parser should note the DLRR report block item, but not flag the packet
668 // since the RTT is not estimated. 669 // since the RTT is not estimated.
669 EXPECT_TRUE(rtcp_packet_info_.xr_dlrr_item); 670 EXPECT_TRUE(rtcp_packet_info_.xr_dlrr_item);
670 } 671 }
671 672
672 TEST_F(RtcpReceiverTest, InjectXrDlrrPacketWithMultipleSubBlocks) { 673 TEST_F(RtcpReceiverTest, InjectExtendedReportsDlrrPacketWithMultipleSubBlocks) {
673 const uint32_t kSourceSsrc = 0x123456; 674 const uint32_t kSourceSsrc = 0x123456;
674 std::set<uint32_t> ssrcs; 675 std::set<uint32_t> ssrcs;
675 ssrcs.insert(kSourceSsrc); 676 ssrcs.insert(kSourceSsrc);
676 rtcp_receiver_->SetSsrcs(kSourceSsrc, ssrcs); 677 rtcp_receiver_->SetSsrcs(kSourceSsrc, ssrcs);
677 678
678 rtcp::Dlrr dlrr; 679 rtcp::Dlrr dlrr;
679 dlrr.WithDlrrItem(kSourceSsrc + 1, 0x12345, 0x67890); 680 dlrr.WithDlrrItem(kSourceSsrc + 1, 0x12345, 0x67890);
680 dlrr.WithDlrrItem(kSourceSsrc + 2, 0x12345, 0x67890); 681 dlrr.WithDlrrItem(kSourceSsrc + 2, 0x12345, 0x67890);
681 dlrr.WithDlrrItem(kSourceSsrc, 0x12345, 0x67890); 682 dlrr.WithDlrrItem(kSourceSsrc, 0x12345, 0x67890);
682 rtcp::Xr xr; 683 rtcp::ExtendedReports xr;
683 xr.From(0x2345); 684 xr.From(0x2345);
684 xr.WithDlrr(&dlrr); 685 xr.WithDlrr(&dlrr);
685 rtc::scoped_ptr<rtcp::RawPacket> packet(xr.Build()); 686 rtc::scoped_ptr<rtcp::RawPacket> packet(xr.Build());
686 EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length())); 687 EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length()));
687 // The parser should note the DLRR report block item, but not flag the packet 688 // The parser should note the DLRR report block item, but not flag the packet
688 // since the RTT is not estimated. 689 // since the RTT is not estimated.
689 EXPECT_TRUE(rtcp_packet_info_.xr_dlrr_item); 690 EXPECT_TRUE(rtcp_packet_info_.xr_dlrr_item);
690 } 691 }
691 692
692 TEST_F(RtcpReceiverTest, InjectXrPacketWithMultipleReportBlocks) { 693 TEST_F(RtcpReceiverTest, InjectExtendedReportsPacketWithMultipleReportBlocks) {
693 const uint32_t kSourceSsrc = 0x123456; 694 const uint32_t kSourceSsrc = 0x123456;
694 std::set<uint32_t> ssrcs; 695 std::set<uint32_t> ssrcs;
695 ssrcs.insert(kSourceSsrc); 696 ssrcs.insert(kSourceSsrc);
696 rtcp_receiver_->SetSsrcs(kSourceSsrc, ssrcs); 697 rtcp_receiver_->SetSsrcs(kSourceSsrc, ssrcs);
697 698
698 rtcp::Rrtr rrtr; 699 rtcp::Rrtr rrtr;
699 rtcp::Dlrr dlrr; 700 rtcp::Dlrr dlrr;
700 dlrr.WithDlrrItem(kSourceSsrc, 0x12345, 0x67890); 701 dlrr.WithDlrrItem(kSourceSsrc, 0x12345, 0x67890);
701 rtcp::VoipMetric metric; 702 rtcp::VoipMetric metric;
702 metric.To(kSourceSsrc); 703 metric.To(kSourceSsrc);
703 rtcp::Xr xr; 704 rtcp::ExtendedReports xr;
704 xr.From(0x2345); 705 xr.From(0x2345);
705 xr.WithRrtr(&rrtr); 706 xr.WithRrtr(&rrtr);
706 xr.WithDlrr(&dlrr); 707 xr.WithDlrr(&dlrr);
707 xr.WithVoipMetric(&metric); 708 xr.WithVoipMetric(&metric);
708 rtc::scoped_ptr<rtcp::RawPacket> packet(xr.Build()); 709 rtc::scoped_ptr<rtcp::RawPacket> packet(xr.Build());
709 EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length())); 710 EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length()));
710 EXPECT_EQ(static_cast<unsigned int>(kRtcpXrReceiverReferenceTime + 711 EXPECT_EQ(static_cast<unsigned int>(kRtcpXrReceiverReferenceTime +
711 kRtcpXrVoipMetric), 712 kRtcpXrVoipMetric),
712 rtcp_packet_info_.rtcpPacketTypeFlags); 713 rtcp_packet_info_.rtcpPacketTypeFlags);
713 // The parser should note the DLRR report block item, but not flag the packet 714 // The parser should note the DLRR report block item, but not flag the packet
714 // since the RTT is not estimated. 715 // since the RTT is not estimated.
715 EXPECT_TRUE(rtcp_packet_info_.xr_dlrr_item); 716 EXPECT_TRUE(rtcp_packet_info_.xr_dlrr_item);
716 } 717 }
717 718
718 TEST_F(RtcpReceiverTest, InjectXrPacketWithUnknownReportBlock) { 719 TEST_F(RtcpReceiverTest, InjectExtendedReportsPacketWithUnknownReportBlock) {
719 const uint32_t kSourceSsrc = 0x123456; 720 const uint32_t kSourceSsrc = 0x123456;
720 std::set<uint32_t> ssrcs; 721 std::set<uint32_t> ssrcs;
721 ssrcs.insert(kSourceSsrc); 722 ssrcs.insert(kSourceSsrc);
722 rtcp_receiver_->SetSsrcs(kSourceSsrc, ssrcs); 723 rtcp_receiver_->SetSsrcs(kSourceSsrc, ssrcs);
723 std::vector<uint32_t> remote_ssrcs; 724 std::vector<uint32_t> remote_ssrcs;
724 remote_ssrcs.push_back(kSourceSsrc); 725 remote_ssrcs.push_back(kSourceSsrc);
725 726
726 rtcp::Rrtr rrtr; 727 rtcp::Rrtr rrtr;
727 rtcp::Dlrr dlrr; 728 rtcp::Dlrr dlrr;
728 dlrr.WithDlrrItem(kSourceSsrc, 0x12345, 0x67890); 729 dlrr.WithDlrrItem(kSourceSsrc, 0x12345, 0x67890);
729 rtcp::VoipMetric metric; 730 rtcp::VoipMetric metric;
730 metric.To(kSourceSsrc); 731 metric.To(kSourceSsrc);
731 rtcp::Xr xr; 732 rtcp::ExtendedReports xr;
732 xr.From(0x2345); 733 xr.From(0x2345);
733 xr.WithRrtr(&rrtr); 734 xr.WithRrtr(&rrtr);
734 xr.WithDlrr(&dlrr); 735 xr.WithDlrr(&dlrr);
735 xr.WithVoipMetric(&metric); 736 xr.WithVoipMetric(&metric);
736 rtc::scoped_ptr<rtcp::RawPacket> packet(xr.Build()); 737 rtc::scoped_ptr<rtcp::RawPacket> packet(xr.Build());
737 // Modify the DLRR block to have an unsupported block type, from 5 to 6. 738 // Modify the DLRR block to have an unsupported block type, from 5 to 6.
738 uint8_t* buffer = const_cast<uint8_t*>(packet->Buffer()); 739 uint8_t* buffer = const_cast<uint8_t*>(packet->Buffer());
739 EXPECT_EQ(5, buffer[20]); 740 EXPECT_EQ(5, buffer[20]);
740 buffer[20] = 6; 741 buffer[20] = 6;
741 742
742 EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length())); 743 EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length()));
743 EXPECT_EQ(static_cast<unsigned int>(kRtcpXrReceiverReferenceTime + 744 EXPECT_EQ(static_cast<unsigned int>(kRtcpXrReceiverReferenceTime +
744 kRtcpXrVoipMetric), 745 kRtcpXrVoipMetric),
745 rtcp_packet_info_.rtcpPacketTypeFlags); 746 rtcp_packet_info_.rtcpPacketTypeFlags);
746 EXPECT_FALSE(rtcp_packet_info_.xr_dlrr_item); 747 EXPECT_FALSE(rtcp_packet_info_.xr_dlrr_item);
747 } 748 }
748 749
749 TEST_F(RtcpReceiverTest, TestXrRrRttInitiallyFalse) { 750 TEST_F(RtcpReceiverTest, TestXrRrRttInitiallyFalse) {
750 int64_t rtt_ms; 751 int64_t rtt_ms;
751 EXPECT_FALSE(rtcp_receiver_->GetAndResetXrRrRtt(&rtt_ms)); 752 EXPECT_FALSE(rtcp_receiver_->GetAndResetXrRrRtt(&rtt_ms));
752 } 753 }
753 754
754 TEST_F(RtcpReceiverTest, LastReceivedXrReferenceTimeInfoInitiallyFalse) { 755 TEST_F(RtcpReceiverTest, LastReceivedXrReferenceTimeInfoInitiallyFalse) {
755 RtcpReceiveTimeInfo info; 756 RtcpReceiveTimeInfo info;
756 EXPECT_FALSE(rtcp_receiver_->LastReceivedXrReferenceTimeInfo(&info)); 757 EXPECT_FALSE(rtcp_receiver_->LastReceivedXrReferenceTimeInfo(&info));
757 } 758 }
758 759
759 TEST_F(RtcpReceiverTest, GetLastReceivedXrReferenceTimeInfo) { 760 TEST_F(RtcpReceiverTest, GetLastReceivedExtendedReportsReferenceTimeInfo) {
760 const uint32_t kSenderSsrc = 0x123456; 761 const uint32_t kSenderSsrc = 0x123456;
761 const NtpTime kNtp(0x10203, 0x40506); 762 const NtpTime kNtp(0x10203, 0x40506);
762 const uint32_t kNtpMid = 763 const uint32_t kNtpMid =
763 RTCPUtility::MidNtp(kNtp.seconds(), kNtp.fractions()); 764 RTCPUtility::MidNtp(kNtp.seconds(), kNtp.fractions());
764 765
765 rtcp::Rrtr rrtr; 766 rtcp::Rrtr rrtr;
766 rrtr.WithNtp(kNtp); 767 rrtr.WithNtp(kNtp);
767 rtcp::Xr xr; 768 rtcp::ExtendedReports xr;
768 xr.From(kSenderSsrc); 769 xr.From(kSenderSsrc);
769 xr.WithRrtr(&rrtr); 770 xr.WithRrtr(&rrtr);
770 rtc::scoped_ptr<rtcp::RawPacket> packet(xr.Build()); 771 rtc::scoped_ptr<rtcp::RawPacket> packet(xr.Build());
771 EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length())); 772 EXPECT_EQ(0, InjectRtcpPacket(packet->Buffer(), packet->Length()));
772 EXPECT_EQ(kRtcpXrReceiverReferenceTime, 773 EXPECT_EQ(kRtcpXrReceiverReferenceTime,
773 rtcp_packet_info_.rtcpPacketTypeFlags); 774 rtcp_packet_info_.rtcpPacketTypeFlags);
774 775
775 RtcpReceiveTimeInfo info; 776 RtcpReceiveTimeInfo info;
776 EXPECT_TRUE(rtcp_receiver_->LastReceivedXrReferenceTimeInfo(&info)); 777 EXPECT_TRUE(rtcp_receiver_->LastReceivedXrReferenceTimeInfo(&info));
777 EXPECT_EQ(kSenderSsrc, info.sourceSSRC); 778 EXPECT_EQ(kSenderSsrc, info.sourceSSRC);
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
1094 1095
1095 // Transport feedback should be ignored, but next packet should work. 1096 // Transport feedback should be ignored, but next packet should work.
1096 EXPECT_EQ(0u, rtcp_packet_info_.rtcpPacketTypeFlags & kRtcpTransportFeedback); 1097 EXPECT_EQ(0u, rtcp_packet_info_.rtcpPacketTypeFlags & kRtcpTransportFeedback);
1097 EXPECT_NE(0u, rtcp_packet_info_.rtcpPacketTypeFlags & kRtcpRemb); 1098 EXPECT_NE(0u, rtcp_packet_info_.rtcpPacketTypeFlags & kRtcpRemb);
1098 EXPECT_EQ(kBitrateBps, rtcp_packet_info_.receiverEstimatedMaxBitrate); 1099 EXPECT_EQ(kBitrateBps, rtcp_packet_info_.receiverEstimatedMaxBitrate);
1099 } 1100 }
1100 1101
1101 } // Anonymous namespace 1102 } // Anonymous namespace
1102 1103
1103 } // namespace webrtc 1104 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698