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

Side by Side Diff: webrtc/video/video_send_stream_tests.cc

Issue 1813763005: Updated structures and functions for setting the max bitrate limit to take rtc::Optional<int> Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: More code review feedback Created 4 years, 9 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) 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 1776 matching lines...) Expand 10 before | Expand all | Expand 10 after
1787 ++num_initializations_; 1787 ++num_initializations_;
1788 init_encode_event_.Set(); 1788 init_encode_event_.Set();
1789 return FakeEncoder::InitEncode(codecSettings, numberOfCores, 1789 return FakeEncoder::InitEncode(codecSettings, numberOfCores,
1790 maxPayloadSize); 1790 maxPayloadSize);
1791 } 1791 }
1792 1792
1793 Call::Config GetSenderCallConfig() override { 1793 Call::Config GetSenderCallConfig() override {
1794 Call::Config config; 1794 Call::Config config;
1795 config.bitrate_config.min_bitrate_bps = kMinBitrateKbps * 1000; 1795 config.bitrate_config.min_bitrate_bps = kMinBitrateKbps * 1000;
1796 config.bitrate_config.start_bitrate_bps = kStartBitrateKbps * 1000; 1796 config.bitrate_config.start_bitrate_bps = kStartBitrateKbps * 1000;
1797 config.bitrate_config.max_bitrate_bps = kMaxBitrateKbps * 1000; 1797 config.bitrate_config.max_bitrate_bps =
1798 rtc::Optional<int>(kMaxBitrateKbps * 1000);
1798 return config; 1799 return config;
1799 } 1800 }
1800 1801
1801 void ModifyVideoConfigs( 1802 void ModifyVideoConfigs(
1802 VideoSendStream::Config* send_config, 1803 VideoSendStream::Config* send_config,
1803 std::vector<VideoReceiveStream::Config>* receive_configs, 1804 std::vector<VideoReceiveStream::Config>* receive_configs,
1804 VideoEncoderConfig* encoder_config) override { 1805 VideoEncoderConfig* encoder_config) override {
1805 send_config->encoder_settings.encoder = this; 1806 send_config->encoder_settings.encoder = this;
1806 // Set bitrates lower/higher than min/max to make sure they are properly 1807 // Set bitrates lower/higher than min/max to make sure they are properly
1807 // capped. 1808 // capped.
(...skipping 11 matching lines...) Expand all
1819 const std::vector<VideoReceiveStream*>& receive_streams) override { 1820 const std::vector<VideoReceiveStream*>& receive_streams) override {
1820 send_stream_ = send_stream; 1821 send_stream_ = send_stream;
1821 } 1822 }
1822 1823
1823 void PerformTest() override { 1824 void PerformTest() override {
1824 ASSERT_TRUE( 1825 ASSERT_TRUE(
1825 init_encode_event_.Wait(VideoSendStreamTest::kDefaultTimeoutMs)) 1826 init_encode_event_.Wait(VideoSendStreamTest::kDefaultTimeoutMs))
1826 << "Timed out while waiting encoder to be configured."; 1827 << "Timed out while waiting encoder to be configured.";
1827 Call::Config::BitrateConfig bitrate_config; 1828 Call::Config::BitrateConfig bitrate_config;
1828 bitrate_config.start_bitrate_bps = kIncreasedStartBitrateKbps * 1000; 1829 bitrate_config.start_bitrate_bps = kIncreasedStartBitrateKbps * 1000;
1829 bitrate_config.max_bitrate_bps = kIncreasedMaxBitrateKbps * 1000; 1830 bitrate_config.max_bitrate_bps =
1831 rtc::Optional<int>(kIncreasedMaxBitrateKbps * 1000);
1830 call_->SetBitrateConfig(bitrate_config); 1832 call_->SetBitrateConfig(bitrate_config);
1831 EXPECT_TRUE(Wait()) 1833 EXPECT_TRUE(Wait())
1832 << "Timed out while waiting encoder to be configured."; 1834 << "Timed out while waiting encoder to be configured.";
1833 encoder_config_.streams[0].min_bitrate_bps = 0; 1835 encoder_config_.streams[0].min_bitrate_bps = 0;
1834 encoder_config_.streams[0].max_bitrate_bps = kLowerMaxBitrateKbps * 1000; 1836 encoder_config_.streams[0].max_bitrate_bps = kLowerMaxBitrateKbps * 1000;
1835 send_stream_->ReconfigureVideoEncoder(encoder_config_); 1837 send_stream_->ReconfigureVideoEncoder(encoder_config_);
1836 ASSERT_TRUE( 1838 ASSERT_TRUE(
1837 init_encode_event_.Wait(VideoSendStreamTest::kDefaultTimeoutMs)); 1839 init_encode_event_.Wait(VideoSendStreamTest::kDefaultTimeoutMs));
1838 EXPECT_EQ(2, num_initializations_) 1840 EXPECT_EQ(2, num_initializations_)
1839 << "Encoder should have been reconfigured with the new value."; 1841 << "Encoder should have been reconfigured with the new value.";
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
2344 observation_complete_.Set(); 2346 observation_complete_.Set();
2345 } 2347 }
2346 } 2348 }
2347 } test; 2349 } test;
2348 2350
2349 RunBaseTest(&test); 2351 RunBaseTest(&test);
2350 } 2352 }
2351 #endif 2353 #endif
2352 2354
2353 } // namespace webrtc 2355 } // namespace webrtc
OLDNEW
« webrtc/media/engine/webrtcvoiceengine.cc ('K') | « webrtc/video/video_loopback.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698