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

Unified Diff: webrtc/modules/remote_bitrate_estimator/aimd_rate_control.cc

Issue 1219303002: Fix issue where the first audio packets significantly impacts initial BWE negatively. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Comments addressed. Created 5 years, 5 months 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
« no previous file with comments | « no previous file | webrtc/modules/remote_bitrate_estimator/include/bwe_defines.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/remote_bitrate_estimator/aimd_rate_control.cc
diff --git a/webrtc/modules/remote_bitrate_estimator/aimd_rate_control.cc b/webrtc/modules/remote_bitrate_estimator/aimd_rate_control.cc
index bcb71d6db891db222bdfbee7e43fef629598ff85..9bac153ac82f5273b255bfe53d53d46a99f32beb 100644
--- a/webrtc/modules/remote_bitrate_estimator/aimd_rate_control.cc
+++ b/webrtc/modules/remote_bitrate_estimator/aimd_rate_control.cc
@@ -14,6 +14,7 @@
#include <cassert>
#include <cmath>
+#include "webrtc/base/checks.h"
#include "webrtc/modules/remote_bitrate_estimator/overuse_detector.h"
#include "webrtc/modules/remote_bitrate_estimator/test/bwe_test_logging.h"
@@ -102,11 +103,13 @@ void AimdRateControl::Update(const RateControlInput* input, int64_t now_ms) {
// Set the initial bit rate value to what we're receiving the first half
// second.
if (!bitrate_is_initialized_) {
+ const int64_t kInitializationTimeMs = 5000;
+ DCHECK_LE(kBitrateWindowMs, kInitializationTimeMs);
if (time_first_incoming_estimate_ < 0) {
if (input->_incomingBitRate > 0) {
time_first_incoming_estimate_ = now_ms;
}
- } else if (now_ms - time_first_incoming_estimate_ > 500 &&
+ } else if (now_ms - time_first_incoming_estimate_ > kInitializationTimeMs &&
input->_incomingBitRate > 0) {
current_bitrate_bps_ = input->_incomingBitRate;
bitrate_is_initialized_ = true;
@@ -136,6 +139,11 @@ uint32_t AimdRateControl::ChangeBitrate(uint32_t current_bitrate_bps,
if (!updated_) {
return current_bitrate_bps_;
}
+ // An over-use should always trigger us to reduce the bitrate, even though
+ // we have not yet established our first estimate. By acting on the over-use,
+ // we will end up with a valid estimate.
+ if (!bitrate_is_initialized_ && current_input_._bwState != kBwOverusing)
+ return current_bitrate_bps_;
updated_ = false;
ChangeState(current_input_, now_ms);
// Calculated here because it's used in multiple places.
@@ -172,6 +180,7 @@ uint32_t AimdRateControl::ChangeBitrate(uint32_t current_bitrate_bps,
break;
case kRcDecrease:
+ bitrate_is_initialized_ = true;
if (incoming_bitrate_bps < min_configured_bitrate_bps_) {
current_bitrate_bps = min_configured_bitrate_bps_;
} else {
« no previous file with comments | « no previous file | webrtc/modules/remote_bitrate_estimator/include/bwe_defines.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698