| 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 701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 712 } | 712 } |
| 713 | 713 |
| 714 TEST_F(RtcpSenderTest, SendTmmbn) { | 714 TEST_F(RtcpSenderTest, SendTmmbn) { |
| 715 rtcp_sender_->SetRTCPStatus(RtcpMode::kCompound); | 715 rtcp_sender_->SetRTCPStatus(RtcpMode::kCompound); |
| 716 TMMBRSet bounding_set; | 716 TMMBRSet bounding_set; |
| 717 bounding_set.VerifyAndAllocateSet(1); | 717 bounding_set.VerifyAndAllocateSet(1); |
| 718 const uint32_t kBitrateKbps = 32768; | 718 const uint32_t kBitrateKbps = 32768; |
| 719 const uint32_t kPacketOh = 40; | 719 const uint32_t kPacketOh = 40; |
| 720 const uint32_t kSourceSsrc = 12345; | 720 const uint32_t kSourceSsrc = 12345; |
| 721 bounding_set.AddEntry(kBitrateKbps, kPacketOh, kSourceSsrc); | 721 bounding_set.AddEntry(kBitrateKbps, kPacketOh, kSourceSsrc); |
| 722 EXPECT_EQ(0, rtcp_sender_->SetTMMBN(&bounding_set, 0)); | 722 EXPECT_EQ(0, rtcp_sender_->SetTMMBN(&bounding_set)); |
| 723 EXPECT_EQ(0, rtcp_sender_->SendRTCP(feedback_state(), kRtcpSr)); | 723 EXPECT_EQ(0, rtcp_sender_->SendRTCP(feedback_state(), kRtcpSr)); |
| 724 EXPECT_EQ(1, parser()->sender_report()->num_packets()); | 724 EXPECT_EQ(1, parser()->sender_report()->num_packets()); |
| 725 EXPECT_EQ(1, parser()->tmmbn()->num_packets()); | 725 EXPECT_EQ(1, parser()->tmmbn()->num_packets()); |
| 726 EXPECT_EQ(kSenderSsrc, parser()->tmmbn()->Ssrc()); | 726 EXPECT_EQ(kSenderSsrc, parser()->tmmbn()->Ssrc()); |
| 727 EXPECT_EQ(1, parser()->tmmbn_items()->num_packets()); | 727 EXPECT_EQ(1, parser()->tmmbn_items()->num_packets()); |
| 728 EXPECT_EQ(kBitrateKbps, parser()->tmmbn_items()->BitrateKbps(0)); | 728 EXPECT_EQ(kBitrateKbps, parser()->tmmbn_items()->BitrateKbps(0)); |
| 729 EXPECT_EQ(kPacketOh, parser()->tmmbn_items()->Overhead(0)); | 729 EXPECT_EQ(kPacketOh, parser()->tmmbn_items()->Overhead(0)); |
| 730 EXPECT_EQ(kSourceSsrc, parser()->tmmbn_items()->Ssrc(0)); | 730 EXPECT_EQ(kSourceSsrc, parser()->tmmbn_items()->Ssrc(0)); |
| 731 } | 731 } |
| 732 | 732 |
| 733 // This test is written to verify actual behaviour. It does not seem | 733 // This test is written to verify actual behaviour. It does not seem |
| 734 // to make much sense to send an empty TMMBN, since there is no place | 734 // to make much sense to send an empty TMMBN, since there is no place |
| 735 // to put an actual limit here. It's just information that no limit | 735 // to put an actual limit here. It's just information that no limit |
| 736 // is set, which is kind of the starting assumption. | 736 // is set, which is kind of the starting assumption. |
| 737 // See http://code.google.com/p/webrtc/issues/detail?id=468 for one | 737 // See http://code.google.com/p/webrtc/issues/detail?id=468 for one |
| 738 // situation where this caused confusion. | 738 // situation where this caused confusion. |
| 739 TEST_F(RtcpSenderTest, SendsTmmbnIfSetAndEmpty) { | 739 TEST_F(RtcpSenderTest, SendsTmmbnIfSetAndEmpty) { |
| 740 rtcp_sender_->SetRTCPStatus(RtcpMode::kCompound); | 740 rtcp_sender_->SetRTCPStatus(RtcpMode::kCompound); |
| 741 TMMBRSet bounding_set; | 741 TMMBRSet bounding_set; |
| 742 EXPECT_EQ(0, rtcp_sender_->SetTMMBN(&bounding_set, 3)); | 742 EXPECT_EQ(0, rtcp_sender_->SetTMMBN(&bounding_set)); |
| 743 EXPECT_EQ(0, rtcp_sender_->SendRTCP(feedback_state(), kRtcpSr)); | 743 EXPECT_EQ(0, rtcp_sender_->SendRTCP(feedback_state(), kRtcpSr)); |
| 744 EXPECT_EQ(1, parser()->sender_report()->num_packets()); | 744 EXPECT_EQ(1, parser()->sender_report()->num_packets()); |
| 745 EXPECT_EQ(1, parser()->tmmbn()->num_packets()); | 745 EXPECT_EQ(1, parser()->tmmbn()->num_packets()); |
| 746 EXPECT_EQ(kSenderSsrc, parser()->tmmbn()->Ssrc()); | 746 EXPECT_EQ(kSenderSsrc, parser()->tmmbn()->Ssrc()); |
| 747 EXPECT_EQ(0, parser()->tmmbn_items()->num_packets()); | 747 EXPECT_EQ(0, parser()->tmmbn_items()->num_packets()); |
| 748 } | 748 } |
| 749 | 749 |
| 750 TEST_F(RtcpSenderTest, SendCompoundPliRemb) { | 750 TEST_F(RtcpSenderTest, SendCompoundPliRemb) { |
| 751 const int kBitrate = 261011; | 751 const int kBitrate = 261011; |
| 752 std::vector<uint32_t> ssrcs; | 752 std::vector<uint32_t> ssrcs; |
| 753 ssrcs.push_back(kRemoteSsrc); | 753 ssrcs.push_back(kRemoteSsrc); |
| 754 rtcp_sender_->SetRTCPStatus(RtcpMode::kCompound); | 754 rtcp_sender_->SetRTCPStatus(RtcpMode::kCompound); |
| 755 rtcp_sender_->SetREMBData(kBitrate, ssrcs); | 755 rtcp_sender_->SetREMBData(kBitrate, ssrcs); |
| 756 std::set<RTCPPacketType> packet_types; | 756 std::set<RTCPPacketType> packet_types; |
| 757 packet_types.insert(kRtcpRemb); | 757 packet_types.insert(kRtcpRemb); |
| 758 packet_types.insert(kRtcpPli); | 758 packet_types.insert(kRtcpPli); |
| 759 EXPECT_EQ(0, rtcp_sender_->SendCompoundRTCP(feedback_state(), packet_types)); | 759 EXPECT_EQ(0, rtcp_sender_->SendCompoundRTCP(feedback_state(), packet_types)); |
| 760 EXPECT_EQ(1, parser()->remb_item()->num_packets()); | 760 EXPECT_EQ(1, parser()->remb_item()->num_packets()); |
| 761 EXPECT_EQ(1, parser()->pli()->num_packets()); | 761 EXPECT_EQ(1, parser()->pli()->num_packets()); |
| 762 } | 762 } |
| 763 | 763 |
| 764 } // namespace webrtc | 764 } // namespace webrtc |
| OLD | NEW |