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

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

Issue 2531383002: Wire up BitrateAllocation to be sent as RTCP TargetBitrate (Closed)
Patch Set: Undo crit removal Created 4 years 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 803 matching lines...) Expand 10 before | Expand all | Expand 10 after
814 rtcp_sender_->SetTimestampOffset(kStartRtpTimestamp); 814 rtcp_sender_->SetTimestampOffset(kStartRtpTimestamp);
815 rtcp_sender_->SetLastRtpTime(kRtpTimestamp, clock_.TimeInMilliseconds()); 815 rtcp_sender_->SetLastRtpTime(kRtpTimestamp, clock_.TimeInMilliseconds());
816 816
817 // Set up XR VoIP metric to be included with BYE 817 // Set up XR VoIP metric to be included with BYE
818 rtcp_sender_->SetRTCPStatus(RtcpMode::kCompound); 818 rtcp_sender_->SetRTCPStatus(RtcpMode::kCompound);
819 RTCPVoIPMetric metric; 819 RTCPVoIPMetric metric;
820 EXPECT_EQ(0, rtcp_sender_->SetRTCPVoIPMetrics(&metric)); 820 EXPECT_EQ(0, rtcp_sender_->SetRTCPVoIPMetrics(&metric));
821 EXPECT_EQ(0, rtcp_sender_->SendRTCP(feedback_state(), kRtcpBye)); 821 EXPECT_EQ(0, rtcp_sender_->SendRTCP(feedback_state(), kRtcpBye));
822 } 822 }
823 823
824 TEST_F(RtcpSenderTest, SendXrWithTargetBitrate) {
825 rtcp_sender_->SetRTCPStatus(RtcpMode::kCompound);
826 const int kNumSpatialLayers = 2;
827 const int kNumTemporalLayers = 2;
828 BitrateAllocation allocation;
829 for (int sl = 0; sl < kNumSpatialLayers; ++sl) {
830 uint32_t start_bitrate_bps = (sl + 1) * 100000;
831 for (int tl = 0; tl < kNumTemporalLayers; ++tl)
832 allocation.SetBitrate(sl, tl, start_bitrate_bps + (tl * 20000));
833 }
834 rtcp_sender_->SetVideoBitrateAllocation(allocation);
835
836 EXPECT_EQ(0, rtcp_sender_->SendRTCP(feedback_state(), kRtcpReport));
837 EXPECT_EQ(1, parser()->xr()->num_packets());
838 EXPECT_EQ(kSenderSsrc, parser()->xr()->sender_ssrc());
839 const rtc::Optional<rtcp::TargetBitrate>& target_bitrate =
840 parser()->xr()->target_bitrate();
841 ASSERT_TRUE(target_bitrate);
842 const std::vector<rtcp::TargetBitrate::BitrateItem>& bitrates =
843 target_bitrate->GetTargetBitrates();
844 EXPECT_EQ(static_cast<size_t>(kNumSpatialLayers * kNumTemporalLayers),
845 bitrates.size());
846
847 for (int sl = 0; sl < kNumSpatialLayers; ++sl) {
848 uint32_t start_bitrate_bps = (sl + 1) * 100000;
849 for (int tl = 0; tl < kNumTemporalLayers; ++tl) {
850 int index = (sl * kNumSpatialLayers) + tl;
851 const rtcp::TargetBitrate::BitrateItem& item = bitrates[index];
852 EXPECT_EQ(sl, item.spatial_layer);
853 EXPECT_EQ(tl, item.temporal_layer);
854 EXPECT_EQ(start_bitrate_bps + (tl * 20000),
855 item.target_bitrate_kbps * 1000);
856 }
857 }
858 }
859
824 } // namespace webrtc 860 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtcp_sender.cc ('k') | webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698