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

Side by Side Diff: webrtc/voice_engine/channel.cc

Issue 2532993002: Revert of Pass time constant to bwe smoothing filter. (Closed)
Patch Set: Created 4 years 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 unified diff | Download patch
« no previous file with comments | « webrtc/voice_engine/channel.h ('k') | webrtc/voice_engine/channel_proxy.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 1283 matching lines...) Expand 10 before | Expand all | Expand 10 after
1294 1294
1295 if (_rtpRtcpModule->SetAudioPacketSize(codec.pacsize) != 0) { 1295 if (_rtpRtcpModule->SetAudioPacketSize(codec.pacsize) != 0) {
1296 WEBRTC_TRACE(kTraceError, kTraceVoice, VoEId(_instanceId, _channelId), 1296 WEBRTC_TRACE(kTraceError, kTraceVoice, VoEId(_instanceId, _channelId),
1297 "SetSendCodec() failed to set audio packet size"); 1297 "SetSendCodec() failed to set audio packet size");
1298 return -1; 1298 return -1;
1299 } 1299 }
1300 1300
1301 return 0; 1301 return 0;
1302 } 1302 }
1303 1303
1304 void Channel::SetBitRate(int bitrate_bps, int64_t probing_interval_ms) { 1304 void Channel::SetBitRate(int bitrate_bps) {
1305 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId), 1305 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId),
1306 "Channel::SetBitRate(bitrate_bps=%d)", bitrate_bps); 1306 "Channel::SetBitRate(bitrate_bps=%d)", bitrate_bps);
1307 audio_coding_->ModifyEncoder([&](std::unique_ptr<AudioEncoder>* encoder) { 1307 audio_coding_->ModifyEncoder([&](std::unique_ptr<AudioEncoder>* encoder) {
1308 if (*encoder) 1308 if (*encoder)
1309 (*encoder)->OnReceivedTargetAudioBitrate(bitrate_bps); 1309 (*encoder)->OnReceivedTargetAudioBitrate(bitrate_bps);
1310 }); 1310 });
1311 retransmission_rate_limiter_->SetMaxRate(bitrate_bps); 1311 retransmission_rate_limiter_->SetMaxRate(bitrate_bps);
1312 1312
1313 // We give smoothed bitrate allocation to audio network adaptor as 1313 // We give smoothed bitrate allocation to audio network adaptor as
1314 // the uplink bandwidth. 1314 // the uplink bandwidth.
1315 // The probing spikes should not affect the bitrate smoother more than 25%. 1315 // TODO(michaelt) : Remove kDefaultBitrateSmoothingTimeConstantMs as soon as
1316 // To simplify the calculations we use a step response as input signal. 1316 // we pass the probing interval to this function.
1317 // The step response of an exponential filter is 1317 constexpr int64_t kDefaultBitrateSmoothingTimeConstantMs = 20000;
1318 // u(t) = 1 - e^(-t / time_constant). 1318 bitrate_smoother_.SetTimeConstantMs(kDefaultBitrateSmoothingTimeConstantMs);
1319 // In order to limit the affect of a BWE spike within 25% of its value before
1320 // the next probing, we would choose a time constant that fulfills
1321 // 1 - e^(-probing_interval_ms / time_constant) < 0.25
1322 // Then 4 * probing_interval_ms is a good choice.
1323 bitrate_smoother_.SetTimeConstantMs(probing_interval_ms * 4);
1324 bitrate_smoother_.AddSample(bitrate_bps); 1319 bitrate_smoother_.AddSample(bitrate_bps);
1325 audio_coding_->ModifyEncoder([&](std::unique_ptr<AudioEncoder>* encoder) { 1320 audio_coding_->ModifyEncoder([&](std::unique_ptr<AudioEncoder>* encoder) {
1326 if (*encoder) { 1321 if (*encoder) {
1327 (*encoder)->OnReceivedUplinkBandwidth( 1322 (*encoder)->OnReceivedUplinkBandwidth(
1328 static_cast<int>(*bitrate_smoother_.GetAverage())); 1323 static_cast<int>(*bitrate_smoother_.GetAverage()));
1329 } 1324 }
1330 }); 1325 });
1331 } 1326 }
1332 1327
1333 void Channel::OnIncomingFractionLoss(int fraction_lost) { 1328 void Channel::OnIncomingFractionLoss(int fraction_lost) {
(...skipping 1915 matching lines...) Expand 10 before | Expand all | Expand 10 after
3249 int64_t min_rtt = 0; 3244 int64_t min_rtt = 0;
3250 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) != 3245 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) !=
3251 0) { 3246 0) {
3252 return 0; 3247 return 0;
3253 } 3248 }
3254 return rtt; 3249 return rtt;
3255 } 3250 }
3256 3251
3257 } // namespace voe 3252 } // namespace voe
3258 } // namespace webrtc 3253 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/voice_engine/channel.h ('k') | webrtc/voice_engine/channel_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698