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

Unified Diff: webrtc/voice_engine/channel.cc

Issue 2546493002: Update smoothed bitrate. (Closed)
Patch Set: Response to comments 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 dc93dc7e06c30483a10ee658d78da4d9ca2e3c89..2b8a5e8bac3a68d33fbadbcde1467d0cdcc8ef30 100644
--- a/webrtc/voice_engine/channel.cc
+++ b/webrtc/voice_engine/channel.cc
@@ -1345,14 +1345,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(&bitrate_smoother_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()));
- }
- });
}
void Channel::OnIncomingFractionLoss(int fraction_lost) {
@@ -2749,6 +2744,16 @@ void Channel::SetNACKStatus(bool enable, int maxNumberOfPackets) {
audio_coding_->DisableNack();
}
+void Channel::AdaptCodec() {
+ audio_coding_->ModifyEncoder([&](std::unique_ptr<AudioEncoder>* encoder) {
+ rtc::CritScope lock(&bitrate_smoother_lock_);
+ 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);

Powered by Google App Engine
This is Rietveld 408576698