Set min and max rate on caller and on callee side.

BUG=webrtc:6518

Review-Url: https://codereview.webrtc.org/2410903002
Cr-Commit-Position: refs/heads/master@{#14666}
This commit is contained in:
michaelt 2016-10-18 09:39:22 -07:00 committed by Commit bot
parent 64e1a32e2f
commit 53fe19d6f3

View File

@ -1171,38 +1171,16 @@ class WebRtcVoiceMediaChannel::WebRtcAudioSendStream
void RecreateAudioSendStream(const SendCodecSpec& send_codec_spec) {
RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
if (stream_) {
call_->DestroyAudioSendStream(stream_);
stream_ = nullptr;
}
config_.rtp.nack.rtp_history_ms =
send_codec_spec.nack_enabled ? kNackRtpHistoryMs : 0;
RTC_DCHECK(!stream_);
stream_ = call_->CreateAudioSendStream(config_);
RTC_CHECK(stream_);
UpdateSendState();
RecreateAudioSendStream();
}
void RecreateAudioSendStream(
const std::vector<webrtc::RtpExtension>& extensions) {
RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
if (stream_) {
call_->DestroyAudioSendStream(stream_);
stream_ = nullptr;
}
config_.rtp.extensions = extensions;
if (webrtc::field_trial::FindFullName("WebRTC-AdaptAudioBitrate") ==
"Enabled") {
// TODO(mflodman): Keep testing this and set proper values.
// Note: This is an early experiment currently only supported by Opus.
config_.min_bitrate_kbps = kOpusMinBitrate;
config_.max_bitrate_kbps = kOpusBitrateFb;
}
RTC_DCHECK(!stream_);
stream_ = call_->CreateAudioSendStream(config_);
RTC_CHECK(stream_);
UpdateSendState();
RecreateAudioSendStream();
}
bool SendTelephoneEvent(int payload_type, int event, int duration_ms) {
@ -1316,6 +1294,25 @@ class WebRtcVoiceMediaChannel::WebRtcAudioSendStream
}
}
void RecreateAudioSendStream() {
RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
if (stream_) {
call_->DestroyAudioSendStream(stream_);
stream_ = nullptr;
}
RTC_DCHECK(!stream_);
if (webrtc::field_trial::FindFullName("WebRTC-AdaptAudioBitrate") ==
"Enabled") {
// TODO(mflodman): Keep testing this and set proper values.
// Note: This is an early experiment currently only supported by Opus.
config_.min_bitrate_kbps = kOpusMinBitrate;
config_.max_bitrate_kbps = kOpusBitrateFb;
}
stream_ = call_->CreateAudioSendStream(config_);
RTC_CHECK(stream_);
UpdateSendState();
}
rtc::ThreadChecker worker_thread_checker_;
rtc::RaceChecker audio_capture_race_checker_;
webrtc::AudioTransport* const voe_audio_transport_ = nullptr;