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 530453d74cc1612c105de25bb7cc0280d261c53a..8a6eb06f2df18080ea53772faaad34d4fec70220 100644 |
--- a/webrtc/modules/remote_bitrate_estimator/aimd_rate_control.cc |
+++ b/webrtc/modules/remote_bitrate_estimator/aimd_rate_control.cc |
@@ -229,11 +229,14 @@ uint32_t AimdRateControl::ChangeBitrate(uint32_t current_bitrate_bps, |
default: |
assert(false); |
} |
- if ((incoming_bitrate_bps > 100000 || current_bitrate_bps > 150000) && |
- current_bitrate_bps > 1.5 * incoming_bitrate_bps) { |
- // Allow changing the bit rate if we are operating at very low rates |
- // Don't change the bit rate if the send side is too far off |
- current_bitrate_bps = current_bitrate_bps_; |
+ // Don't change the bit rate if the send side is too far off. |
+ // We allow a bit more lag at very low rates to not too easily get stuck if |
+ // the encoder produces uneven outputs. |
+ const uint32_t max_bitrate_bps = |
+ static_cast<uint32_t>(1.5f * incoming_bitrate_bps) + 10000; |
+ if (current_bitrate_bps > current_bitrate_bps_ && |
+ current_bitrate_bps > max_bitrate_bps) { |
+ current_bitrate_bps = std::max(current_bitrate_bps_, max_bitrate_bps); |
time_last_bitrate_change_ = now_ms; |
} |
return current_bitrate_bps; |