diff --git a/webrtc/call.h b/webrtc/call.h index 43ce4c182e..f21425fb99 100644 --- a/webrtc/call.h +++ b/webrtc/call.h @@ -66,7 +66,9 @@ class Call { send_transport(send_transport), voice_engine(NULL), overuse_callback(NULL), - start_bitrate_bps(-1) {} + stream_start_bitrate_bps(kDefaultStartBitrateBps) {} + + static const int kDefaultStartBitrateBps; webrtc::Config* webrtc_config; @@ -79,10 +81,11 @@ class Call { // captured frames. 'NULL' disables the callback. LoadObserver* overuse_callback; - // Start bitrate used before a valid bitrate estimate is calculated. '-1' - // lets the call decide start bitrate. - // Note: This currently only affects video. - int start_bitrate_bps; + // Start bitrate used before a valid bitrate estimate is calculated. + // Note: This is currently set only for video and is per-stream rather of + // for the entire link. + // TODO(pbos): Set start bitrate for entire Call. + int stream_start_bitrate_bps; }; static Call* Create(const Call::Config& config); diff --git a/webrtc/video/call.cc b/webrtc/video/call.cc index 3ca56b6d23..38c3faa8e3 100644 --- a/webrtc/video/call.cc +++ b/webrtc/video/call.cc @@ -54,6 +54,8 @@ VideoEncoder* VideoEncoder::Create(VideoEncoder::EncoderType codec_type) { return NULL; } +const int Call::Config::kDefaultStartBitrateBps = 300000; + namespace internal { class CpuOveruseObserverProxy : public webrtc::CpuOveruseObserver { @@ -153,8 +155,6 @@ Call* Call::Create(const Call::Config& config) { namespace internal { -const int kDefaultVideoStreamBitrateBps = 300000; - Call::Call(webrtc::VideoEngine* video_engine, const Call::Config& config) : config_(config), network_enabled_crit_(CriticalSectionWrapper::CreateCriticalSection()), @@ -203,16 +203,15 @@ VideoSendStream* Call::CreateVideoSendStream( // TODO(mflodman): Base the start bitrate on a current bandwidth estimate, if // the call has already started. - VideoSendStream* send_stream = new VideoSendStream( - config_.send_transport, - overuse_observer_proxy_.get(), - video_engine_, - config, - encoder_config, - suspended_send_ssrcs_, - base_channel_id_, - config_.start_bitrate_bps != -1 ? config_.start_bitrate_bps - : kDefaultVideoStreamBitrateBps); + VideoSendStream* send_stream = + new VideoSendStream(config_.send_transport, + overuse_observer_proxy_.get(), + video_engine_, + config, + encoder_config, + suspended_send_ssrcs_, + base_channel_id_, + config_.stream_start_bitrate_bps); // This needs to be taken before send_crit_ as both locks need to be held // while changing network state. diff --git a/webrtc/video/loopback.cc b/webrtc/video/loopback.cc index 488adf41d1..ffc5bcc51c 100644 --- a/webrtc/video/loopback.cc +++ b/webrtc/video/loopback.cc @@ -104,7 +104,7 @@ void Loopback() { pipe_config.delay_standard_deviation_ms = flags::StdPropagationDelayMs(); test::DirectTransport transport(pipe_config); Call::Config call_config(&transport); - call_config.start_bitrate_bps = + call_config.stream_start_bitrate_bps = static_cast(flags::StartBitrate()) * 1000; scoped_ptr call(Call::Create(call_config)); diff --git a/webrtc/video/rampup_tests.cc b/webrtc/video/rampup_tests.cc index 10bcb7f191..96a22763d3 100644 --- a/webrtc/video/rampup_tests.cc +++ b/webrtc/video/rampup_tests.cc @@ -402,7 +402,7 @@ void RampUpTest::RunRampUpTest(bool rtx, Call::Config call_config(&stream_observer); if (start_bitrate_bps != 0) { - call_config.start_bitrate_bps = start_bitrate_bps; + call_config.stream_start_bitrate_bps = start_bitrate_bps; stream_observer.set_start_bitrate_bps(start_bitrate_bps); }