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

Unified Diff: webrtc/voice_engine/channel.cc

Issue 2546493002: Update smoothed bitrate. (Closed)
Patch Set: Renamed OnReceivedTargetAudioBitrate to OnReceivedUplinkBandwidth Created 3 years, 11 months 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
« no previous file with comments | « webrtc/voice_engine/channel.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/voice_engine/channel.cc
diff --git a/webrtc/voice_engine/channel.cc b/webrtc/voice_engine/channel.cc
index 84d7a204b19b49e1b4d85728e21b4f02a779ff08..c12d87c5bf77cfc8411e6c45e4e03efd8643ba8b 100644
--- a/webrtc/voice_engine/channel.cc
+++ b/webrtc/voice_engine/channel.cc
@@ -926,10 +926,7 @@ Channel::Channel(int32_t channelId,
rtp_packet_sender_proxy_(new RtpPacketSenderProxy()),
retransmission_rate_limiter_(new RateLimiter(Clock::GetRealTimeClock(),
kMaxRetransmissionWindowMs)),
- decoder_factory_(config.acm_config.decoder_factory),
- // Bitrate smoother can be initialized with arbitrary time constant
- // (0 used here). The actual time constant will be set in SetBitRate.
- bitrate_smoother_(0, Clock::GetRealTimeClock()) {
+ decoder_factory_(config.acm_config.decoder_factory) {
WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(_instanceId, _channelId),
"Channel::Channel() - ctor");
AudioCodingModule::Config acm_config(config.acm_config);
@@ -1333,29 +1330,12 @@ 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) {
- if (*encoder)
- (*encoder)->OnReceivedTargetAudioBitrate(bitrate_bps);
- });
- retransmission_rate_limiter_->SetMaxRate(bitrate_bps);
-
- // We give smoothed bitrate allocation to audio network adaptor as
- // the uplink bandwidth.
- // 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 step response of an exponential filter is
- // u(t) = 1 - e^(-t / time_constant).
- // In order to limit the affect of a BWE spike within 25% of its value before
- // the next probing, we would choose a time constant that fulfills
- // 1 - e^(-probing_interval_ms / time_constant) < 0.25
- // Then 4 * probing_interval_ms is a good choice.
- 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()));
+ bitrate_bps, rtc::Optional<int64_t>(probing_interval_ms));
}
});
+ retransmission_rate_limiter_->SetMaxRate(bitrate_bps);
}
void Channel::OnIncomingFractionLoss(int fraction_lost) {
« no previous file with comments | « webrtc/voice_engine/channel.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698