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

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

Issue 2380883003: Add interval estimator to remote bitrate estimator (Closed)
Patch Set: Response to an offline discussion. Created 4 years, 1 month 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/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 f83cddc617862b56ca50131895e97921084178b2..a190591c2137f2f5f5472a2e7a8b14736885b058 100644
--- a/webrtc/modules/remote_bitrate_estimator/aimd_rate_control.cc
+++ b/webrtc/modules/remote_bitrate_estimator/aimd_rate_control.cc
@@ -130,6 +130,22 @@ void AimdRateControl::SetEstimate(int bitrate_bps, int64_t now_ms) {
current_bitrate_bps_ = ChangeBitrate(bitrate_bps, bitrate_bps, now_ms);
}
+int AimdRateControl::GetNearMaxIncreaseRateBps() const {
+ double bits_per_frame = static_cast<double>(current_bitrate_bps_) / 30.0;
+ double packets_per_frame = std::ceil(bits_per_frame / (8.0 * 1200.0));
+ double avg_packet_size_bits = bits_per_frame / packets_per_frame;
+ // Approximate the over-use estimator delay to 100 ms.
+ const int64_t response_time = in_experiment_ ? (rtt_ + 100) * 2 : rtt_ + 100;
+
+ constexpr double kMinIncreaseRateBps = 4000;
stefan-webrtc 2016/11/08 13:06:28 4000 is larger than before when it was 1000, right
michaelt 2016/11/09 07:54:44 No its actually smaller. Before we had 1kbps per c
stefan-webrtc 2016/11/09 18:01:10 Should we keep 5 kbps then? BTW, how come it was a
michaelt 2016/11/10 08:57:31 this 200ms are not const as you expected, they are
stefan-webrtc 2016/11/14 14:53:48 SG
+ return std::max(kMinIncreaseRateBps,
+ (avg_packet_size_bits * 1000) / response_time);
+}
+
+rtc::Optional<int> AimdRateControl::GetLastDecrease() const {
+ return last_decrease_;
+}
+
uint32_t AimdRateControl::ChangeBitrate(uint32_t current_bitrate_bps,
uint32_t incoming_bitrate_bps,
int64_t now_ms) {
@@ -161,12 +177,9 @@ uint32_t AimdRateControl::ChangeBitrate(uint32_t current_bitrate_bps,
avg_max_bitrate_kbps_ = -1.0;
}
if (rate_control_region_ == kRcNearMax) {
- // Approximate the over-use estimator delay to 100 ms.
- const int64_t response_time = rtt_ + 100;
- uint32_t additive_increase_bps = AdditiveRateIncrease(
- now_ms, time_last_bitrate_change_, response_time);
+ uint32_t additive_increase_bps =
+ AdditiveRateIncrease(now_ms, time_last_bitrate_change_);
current_bitrate_bps += additive_increase_bps;
-
} else {
uint32_t multiplicative_increase_bps = MultiplicativeRateIncrease(
now_ms, time_last_bitrate_change_, current_bitrate_bps);
@@ -196,6 +209,9 @@ uint32_t AimdRateControl::ChangeBitrate(uint32_t current_bitrate_bps,
}
ChangeRegion(kRcNearMax);
+ if (incoming_bitrate_bps < current_bitrate_bps_)
stefan-webrtc 2016/11/08 13:06:28 {}
michaelt 2016/11/09 07:54:44 Done.
+ last_decrease_ =
+ rtc::Optional<int>(current_bitrate_bps_ - current_bitrate_bps);
if (incoming_bitrate_kbps < avg_max_bitrate_kbps_ -
3 * std_max_bit_rate) {
avg_max_bitrate_kbps_ = -1.0f;
@@ -234,22 +250,9 @@ uint32_t AimdRateControl::MultiplicativeRateIncrease(
return multiplicative_increase_bps;
}
-uint32_t AimdRateControl::AdditiveRateIncrease(
- int64_t now_ms, int64_t last_ms, int64_t response_time_ms) const {
- assert(response_time_ms > 0);
- double beta = 0.0;
- if (last_ms > 0) {
- beta = std::min((now_ms - last_ms) / static_cast<double>(response_time_ms),
- 1.0);
- if (in_experiment_)
- beta /= 2.0;
- }
- double bits_per_frame = static_cast<double>(current_bitrate_bps_) / 30.0;
- double packets_per_frame = std::ceil(bits_per_frame / (8.0 * 1200.0));
- double avg_packet_size_bits = bits_per_frame / packets_per_frame;
- uint32_t additive_increase_bps = std::max(
- 1000.0, beta * avg_packet_size_bits);
- return additive_increase_bps;
+uint32_t AimdRateControl::AdditiveRateIncrease(int64_t now_ms,
+ int64_t last_ms) const {
+ return (GetNearMaxIncreaseRateBps() / 1000.0) * (now_ms - last_ms);
stefan-webrtc 2016/11/08 13:06:28 You can remove () around GetNear...
michaelt 2016/11/09 07:54:44 Done.
}
void AimdRateControl::UpdateMaxBitRateEstimate(float incoming_bitrate_kbps) {

Powered by Google App Engine
This is Rietveld 408576698