OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 #include <algorithm> // max | 10 #include <algorithm> // max |
(...skipping 1752 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1763 } | 1763 } |
1764 ++num_initializations_; | 1764 ++num_initializations_; |
1765 return FakeEncoder::InitEncode(codecSettings, numberOfCores, | 1765 return FakeEncoder::InitEncode(codecSettings, numberOfCores, |
1766 maxPayloadSize); | 1766 maxPayloadSize); |
1767 } | 1767 } |
1768 | 1768 |
1769 Call::Config GetSenderCallConfig() override { | 1769 Call::Config GetSenderCallConfig() override { |
1770 Call::Config config; | 1770 Call::Config config; |
1771 config.bitrate_config.min_bitrate_bps = kMinBitrateKbps * 1000; | 1771 config.bitrate_config.min_bitrate_bps = kMinBitrateKbps * 1000; |
1772 config.bitrate_config.start_bitrate_bps = kStartBitrateKbps * 1000; | 1772 config.bitrate_config.start_bitrate_bps = kStartBitrateKbps * 1000; |
1773 config.bitrate_config.max_bitrate_bps = kMaxBitrateKbps * 1000; | 1773 config.bitrate_config.max_bitrate_bps = |
| 1774 rtc::Optional<int>(kMaxBitrateKbps * 1000); |
1774 return config; | 1775 return config; |
1775 } | 1776 } |
1776 | 1777 |
1777 void ModifyVideoConfigs( | 1778 void ModifyVideoConfigs( |
1778 VideoSendStream::Config* send_config, | 1779 VideoSendStream::Config* send_config, |
1779 std::vector<VideoReceiveStream::Config>* receive_configs, | 1780 std::vector<VideoReceiveStream::Config>* receive_configs, |
1780 VideoEncoderConfig* encoder_config) override { | 1781 VideoEncoderConfig* encoder_config) override { |
1781 send_config->encoder_settings.encoder = this; | 1782 send_config->encoder_settings.encoder = this; |
1782 // Set bitrates lower/higher than min/max to make sure they are properly | 1783 // Set bitrates lower/higher than min/max to make sure they are properly |
1783 // capped. | 1784 // capped. |
1784 encoder_config->streams.front().min_bitrate_bps = kMinBitrateKbps * 1000; | 1785 encoder_config->streams.front().min_bitrate_bps = kMinBitrateKbps * 1000; |
1785 encoder_config->streams.front().max_bitrate_bps = kMaxBitrateKbps * 1000; | 1786 encoder_config->streams.front().max_bitrate_bps = kMaxBitrateKbps * 1000; |
1786 encoder_config_ = *encoder_config; | 1787 encoder_config_ = *encoder_config; |
1787 } | 1788 } |
1788 | 1789 |
1789 void OnCallsCreated(Call* sender_call, Call* receiver_call) override { | 1790 void OnCallsCreated(Call* sender_call, Call* receiver_call) override { |
1790 call_ = sender_call; | 1791 call_ = sender_call; |
1791 } | 1792 } |
1792 | 1793 |
1793 void OnVideoStreamsCreated( | 1794 void OnVideoStreamsCreated( |
1794 VideoSendStream* send_stream, | 1795 VideoSendStream* send_stream, |
1795 const std::vector<VideoReceiveStream*>& receive_streams) override { | 1796 const std::vector<VideoReceiveStream*>& receive_streams) override { |
1796 send_stream_ = send_stream; | 1797 send_stream_ = send_stream; |
1797 } | 1798 } |
1798 | 1799 |
1799 void PerformTest() override { | 1800 void PerformTest() override { |
1800 Call::Config::BitrateConfig bitrate_config; | 1801 Call::Config::BitrateConfig bitrate_config; |
1801 bitrate_config.start_bitrate_bps = kIncreasedStartBitrateKbps * 1000; | 1802 bitrate_config.start_bitrate_bps = kIncreasedStartBitrateKbps * 1000; |
1802 bitrate_config.max_bitrate_bps = kIncreasedMaxBitrateKbps * 1000; | 1803 bitrate_config.max_bitrate_bps = |
| 1804 rtc::Optional<int>(kIncreasedMaxBitrateKbps * 1000); |
1803 call_->SetBitrateConfig(bitrate_config); | 1805 call_->SetBitrateConfig(bitrate_config); |
1804 EXPECT_TRUE(Wait()) | 1806 EXPECT_TRUE(Wait()) |
1805 << "Timed out while waiting encoder to be configured."; | 1807 << "Timed out while waiting encoder to be configured."; |
1806 encoder_config_.streams[0].min_bitrate_bps = 0; | 1808 encoder_config_.streams[0].min_bitrate_bps = 0; |
1807 encoder_config_.streams[0].max_bitrate_bps = kLowerMaxBitrateKbps * 1000; | 1809 encoder_config_.streams[0].max_bitrate_bps = kLowerMaxBitrateKbps * 1000; |
1808 send_stream_->ReconfigureVideoEncoder(encoder_config_); | 1810 send_stream_->ReconfigureVideoEncoder(encoder_config_); |
1809 EXPECT_EQ(2, num_initializations_) | 1811 EXPECT_EQ(2, num_initializations_) |
1810 << "Encoder should have been reconfigured with the new value."; | 1812 << "Encoder should have been reconfigured with the new value."; |
1811 encoder_config_.streams[0].target_bitrate_bps = | 1813 encoder_config_.streams[0].target_bitrate_bps = |
1812 encoder_config_.streams[0].min_bitrate_bps; | 1814 encoder_config_.streams[0].min_bitrate_bps; |
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2312 observation_complete_.Set(); | 2314 observation_complete_.Set(); |
2313 } | 2315 } |
2314 } | 2316 } |
2315 } test; | 2317 } test; |
2316 | 2318 |
2317 RunBaseTest(&test); | 2319 RunBaseTest(&test); |
2318 } | 2320 } |
2319 #endif | 2321 #endif |
2320 | 2322 |
2321 } // namespace webrtc | 2323 } // namespace webrtc |
OLD | NEW |