Chromium Code Reviews| Index: webrtc/voice_engine/channel.cc |
| diff --git a/webrtc/voice_engine/channel.cc b/webrtc/voice_engine/channel.cc |
| index 3d195eb141aaf47af41f7d9bcdfbf5fcfb7a67b9..238d8d9325f9febfb23d6f86199a5e8e639f6a5e 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,9 @@ void Channel::SetBitRate(int bitrate_bps) { |
| (*encoder)->OnReceivedTargetAudioBitrate(bitrate_bps); |
| }); |
| retransmission_rate_limiter_->SetMaxRate(bitrate_bps); |
| + bitrate_bps_smoothed_.AddSample(bitrate_bps); |
|
minyue-webrtc
2016/11/15 14:36:03
will it obtain time constant here? if so, does the
michaelt
2016/11/16 09:50:24
Yes.
Not really but we have to set it anyway.
|
| + OnUplinkBandwidthUpdated( |
| + static_cast<int>(*bitrate_bps_smoothed_.GetAverage())); |
| } |
| void Channel::OnIncomingFractionLoss(int fraction_lost) { |
| @@ -3233,5 +3239,13 @@ int64_t Channel::GetRTT(bool allow_associate_channel) const { |
| return rtt; |
| } |
| +void Channel::OnUplinkBandwidthUpdated(int bitrate_bps) { |
|
minyue-webrtc
2016/11/15 14:36:03
I don't think we need to add this function. put th
michaelt
2016/11/16 09:50:24
Ok
|
| + audio_coding_->ModifyEncoder([&](std::unique_ptr<AudioEncoder>* encoder) { |
| + if (*encoder) { |
| + (*encoder)->OnReceivedUplinkBandwidth(bitrate_bps); |
| + } |
| + }); |
| +} |
| + |
| } // namespace voe |
| } // namespace webrtc |