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

Side by Side 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: Make "b=AS" take priority over "x-google-max-bitrate" for BWE max bitrate. Created 4 years, 7 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) 2004 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2004 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 2372 matching lines...) Expand 10 before | Expand all | Expand 10 after
2383 TEST_F(WebRtcVideoChannel2Test, SetSendCodecsCapsMinAndStartBitrate) { 2383 TEST_F(WebRtcVideoChannel2Test, SetSendCodecsCapsMinAndStartBitrate) {
2384 SetSendCodecsShouldWorkForBitrates("-1", 0, "-100", -1, "", -1); 2384 SetSendCodecsShouldWorkForBitrates("-1", 0, "-100", -1, "", -1);
2385 } 2385 }
2386 2386
2387 TEST_F(WebRtcVideoChannel2Test, SetSendCodecsRejectsMaxLessThanMinBitrate) { 2387 TEST_F(WebRtcVideoChannel2Test, SetSendCodecsRejectsMaxLessThanMinBitrate) {
2388 send_parameters_.codecs[0].params[kCodecParamMinBitrate] = "300"; 2388 send_parameters_.codecs[0].params[kCodecParamMinBitrate] = "300";
2389 send_parameters_.codecs[0].params[kCodecParamMaxBitrate] = "200"; 2389 send_parameters_.codecs[0].params[kCodecParamMaxBitrate] = "200";
2390 EXPECT_FALSE(channel_->SetSendParameters(send_parameters_)); 2390 EXPECT_FALSE(channel_->SetSendParameters(send_parameters_));
2391 } 2391 }
2392 2392
2393 // Test that when both the codec-specific bitrate params and max_bandwidth_bps
2394 // are present in the same send parameters, the settings are combined correctly.
2395 TEST_F(WebRtcVideoChannel2Test, SetSendCodecsWithBitratesAndMaxSendBandwidth) {
2396 send_parameters_.codecs[0].params[kCodecParamMinBitrate] = "100";
2397 send_parameters_.codecs[0].params[kCodecParamStartBitrate] = "200";
2398 send_parameters_.codecs[0].params[kCodecParamMaxBitrate] = "300";
2399 send_parameters_.max_bandwidth_bps = 400000;
2400 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_));
2401 EXPECT_EQ(100000, fake_call_->GetConfig().bitrate_config.min_bitrate_bps);
2402 EXPECT_EQ(200000, fake_call_->GetConfig().bitrate_config.start_bitrate_bps);
2403 // We expect max_bandwidth_bps to take priority, if set.
2404 EXPECT_EQ(400000, fake_call_->GetConfig().bitrate_config.max_bitrate_bps);
2405
2406 // Decrease max_bandwidth_bps.
2407 send_parameters_.max_bandwidth_bps = 350000;
2408 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_));
2409 EXPECT_EQ(100000, fake_call_->GetConfig().bitrate_config.min_bitrate_bps);
2410 // Since the codec isn't changing, start_bitrate_bps should be -1.
2411 EXPECT_EQ(-1, fake_call_->GetConfig().bitrate_config.start_bitrate_bps);
2412 EXPECT_EQ(350000, fake_call_->GetConfig().bitrate_config.max_bitrate_bps);
2413
2414 // Now try again with the values flipped around.
2415 send_parameters_.codecs[0].params[kCodecParamMaxBitrate] = "400";
2416 send_parameters_.max_bandwidth_bps = 300000;
2417 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_));
2418 EXPECT_EQ(100000, fake_call_->GetConfig().bitrate_config.min_bitrate_bps);
2419 EXPECT_EQ(200000, fake_call_->GetConfig().bitrate_config.start_bitrate_bps);
2420 EXPECT_EQ(300000, fake_call_->GetConfig().bitrate_config.max_bitrate_bps);
2421
2422 // If we change the codec max, max_bandwidth_bps should still apply.
2423 send_parameters_.codecs[0].params[kCodecParamMaxBitrate] = "350";
2424 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_));
2425 EXPECT_EQ(100000, fake_call_->GetConfig().bitrate_config.min_bitrate_bps);
2426 EXPECT_EQ(200000, fake_call_->GetConfig().bitrate_config.start_bitrate_bps);
2427 EXPECT_EQ(300000, fake_call_->GetConfig().bitrate_config.max_bitrate_bps);
2428 }
2429
2393 TEST_F(WebRtcVideoChannel2Test, 2430 TEST_F(WebRtcVideoChannel2Test,
2394 SetMaxSendBandwidthShouldPreserveOtherBitrates) { 2431 SetMaxSendBandwidthShouldPreserveOtherBitrates) {
2395 SetSendCodecsShouldWorkForBitrates("100", 100000, "150", 150000, "200", 2432 SetSendCodecsShouldWorkForBitrates("100", 100000, "150", 150000, "200",
2396 200000); 2433 200000);
2397 send_parameters_.max_bandwidth_bps = 300000; 2434 send_parameters_.max_bandwidth_bps = 300000;
2398 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_)); 2435 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_));
2399 EXPECT_EQ(100000, fake_call_->GetConfig().bitrate_config.min_bitrate_bps) 2436 EXPECT_EQ(100000, fake_call_->GetConfig().bitrate_config.min_bitrate_bps)
2400 << "Setting max bitrate should keep previous min bitrate."; 2437 << "Setting max bitrate should keep previous min bitrate.";
2401 EXPECT_EQ(-1, fake_call_->GetConfig().bitrate_config.start_bitrate_bps) 2438 EXPECT_EQ(-1, fake_call_->GetConfig().bitrate_config.start_bitrate_bps)
2402 << "Setting max bitrate should not reset start bitrate."; 2439 << "Setting max bitrate should not reset start bitrate.";
(...skipping 1247 matching lines...) Expand 10 before | Expand all | Expand 10 after
3650 } 3687 }
3651 3688
3652 // Test that we normalize send codec format size in simulcast. 3689 // Test that we normalize send codec format size in simulcast.
3653 TEST_F(WebRtcVideoChannel2SimulcastTest, SetSendCodecsWithOddSizeInSimulcast) { 3690 TEST_F(WebRtcVideoChannel2SimulcastTest, SetSendCodecsWithOddSizeInSimulcast) {
3654 cricket::VideoCodec codec(kVp8Codec270p); 3691 cricket::VideoCodec codec(kVp8Codec270p);
3655 codec.width += 1; 3692 codec.width += 1;
3656 codec.height += 1; 3693 codec.height += 1;
3657 VerifySimulcastSettings(codec, 2, 2); 3694 VerifySimulcastSettings(codec, 2, 2);
3658 } 3695 }
3659 } // namespace cricket 3696 } // namespace cricket
OLDNEW
« webrtc/media/engine/webrtcvideoengine2.cc ('K') | « webrtc/media/engine/webrtcvideoengine2.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698