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

Unified Diff: webrtc/media/engine/webrtcvideoengine2_unittest.cc

Issue 1904063003: Fixing the interaction between codec bitrate limit and "b=AS". (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/media/engine/webrtcvideoengine2.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/media/engine/webrtcvideoengine2_unittest.cc
diff --git a/webrtc/media/engine/webrtcvideoengine2_unittest.cc b/webrtc/media/engine/webrtcvideoengine2_unittest.cc
index b202207f2133a3a75972949f2a47ec019066ed0d..ee7b56ae218138ffc9c27406a8897b28cc1b780a 100644
--- a/webrtc/media/engine/webrtcvideoengine2_unittest.cc
+++ b/webrtc/media/engine/webrtcvideoengine2_unittest.cc
@@ -2390,10 +2390,50 @@ TEST_F(WebRtcVideoChannel2Test, SetSendCodecsRejectsMaxLessThanMinBitrate) {
EXPECT_FALSE(channel_->SetSendParameters(send_parameters_));
}
+// Test that when both the codec-specific bitrate params and max_bandwidth_bps
+// are present in the same send parameters, the settings are combined correctly.
+TEST_F(WebRtcVideoChannel2Test, SetSendCodecsWithBitratesAndMaxSendBandwidth) {
+ send_parameters_.codecs[0].params[kCodecParamMinBitrate] = "100";
+ send_parameters_.codecs[0].params[kCodecParamStartBitrate] = "200";
+ send_parameters_.codecs[0].params[kCodecParamMaxBitrate] = "300";
+ send_parameters_.max_bandwidth_bps = 400000;
+ EXPECT_TRUE(channel_->SetSendParameters(send_parameters_));
+ EXPECT_EQ(100000, fake_call_->GetConfig().bitrate_config.min_bitrate_bps);
+ EXPECT_EQ(200000, fake_call_->GetConfig().bitrate_config.start_bitrate_bps);
+ // We expect the video channel to take the minimum of the maximums.
+ EXPECT_EQ(300000, fake_call_->GetConfig().bitrate_config.max_bitrate_bps);
+
+ // If we decrease max_bandwidth_bps, the codec max should still apply.
+ send_parameters_.max_bandwidth_bps = 350000;
+ EXPECT_TRUE(channel_->SetSendParameters(send_parameters_));
+ EXPECT_EQ(100000, fake_call_->GetConfig().bitrate_config.min_bitrate_bps);
+ // Since the codec isn't changing, start_bitrate_bps should be -1.
+ EXPECT_EQ(-1, fake_call_->GetConfig().bitrate_config.start_bitrate_bps);
+ // We expect the video channel to take the minimum of the maximums.
+ EXPECT_EQ(300000, fake_call_->GetConfig().bitrate_config.max_bitrate_bps);
+
+ // Now try again with the values flipped around.
+ send_parameters_.codecs[0].params[kCodecParamMaxBitrate] = "400";
+ send_parameters_.max_bandwidth_bps = 300000;
+ EXPECT_TRUE(channel_->SetSendParameters(send_parameters_));
+ EXPECT_EQ(100000, fake_call_->GetConfig().bitrate_config.min_bitrate_bps);
+ EXPECT_EQ(200000, fake_call_->GetConfig().bitrate_config.start_bitrate_bps);
+ // We expect the video channel to take the minimum of the maximums.
+ EXPECT_EQ(300000, fake_call_->GetConfig().bitrate_config.max_bitrate_bps);
+
+ // If we decrease the codec max, max_bandwidth_bps should still apply.
+ send_parameters_.codecs[0].params[kCodecParamMaxBitrate] = "350";
+ EXPECT_TRUE(channel_->SetSendParameters(send_parameters_));
+ EXPECT_EQ(100000, fake_call_->GetConfig().bitrate_config.min_bitrate_bps);
+ EXPECT_EQ(200000, fake_call_->GetConfig().bitrate_config.start_bitrate_bps);
+ // We expect the video channel to take the minimum of the maximums.
+ EXPECT_EQ(300000, fake_call_->GetConfig().bitrate_config.max_bitrate_bps);
+}
+
TEST_F(WebRtcVideoChannel2Test,
SetMaxSendBandwidthShouldPreserveOtherBitrates) {
- SetSendCodecsShouldWorkForBitrates("100", 100000, "150", 150000, "200",
- 200000);
+ SetSendCodecsShouldWorkForBitrates("100", 100000, "150", 150000, "400",
+ 400000);
Taylor Brandstetter 2016/04/21 18:44:35 Previously, max_bandwidth_bps was allowed to incre
pbos-webrtc 2016/04/21 18:57:24 Yep, this was intentional, since we can apply FEC
stefan-webrtc 2016/04/27 07:24:41 Yes, what would otherwise happen if you have two s
send_parameters_.max_bandwidth_bps = 300000;
EXPECT_TRUE(channel_->SetSendParameters(send_parameters_));
EXPECT_EQ(100000, fake_call_->GetConfig().bitrate_config.min_bitrate_bps)
« no previous file with comments | « webrtc/media/engine/webrtcvideoengine2.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698