| Index: webrtc/voice_engine/channel.cc
|
| diff --git a/webrtc/voice_engine/channel.cc b/webrtc/voice_engine/channel.cc
|
| index 3d195eb141aaf47af41f7d9bcdfbf5fcfb7a67b9..5712332aa618873b45c19bf46d80bbf883afd287 100644
|
| --- a/webrtc/voice_engine/channel.cc
|
| +++ b/webrtc/voice_engine/channel.cc
|
| @@ -48,6 +48,7 @@ namespace {
|
|
|
| constexpr int64_t kMaxRetransmissionWindowMs = 1000;
|
| constexpr int64_t kMinRetransmissionWindowMs = 30;
|
| +constexpr int64_t kDefaultBitrateSmoothingTimeConstantMs = 20000;
|
|
|
| } // namespace
|
|
|
| @@ -895,7 +896,9 @@ 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),
|
| + bitrate_bps_smoothed_(kDefaultBitrateSmoothingTimeConstantMs,
|
| + Clock::GetRealTimeClock()) {
|
| WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(_instanceId, _channelId),
|
| "Channel::Channel() - ctor");
|
| AudioCodingModule::Config acm_config(config.acm_config);
|
| @@ -1309,6 +1312,16 @@ 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.
|
| + bitrate_bps_smoothed_.AddSample(bitrate_bps);
|
| + audio_coding_->ModifyEncoder([&](std::unique_ptr<AudioEncoder>* encoder) {
|
| + if (*encoder) {
|
| + (*encoder)->OnReceivedUplinkBandwidth(
|
| + static_cast<int>(*bitrate_bps_smoothed_.GetAverage()));
|
| + }
|
| + });
|
| }
|
|
|
| void Channel::OnIncomingFractionLoss(int fraction_lost) {
|
|
|