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

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

Issue 2537043003: fix wrong implementation of AimdRateControl::TimeToReduceFurther. (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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 } 65 }
66 66
67 bool AimdRateControl::TimeToReduceFurther(int64_t time_now, 67 bool AimdRateControl::TimeToReduceFurther(int64_t time_now,
68 uint32_t incoming_bitrate_bps) const { 68 uint32_t incoming_bitrate_bps) const {
69 const int64_t bitrate_reduction_interval = 69 const int64_t bitrate_reduction_interval =
70 std::max<int64_t>(std::min<int64_t>(rtt_, 200), 10); 70 std::max<int64_t>(std::min<int64_t>(rtt_, 200), 10);
71 if (time_now - time_last_bitrate_change_ >= bitrate_reduction_interval) { 71 if (time_now - time_last_bitrate_change_ >= bitrate_reduction_interval) {
72 return true; 72 return true;
73 } 73 }
74 if (ValidEstimate()) { 74 if (ValidEstimate()) {
75 const int threshold = static_cast<int>(kWithinIncomingBitrateHysteresis * 75 const uint32_t threshold = static_cast<uint32_t>
76 incoming_bitrate_bps); 76 (kWithinIncomingBitrateHysteresis * LatestEstimate());
77 const int bitrate_difference = LatestEstimate() - incoming_bitrate_bps; 77 return incoming_bitrate_bps > threshold;
stefan-webrtc 2016/11/29 15:52:08 Agree that it's wrong! I think the comment is wron
zhengpeng 2016/11/30 04:33:11 After reconsideration, I agree that if we are over
78 return bitrate_difference > threshold;
79 } 78 }
80 return false; 79 return false;
81 } 80 }
82 81
83 uint32_t AimdRateControl::LatestEstimate() const { 82 uint32_t AimdRateControl::LatestEstimate() const {
84 return current_bitrate_bps_; 83 return current_bitrate_bps_;
85 } 84 }
86 85
87 uint32_t AimdRateControl::UpdateBandwidthEstimate(int64_t now_ms) { 86 uint32_t AimdRateControl::UpdateBandwidthEstimate(int64_t now_ms) {
88 current_bitrate_bps_ = ChangeBitrate( 87 current_bitrate_bps_ = ChangeBitrate(
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 } 298 }
300 299
301 void AimdRateControl::ChangeRegion(RateControlRegion region) { 300 void AimdRateControl::ChangeRegion(RateControlRegion region) {
302 rate_control_region_ = region; 301 rate_control_region_ = region;
303 } 302 }
304 303
305 void AimdRateControl::ChangeState(RateControlState new_state) { 304 void AimdRateControl::ChangeState(RateControlState new_state) {
306 rate_control_state_ = new_state; 305 rate_control_state_ = new_state;
307 } 306 }
308 } // namespace webrtc 307 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698