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

Unified Diff: webrtc/voice_engine/channel.cc

Issue 2503713003: Smooth BWE and pass it to Audio Network Adaptor. (Closed)
Patch Set: Response to comments. 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
« webrtc/base/smoothing_filter.cc ('K') | « 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 3d195eb141aaf47af41f7d9bcdfbf5fcfb7a67b9..5161881b08e140f5d9af03db80c743e2d465f542 100644
--- a/webrtc/voice_engine/channel.cc
+++ b/webrtc/voice_engine/channel.cc
@@ -895,7 +895,10 @@ 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) {
+ decoder_factory_(config.acm_config.decoder_factory),
+ // The time constant of the bitrate smoother will be set on every
minyue-webrtc 2016/11/21 09:18:24 Bitrate smoother can be initialized with arbitrary
michaelt 2016/11/21 09:48:32 Done.
+ // call of SetBitRate.
+ bitrate_smoother_(0, Clock::GetRealTimeClock()) {
WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(_instanceId, _channelId),
"Channel::Channel() - ctor");
AudioCodingModule::Config acm_config(config.acm_config);
@@ -1309,6 +1312,20 @@ void Channel::SetBitRate(int bitrate_bps) {
(*encoder)->OnReceivedTargetAudioBitrate(bitrate_bps);
});
retransmission_rate_limiter_->SetMaxRate(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);
+ 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) {
« webrtc/base/smoothing_filter.cc ('K') | « webrtc/voice_engine/channel.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698