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

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

Issue 2546713002: Wire up RTCP XR target bitrate in rtp/rtcp module (Closed)
Patch Set: Addressed comments 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 size_t kNumSpatialLayers = 2;
827 const size_t kNumTemporalLayers = 2;
828 BitrateAllocation allocation;
829 for (size_t sl = 0; sl < kNumSpatialLayers; ++sl) {
830 uint32_t start_bitrate_bps = (sl + 1) * 100000;
831 for (size_t 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(kNumSpatialLayers * kNumTemporalLayers, bitrates.size());
845
846 for (size_t sl = 0; sl < kNumSpatialLayers; ++sl) {
847 uint32_t start_bitrate_bps = (sl + 1) * 100000;
848 for (size_t tl = 0; tl < kNumTemporalLayers; ++tl) {
849 size_t index = (sl * kNumSpatialLayers) + tl;
850 const rtcp::TargetBitrate::BitrateItem& item = bitrates[index];
851 EXPECT_EQ(sl, item.spatial_layer);
852 EXPECT_EQ(tl, item.temporal_layer);
853 EXPECT_EQ(start_bitrate_bps + (tl * 20000),
854 item.target_bitrate_kbps * 1000);
855 }
856 }
857 }
858
824 } // namespace webrtc 859 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698