Remove -1 from Call::Config::start_bitrate_bps.

Instead initialize it to a good default value. The code does the same,
but we don't have to check explicitly for -1.

R=mflodman@webrtc.org
BUG=

Review URL: https://webrtc-codereview.appspot.com/23989004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@7445 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
pbos@webrtc.org 2014-10-14 11:52:10 +00:00
parent eb24b04f16
commit a73a678e25
4 changed files with 21 additions and 19 deletions

View File

@ -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);

View File

@ -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.

View File

@ -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<int>(flags::StartBitrate()) * 1000;
scoped_ptr<Call> call(Call::Create(call_config));

View File

@ -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);
}