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

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

Issue 1746773002: [rtp_rtcp] tmmbr helper simplified by moving set_to_send member out (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 9 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
(...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after
689 } 689 }
690 690
691 TEST_F(RtcpSenderTest, SendTmmbn) { 691 TEST_F(RtcpSenderTest, SendTmmbn) {
692 rtcp_sender_->SetRTCPStatus(RtcpMode::kCompound); 692 rtcp_sender_->SetRTCPStatus(RtcpMode::kCompound);
693 TMMBRSet bounding_set; 693 TMMBRSet bounding_set;
694 bounding_set.VerifyAndAllocateSet(1); 694 bounding_set.VerifyAndAllocateSet(1);
695 const uint32_t kBitrateKbps = 32768; 695 const uint32_t kBitrateKbps = 32768;
696 const uint32_t kPacketOh = 40; 696 const uint32_t kPacketOh = 40;
697 const uint32_t kSourceSsrc = 12345; 697 const uint32_t kSourceSsrc = 12345;
698 bounding_set.AddEntry(kBitrateKbps, kPacketOh, kSourceSsrc); 698 bounding_set.AddEntry(kBitrateKbps, kPacketOh, kSourceSsrc);
699 EXPECT_EQ(0, rtcp_sender_->SetTMMBN(&bounding_set)); 699 rtcp_sender_->SetTMMBN(&bounding_set);
700 EXPECT_EQ(0, rtcp_sender_->SendRTCP(feedback_state(), kRtcpSr)); 700 EXPECT_EQ(0, rtcp_sender_->SendRTCP(feedback_state(), kRtcpSr));
701 EXPECT_EQ(1, parser()->sender_report()->num_packets()); 701 EXPECT_EQ(1, parser()->sender_report()->num_packets());
702 EXPECT_EQ(1, parser()->tmmbn()->num_packets()); 702 EXPECT_EQ(1, parser()->tmmbn()->num_packets());
703 EXPECT_EQ(kSenderSsrc, parser()->tmmbn()->Ssrc()); 703 EXPECT_EQ(kSenderSsrc, parser()->tmmbn()->Ssrc());
704 EXPECT_EQ(1, parser()->tmmbn_items()->num_packets()); 704 EXPECT_EQ(1, parser()->tmmbn_items()->num_packets());
705 EXPECT_EQ(kBitrateKbps, parser()->tmmbn_items()->BitrateKbps(0)); 705 EXPECT_EQ(kBitrateKbps, parser()->tmmbn_items()->BitrateKbps(0));
706 EXPECT_EQ(kPacketOh, parser()->tmmbn_items()->Overhead(0)); 706 EXPECT_EQ(kPacketOh, parser()->tmmbn_items()->Overhead(0));
707 EXPECT_EQ(kSourceSsrc, parser()->tmmbn_items()->Ssrc(0)); 707 EXPECT_EQ(kSourceSsrc, parser()->tmmbn_items()->Ssrc(0));
708 } 708 }
709 709
710 // This test is written to verify actual behaviour. It does not seem 710 // This test is written to verify actual behaviour. It does not seem
711 // to make much sense to send an empty TMMBN, since there is no place 711 // to make much sense to send an empty TMMBN, since there is no place
712 // to put an actual limit here. It's just information that no limit 712 // to put an actual limit here. It's just information that no limit
713 // is set, which is kind of the starting assumption. 713 // is set, which is kind of the starting assumption.
714 // See http://code.google.com/p/webrtc/issues/detail?id=468 for one 714 // See http://code.google.com/p/webrtc/issues/detail?id=468 for one
715 // situation where this caused confusion. 715 // situation where this caused confusion.
716 TEST_F(RtcpSenderTest, SendsTmmbnIfSetAndEmpty) { 716 TEST_F(RtcpSenderTest, SendsTmmbnIfSetAndEmpty) {
717 rtcp_sender_->SetRTCPStatus(RtcpMode::kCompound); 717 rtcp_sender_->SetRTCPStatus(RtcpMode::kCompound);
718 TMMBRSet bounding_set; 718 TMMBRSet bounding_set;
719 EXPECT_EQ(0, rtcp_sender_->SetTMMBN(&bounding_set)); 719 rtcp_sender_->SetTMMBN(&bounding_set);
720 EXPECT_EQ(0, rtcp_sender_->SendRTCP(feedback_state(), kRtcpSr)); 720 EXPECT_EQ(0, rtcp_sender_->SendRTCP(feedback_state(), kRtcpSr));
721 EXPECT_EQ(1, parser()->sender_report()->num_packets()); 721 EXPECT_EQ(1, parser()->sender_report()->num_packets());
722 EXPECT_EQ(1, parser()->tmmbn()->num_packets()); 722 EXPECT_EQ(1, parser()->tmmbn()->num_packets());
723 EXPECT_EQ(kSenderSsrc, parser()->tmmbn()->Ssrc()); 723 EXPECT_EQ(kSenderSsrc, parser()->tmmbn()->Ssrc());
724 EXPECT_EQ(0, parser()->tmmbn_items()->num_packets()); 724 EXPECT_EQ(0, parser()->tmmbn_items()->num_packets());
725 } 725 }
726 726
727 TEST_F(RtcpSenderTest, SendCompoundPliRemb) { 727 TEST_F(RtcpSenderTest, SendCompoundPliRemb) {
728 const int kBitrate = 261011; 728 const int kBitrate = 261011;
729 std::vector<uint32_t> ssrcs; 729 std::vector<uint32_t> ssrcs;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
771 rtcp_sender_->SetRemoteSSRC(kRemoteSsrc); 771 rtcp_sender_->SetRemoteSSRC(kRemoteSsrc);
772 772
773 // Set up XR VoIP metric to be included with BYE 773 // Set up XR VoIP metric to be included with BYE
774 rtcp_sender_->SetRTCPStatus(RtcpMode::kCompound); 774 rtcp_sender_->SetRTCPStatus(RtcpMode::kCompound);
775 RTCPVoIPMetric metric; 775 RTCPVoIPMetric metric;
776 EXPECT_EQ(0, rtcp_sender_->SetRTCPVoIPMetrics(&metric)); 776 EXPECT_EQ(0, rtcp_sender_->SetRTCPVoIPMetrics(&metric));
777 EXPECT_EQ(0, rtcp_sender_->SendRTCP(feedback_state(), kRtcpBye)); 777 EXPECT_EQ(0, rtcp_sender_->SendRTCP(feedback_state(), kRtcpBye));
778 } 778 }
779 779
780 } // namespace webrtc 780 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698