OLD | NEW |
---|---|
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 Loading... | |
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 the video channel to take the minimum of the maximums. | |
2404 EXPECT_EQ(300000, fake_call_->GetConfig().bitrate_config.max_bitrate_bps); | |
2405 | |
2406 // If we decrease max_bandwidth_bps, the codec max should still apply. | |
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 // We expect the video channel to take the minimum of the maximums. | |
2413 EXPECT_EQ(300000, fake_call_->GetConfig().bitrate_config.max_bitrate_bps); | |
2414 | |
2415 // Now try again with the values flipped around. | |
2416 send_parameters_.codecs[0].params[kCodecParamMaxBitrate] = "400"; | |
2417 send_parameters_.max_bandwidth_bps = 300000; | |
2418 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_)); | |
2419 EXPECT_EQ(100000, fake_call_->GetConfig().bitrate_config.min_bitrate_bps); | |
2420 EXPECT_EQ(200000, fake_call_->GetConfig().bitrate_config.start_bitrate_bps); | |
2421 // We expect the video channel to take the minimum of the maximums. | |
2422 EXPECT_EQ(300000, fake_call_->GetConfig().bitrate_config.max_bitrate_bps); | |
2423 | |
2424 // If we decrease the codec max, max_bandwidth_bps should still apply. | |
2425 send_parameters_.codecs[0].params[kCodecParamMaxBitrate] = "350"; | |
2426 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_)); | |
2427 EXPECT_EQ(100000, fake_call_->GetConfig().bitrate_config.min_bitrate_bps); | |
2428 EXPECT_EQ(200000, fake_call_->GetConfig().bitrate_config.start_bitrate_bps); | |
2429 // We expect the video channel to take the minimum of the maximums. | |
2430 EXPECT_EQ(300000, fake_call_->GetConfig().bitrate_config.max_bitrate_bps); | |
2431 } | |
2432 | |
2393 TEST_F(WebRtcVideoChannel2Test, | 2433 TEST_F(WebRtcVideoChannel2Test, |
2394 SetMaxSendBandwidthShouldPreserveOtherBitrates) { | 2434 SetMaxSendBandwidthShouldPreserveOtherBitrates) { |
2395 SetSendCodecsShouldWorkForBitrates("100", 100000, "150", 150000, "200", | 2435 SetSendCodecsShouldWorkForBitrates("100", 100000, "150", 150000, "400", |
2396 200000); | 2436 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
| |
2397 send_parameters_.max_bandwidth_bps = 300000; | 2437 send_parameters_.max_bandwidth_bps = 300000; |
2398 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_)); | 2438 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_)); |
2399 EXPECT_EQ(100000, fake_call_->GetConfig().bitrate_config.min_bitrate_bps) | 2439 EXPECT_EQ(100000, fake_call_->GetConfig().bitrate_config.min_bitrate_bps) |
2400 << "Setting max bitrate should keep previous min bitrate."; | 2440 << "Setting max bitrate should keep previous min bitrate."; |
2401 EXPECT_EQ(-1, fake_call_->GetConfig().bitrate_config.start_bitrate_bps) | 2441 EXPECT_EQ(-1, fake_call_->GetConfig().bitrate_config.start_bitrate_bps) |
2402 << "Setting max bitrate should not reset start bitrate."; | 2442 << "Setting max bitrate should not reset start bitrate."; |
2403 EXPECT_EQ(300000, fake_call_->GetConfig().bitrate_config.max_bitrate_bps); | 2443 EXPECT_EQ(300000, fake_call_->GetConfig().bitrate_config.max_bitrate_bps); |
2404 } | 2444 } |
2405 | 2445 |
2406 TEST_F(WebRtcVideoChannel2Test, SetMaxSendBandwidthShouldBeRemovable) { | 2446 TEST_F(WebRtcVideoChannel2Test, SetMaxSendBandwidthShouldBeRemovable) { |
(...skipping 1243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3650 } | 3690 } |
3651 | 3691 |
3652 // Test that we normalize send codec format size in simulcast. | 3692 // Test that we normalize send codec format size in simulcast. |
3653 TEST_F(WebRtcVideoChannel2SimulcastTest, SetSendCodecsWithOddSizeInSimulcast) { | 3693 TEST_F(WebRtcVideoChannel2SimulcastTest, SetSendCodecsWithOddSizeInSimulcast) { |
3654 cricket::VideoCodec codec(kVp8Codec270p); | 3694 cricket::VideoCodec codec(kVp8Codec270p); |
3655 codec.width += 1; | 3695 codec.width += 1; |
3656 codec.height += 1; | 3696 codec.height += 1; |
3657 VerifySimulcastSettings(codec, 2, 2); | 3697 VerifySimulcastSettings(codec, 2, 2); |
3658 } | 3698 } |
3659 } // namespace cricket | 3699 } // namespace cricket |
OLD | NEW |