Chromium Code Reviews| Index: webrtc/voice_engine/channel.cc | 
| diff --git a/webrtc/voice_engine/channel.cc b/webrtc/voice_engine/channel.cc | 
| index 6e2e91c0a1bd0c0e62ccc4a753ef940d12ec2849..3d3a5fec0116bd32896ceae9c9c636cae9c3472e 100644 | 
| --- a/webrtc/voice_engine/channel.cc | 
| +++ b/webrtc/voice_engine/channel.cc | 
| @@ -1351,14 +1351,9 @@ void Channel::SetBitRate(int bitrate_bps, int64_t probing_interval_ms) { | 
| // 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. | 
| + rtc::CritScope lock(&smoothed_bitrate_lock_); | 
| 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<int>(bitrate_bps); | 
| 
 
minyue-webrtc
2016/12/07 16:44:44
With our new smoothing filter planned, we can add
 
michaelt
2016/12/08 14:06:40
Will rebase as soon that the changed filter is lan
 
 | 
| } | 
| void Channel::OnIncomingFractionLoss(int fraction_lost) { | 
| @@ -2755,6 +2750,19 @@ void Channel::SetNACKStatus(bool enable, int maxNumberOfPackets) { | 
| audio_coding_->DisableNack(); | 
| } | 
| +void Channel::AdaptCodec() { | 
| + audio_coding_->ModifyEncoder([&](std::unique_ptr<AudioEncoder>* encoder) { | 
| + rtc::CritScope lock(&smoothed_bitrate_lock_); | 
| + if (bitrate_bps_) { | 
| + bitrate_smoother_.AddSample(*bitrate_bps_); | 
| 
 
minyue-webrtc
2016/12/07 16:44:44
with our new smoothing filter planned, there is no
 
michaelt
2016/12/08 14:06:40
Will rebase as soon that the changed filter is lan
 
 | 
| + if (*encoder) { | 
| + (*encoder)->OnReceivedUplinkBandwidth( | 
| + static_cast<int>(*bitrate_smoother_.GetAverage())); | 
| + } | 
| + } | 
| + }); | 
| +} | 
| + | 
| // Called when we are missing one or more packets. | 
| int Channel::ResendPackets(const uint16_t* sequence_numbers, int length) { | 
| return _rtpRtcpModule->SendNACK(sequence_numbers, length); |