| Index: webrtc/voice_engine/channel.cc
|
| diff --git a/webrtc/voice_engine/channel.cc b/webrtc/voice_engine/channel.cc
|
| index f3021fef6fec31f8e727fa3698158628dc1d89ee..81f4c13077be630d7d15022dad7130bd4655bde7 100644
|
| --- a/webrtc/voice_engine/channel.cc
|
| +++ b/webrtc/voice_engine/channel.cc
|
| @@ -1304,7 +1304,8 @@ int32_t Channel::SetSendCodec(const CodecInst& codec) {
|
| return 0;
|
| }
|
|
|
| -void Channel::SetBitRate(int bitrate_bps) {
|
| +void Channel::SetBitRate(int bitrate_bps,
|
| + rtc::Optional<int64_t> probing_interval_ms) {
|
| WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId),
|
| "Channel::SetBitRate(bitrate_bps=%d)", bitrate_bps);
|
| audio_coding_->ModifyEncoder([&](std::unique_ptr<AudioEncoder>* encoder) {
|
| @@ -1315,17 +1316,22 @@ void Channel::SetBitRate(int bitrate_bps) {
|
|
|
| // We give smoothed bitrate allocation to audio network adaptor as
|
| // the uplink bandwidth.
|
| - // TODO(michaelt) : Remove kDefaultBitrateSmoothingTimeConstantMs as soon as
|
| - // we pass the probing interval to this function.
|
| - constexpr int64_t kDefaultBitrateSmoothingTimeConstantMs = 20000;
|
| - bitrate_smoother_.SetTimeConstantMs(kDefaultBitrateSmoothingTimeConstantMs);
|
| - bitrate_smoother_.AddSample(bitrate_bps);
|
| - audio_coding_->ModifyEncoder([&](std::unique_ptr<AudioEncoder>* encoder) {
|
| - if (*encoder) {
|
| - (*encoder)->OnReceivedUplinkBandwidth(
|
| - static_cast<int>(*bitrate_smoother_.GetAverage()));
|
| - }
|
| - });
|
| + // The probing spikes should not affect the bitrate smoother more than 25%.
|
| + // To simplify the calculations we use a step response as input signal.
|
| + // The calculation show a step response for an
|
| + // exponential filter (bitrate_smoother use an exponential filter) with the
|
| + // length of probing_interval and an amplitude of 1.
|
| + // 0.22 = 1 - e^(-t/probing_interval * 4) | t = probing_interval.
|
| + if (probing_interval_ms) {
|
| + bitrate_smoother_.SetTimeConstantMs(*probing_interval_ms * 4);
|
| + bitrate_smoother_.AddSample(bitrate_bps);
|
| + audio_coding_->ModifyEncoder([&](std::unique_ptr<AudioEncoder>* encoder) {
|
| + if (*encoder) {
|
| + (*encoder)->OnReceivedUplinkBandwidth(
|
| + static_cast<int>(*bitrate_smoother_.GetAverage()));
|
| + }
|
| + });
|
| + }
|
| }
|
|
|
| void Channel::OnIncomingFractionLoss(int fraction_lost) {
|
|
|