Index: webrtc/voice_engine/channel.cc |
diff --git a/webrtc/voice_engine/channel.cc b/webrtc/voice_engine/channel.cc |
index f3021fef6fec31f8e727fa3698158628dc1d89ee..adc4e3618b60bab8e6159c1b73cf7c4d9b817647 100644 |
--- a/webrtc/voice_engine/channel.cc |
+++ b/webrtc/voice_engine/channel.cc |
@@ -1304,7 +1304,7 @@ int32_t Channel::SetSendCodec(const CodecInst& codec) { |
return 0; |
} |
-void Channel::SetBitRate(int bitrate_bps) { |
+void Channel::SetBitRate(int bitrate_bps, 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,10 +1315,14 @@ 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); |
+ // 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 a |
stefan-webrtc
2016/11/24 10:40:45
for an
michaelt
2016/11/24 13:47:18
Done.
|
+ // expensional filter (bitrate_smoother use an exponential filter) with the |
stefan-webrtc
2016/11/24 10:40:46
exponential
michaelt
2016/11/24 13:47:18
Done.
|
+ // length of |
+ // probing_interval and a amplitude of 1. |
stefan-webrtc
2016/11/24 10:40:45
Move to the line above.
an amplitude
michaelt
2016/11/24 13:47:18
Done.
|
+ // 0.22 = 1 - e^(-t/probing_interval * 4) | t = probing_interval. |
+ bitrate_smoother_.SetTimeConstantMs(probing_interval_ms * 4); |
bitrate_smoother_.AddSample(bitrate_bps); |
audio_coding_->ModifyEncoder([&](std::unique_ptr<AudioEncoder>* encoder) { |
if (*encoder) { |