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

Unified Diff: webrtc/voice_engine/channel.cc

Issue 2546493002: Update smoothed bitrate. (Closed)
Patch Set: Changed cl according to offline discussions. 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 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 100832de3adeb2dc986cd255dc271a109ea6bbb7..49ed483148e22564c630171dfe0d7ddd1e917d10 100644
--- a/webrtc/voice_engine/channel.cc
+++ b/webrtc/voice_engine/channel.cc
@@ -924,10 +924,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);
@@ -1332,28 +1329,10 @@ void Channel::SetBitRate(int bitrate_bps, int64_t probing_interval_ms) {
"Channel::SetBitRate(bitrate_bps=%d)", bitrate_bps);
audio_coding_->ModifyEncoder([&](std::unique_ptr<AudioEncoder>* encoder) {
if (*encoder)
minyue-webrtc 2016/12/22 14:51:27 { ... }
michaelt 2016/12/22 15:10:10 Done.
- (*encoder)->OnReceivedTargetAudioBitrate(bitrate_bps);
+ (*encoder)->OnReceivedTargetAudioBitrate(
+ bitrate_bps, rtc::Optional<int64_t>(probing_interval_ms));
});
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()));
- }
- });
}
void Channel::OnIncomingFractionLoss(int fraction_lost) {

Powered by Google App Engine
This is Rietveld 408576698