Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(861)

Unified Diff: webrtc/voice_engine/channel.cc

Issue 2518923003: Pass time constant to bwe smoothing filter. (Closed)
Patch Set: Removed Optional in SetBitrate Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/voice_engine/channel.cc
diff --git a/webrtc/voice_engine/channel.cc b/webrtc/voice_engine/channel.cc
index f3021fef6fec31f8e727fa3698158628dc1d89ee..375a02d2e7801d9828e0b39e811b751419ac2da3 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,13 @@ 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 an
+ // exponential filter (bitrate_smoother use an exponential filter) with the
minyue-webrtc 2016/11/28 12:00:00 merge this line with up
michaelt 2016/11/28 13:03:38 Changed description according to the offline discu
+ // length of probing_interval and an amplitude of 1.
minyue-webrtc 2016/11/28 12:00:00 and put |var| around variables, no need in equatio
michaelt 2016/11/28 13:03:37 Changed description according to the offline discu
+ // 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) {

Powered by Google App Engine
This is Rietveld 408576698