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

Unified Diff: webrtc/voice_engine/channel.cc

Issue 2546493002: Update smoothed bitrate. (Closed)
Patch Set: 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 975d56aa986538e0522a4fce38d358b455067ca5..97f3caf932a48b790c333884dfc0caf6656943dd 100644
--- a/webrtc/voice_engine/channel.cc
+++ b/webrtc/voice_engine/channel.cc
@@ -1317,13 +1317,7 @@ void Channel::SetBitRate(int bitrate_bps) {
// 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()));
- }
- });
+ last_bitrate_bps_ = rtc::Optional<int>(bitrate_bps);
}
void Channel::OnIncomingFractionLoss(int fraction_lost) {
@@ -2720,6 +2714,18 @@ void Channel::SetNACKStatus(bool enable, int maxNumberOfPackets) {
audio_coding_->DisableNack();
}
+void Channel::UpdateSmoothedBitrate() {
+ if (last_bitrate_bps_) {
+ bitrate_smoother_.AddSample(*last_bitrate_bps_);
+ audio_coding_->ModifyEncoder([&](std::unique_ptr<AudioEncoder>* encoder) {
+ 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