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 |
(...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
681 EXPECT_EQ(0, rtcp_sender_->SendRTCP(feedback_state(), kRtcpReport)); | 681 EXPECT_EQ(0, rtcp_sender_->SendRTCP(feedback_state(), kRtcpReport)); |
682 EXPECT_EQ(2, parser()->tmmbr()->num_packets()); | 682 EXPECT_EQ(2, parser()->tmmbr()->num_packets()); |
683 EXPECT_EQ(2, parser()->tmmbr_item()->num_packets()); | 683 EXPECT_EQ(2, parser()->tmmbr_item()->num_packets()); |
684 | 684 |
685 rtcp_sender_->SetTMMBRStatus(false); | 685 rtcp_sender_->SetTMMBRStatus(false); |
686 EXPECT_FALSE(rtcp_sender_->TMMBR()); | 686 EXPECT_FALSE(rtcp_sender_->TMMBR()); |
687 } | 687 } |
688 | 688 |
689 TEST_F(RtcpSenderTest, SendTmmbn) { | 689 TEST_F(RtcpSenderTest, SendTmmbn) { |
690 rtcp_sender_->SetRTCPStatus(RtcpMode::kCompound); | 690 rtcp_sender_->SetRTCPStatus(RtcpMode::kCompound); |
691 TMMBRSet bounding_set; | 691 std::vector<rtcp::TmmbItem> bounding_set; |
692 bounding_set.VerifyAndAllocateSet(1); | |
693 const uint32_t kBitrateKbps = 32768; | 692 const uint32_t kBitrateKbps = 32768; |
694 const uint32_t kPacketOh = 40; | 693 const uint32_t kPacketOh = 40; |
695 const uint32_t kSourceSsrc = 12345; | 694 const uint32_t kSourceSsrc = 12345; |
696 bounding_set.AddEntry(kBitrateKbps, kPacketOh, kSourceSsrc); | 695 const rtcp::TmmbItem tmmbn(kSourceSsrc, kBitrateKbps * 1000, kPacketOh); |
697 EXPECT_EQ(0, rtcp_sender_->SetTMMBN(&bounding_set)); | 696 bounding_set.push_back(tmmbn); |
| 697 rtcp_sender_->SetTMMBN(&bounding_set); |
| 698 |
698 EXPECT_EQ(0, rtcp_sender_->SendRTCP(feedback_state(), kRtcpSr)); | 699 EXPECT_EQ(0, rtcp_sender_->SendRTCP(feedback_state(), kRtcpSr)); |
699 EXPECT_EQ(1, parser()->sender_report()->num_packets()); | 700 EXPECT_EQ(1, parser()->sender_report()->num_packets()); |
700 EXPECT_EQ(1, parser()->tmmbn()->num_packets()); | 701 EXPECT_EQ(1, parser()->tmmbn()->num_packets()); |
701 EXPECT_EQ(kSenderSsrc, parser()->tmmbn()->Ssrc()); | 702 EXPECT_EQ(kSenderSsrc, parser()->tmmbn()->Ssrc()); |
702 EXPECT_EQ(1, parser()->tmmbn_items()->num_packets()); | 703 EXPECT_EQ(1, parser()->tmmbn_items()->num_packets()); |
703 EXPECT_EQ(kBitrateKbps, parser()->tmmbn_items()->BitrateKbps(0)); | 704 EXPECT_EQ(kBitrateKbps, parser()->tmmbn_items()->BitrateKbps(0)); |
704 EXPECT_EQ(kPacketOh, parser()->tmmbn_items()->Overhead(0)); | 705 EXPECT_EQ(kPacketOh, parser()->tmmbn_items()->Overhead(0)); |
705 EXPECT_EQ(kSourceSsrc, parser()->tmmbn_items()->Ssrc(0)); | 706 EXPECT_EQ(kSourceSsrc, parser()->tmmbn_items()->Ssrc(0)); |
706 } | 707 } |
707 | 708 |
708 // This test is written to verify actual behaviour. It does not seem | 709 // This test is written to verify actual behaviour. It does not seem |
709 // to make much sense to send an empty TMMBN, since there is no place | 710 // to make much sense to send an empty TMMBN, since there is no place |
710 // to put an actual limit here. It's just information that no limit | 711 // to put an actual limit here. It's just information that no limit |
711 // is set, which is kind of the starting assumption. | 712 // is set, which is kind of the starting assumption. |
712 // See http://code.google.com/p/webrtc/issues/detail?id=468 for one | 713 // See http://code.google.com/p/webrtc/issues/detail?id=468 for one |
713 // situation where this caused confusion. | 714 // situation where this caused confusion. |
714 TEST_F(RtcpSenderTest, SendsTmmbnIfSetAndEmpty) { | 715 TEST_F(RtcpSenderTest, SendsTmmbnIfSetAndEmpty) { |
715 rtcp_sender_->SetRTCPStatus(RtcpMode::kCompound); | 716 rtcp_sender_->SetRTCPStatus(RtcpMode::kCompound); |
716 TMMBRSet bounding_set; | 717 std::vector<rtcp::TmmbItem> bounding_set; |
717 EXPECT_EQ(0, rtcp_sender_->SetTMMBN(&bounding_set)); | 718 rtcp_sender_->SetTMMBN(&bounding_set); |
718 EXPECT_EQ(0, rtcp_sender_->SendRTCP(feedback_state(), kRtcpSr)); | 719 EXPECT_EQ(0, rtcp_sender_->SendRTCP(feedback_state(), kRtcpSr)); |
719 EXPECT_EQ(1, parser()->sender_report()->num_packets()); | 720 EXPECT_EQ(1, parser()->sender_report()->num_packets()); |
720 EXPECT_EQ(1, parser()->tmmbn()->num_packets()); | 721 EXPECT_EQ(1, parser()->tmmbn()->num_packets()); |
721 EXPECT_EQ(kSenderSsrc, parser()->tmmbn()->Ssrc()); | 722 EXPECT_EQ(kSenderSsrc, parser()->tmmbn()->Ssrc()); |
722 EXPECT_EQ(0, parser()->tmmbn_items()->num_packets()); | 723 EXPECT_EQ(0, parser()->tmmbn_items()->num_packets()); |
723 } | 724 } |
724 | 725 |
725 TEST_F(RtcpSenderTest, SendCompoundPliRemb) { | 726 TEST_F(RtcpSenderTest, SendCompoundPliRemb) { |
726 const int kBitrate = 261011; | 727 const int kBitrate = 261011; |
727 std::vector<uint32_t> ssrcs; | 728 std::vector<uint32_t> ssrcs; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
769 rtcp_sender_->SetRemoteSSRC(kRemoteSsrc); | 770 rtcp_sender_->SetRemoteSSRC(kRemoteSsrc); |
770 | 771 |
771 // Set up XR VoIP metric to be included with BYE | 772 // Set up XR VoIP metric to be included with BYE |
772 rtcp_sender_->SetRTCPStatus(RtcpMode::kCompound); | 773 rtcp_sender_->SetRTCPStatus(RtcpMode::kCompound); |
773 RTCPVoIPMetric metric; | 774 RTCPVoIPMetric metric; |
774 EXPECT_EQ(0, rtcp_sender_->SetRTCPVoIPMetrics(&metric)); | 775 EXPECT_EQ(0, rtcp_sender_->SetRTCPVoIPMetrics(&metric)); |
775 EXPECT_EQ(0, rtcp_sender_->SendRTCP(feedback_state(), kRtcpBye)); | 776 EXPECT_EQ(0, rtcp_sender_->SendRTCP(feedback_state(), kRtcpBye)); |
776 } | 777 } |
777 | 778 |
778 } // namespace webrtc | 779 } // namespace webrtc |
OLD | NEW |