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

Side by Side Diff: webrtc/modules/remote_bitrate_estimator/aimd_rate_control.cc

Issue 2542083003: Use different restrictions of acked bitrate lag depending on operating point. (Closed)
Patch Set: Comments addressed. 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 unified diff | Download patch
« no previous file with comments | « no previous file | webrtc/modules/remote_bitrate_estimator/aimd_rate_control_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 UpdateMaxBitRateEstimate(incoming_bitrate_kbps); 222 UpdateMaxBitRateEstimate(incoming_bitrate_kbps);
223 } 223 }
224 // Stay on hold until the pipes are cleared. 224 // Stay on hold until the pipes are cleared.
225 ChangeState(kRcHold); 225 ChangeState(kRcHold);
226 time_last_bitrate_change_ = now_ms; 226 time_last_bitrate_change_ = now_ms;
227 break; 227 break;
228 228
229 default: 229 default:
230 assert(false); 230 assert(false);
231 } 231 }
232 if ((incoming_bitrate_bps > 100000 || current_bitrate_bps > 150000) && 232 // Don't change the bit rate if the send side is too far off.
233 current_bitrate_bps > 1.5 * incoming_bitrate_bps) { 233 // We allow a bit more lag at very low rates to not too easily get stuck if
234 // Allow changing the bit rate if we are operating at very low rates 234 // the encoder produces uneven outputs.
235 // Don't change the bit rate if the send side is too far off 235 const uint32_t max_bitrate_bps =
236 current_bitrate_bps = current_bitrate_bps_; 236 static_cast<uint32_t>(1.5f * incoming_bitrate_bps) + 10000;
237 if (current_bitrate_bps > current_bitrate_bps_ &&
238 current_bitrate_bps > max_bitrate_bps) {
239 current_bitrate_bps = std::max(current_bitrate_bps_, max_bitrate_bps);
237 time_last_bitrate_change_ = now_ms; 240 time_last_bitrate_change_ = now_ms;
238 } 241 }
239 return current_bitrate_bps; 242 return current_bitrate_bps;
240 } 243 }
241 244
242 uint32_t AimdRateControl::MultiplicativeRateIncrease( 245 uint32_t AimdRateControl::MultiplicativeRateIncrease(
243 int64_t now_ms, int64_t last_ms, uint32_t current_bitrate_bps) const { 246 int64_t now_ms, int64_t last_ms, uint32_t current_bitrate_bps) const {
244 double alpha = 1.08; 247 double alpha = 1.08;
245 if (last_ms > -1) { 248 if (last_ms > -1) {
246 int time_since_last_update_ms = std::min(static_cast<int>(now_ms - last_ms), 249 int time_since_last_update_ms = std::min(static_cast<int>(now_ms - last_ms),
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 } 308 }
306 309
307 void AimdRateControl::ChangeRegion(RateControlRegion region) { 310 void AimdRateControl::ChangeRegion(RateControlRegion region) {
308 rate_control_region_ = region; 311 rate_control_region_ = region;
309 } 312 }
310 313
311 void AimdRateControl::ChangeState(RateControlState new_state) { 314 void AimdRateControl::ChangeState(RateControlState new_state) {
312 rate_control_state_ = new_state; 315 rate_control_state_ = new_state;
313 } 316 }
314 } // namespace webrtc 317 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | webrtc/modules/remote_bitrate_estimator/aimd_rate_control_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698