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