| OLD | NEW |
| 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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 current_input_ = *input; | 123 current_input_ = *input; |
| 124 } | 124 } |
| 125 } | 125 } |
| 126 | 126 |
| 127 void AimdRateControl::SetEstimate(int bitrate_bps, int64_t now_ms) { | 127 void AimdRateControl::SetEstimate(int bitrate_bps, int64_t now_ms) { |
| 128 updated_ = true; | 128 updated_ = true; |
| 129 bitrate_is_initialized_ = true; | 129 bitrate_is_initialized_ = true; |
| 130 current_bitrate_bps_ = ChangeBitrate(bitrate_bps, bitrate_bps, now_ms); | 130 current_bitrate_bps_ = ChangeBitrate(bitrate_bps, bitrate_bps, now_ms); |
| 131 } | 131 } |
| 132 | 132 |
| 133 uint32_t AimdRateControl::ChangeBitrate(uint32_t current_bitrate_bps, | 133 uint32_t AimdRateControl::ChangeBitrate(int current_bitrate_bps, |
| 134 uint32_t incoming_bitrate_bps, | 134 int incoming_bitrate_bps, |
| 135 int64_t now_ms) { | 135 int64_t now_ms) { |
| 136 if (!updated_) { | 136 if (!updated_) { |
| 137 return current_bitrate_bps_; | 137 return current_bitrate_bps_; |
| 138 } | 138 } |
| 139 // An over-use should always trigger us to reduce the bitrate, even though | 139 // An over-use should always trigger us to reduce the bitrate, even though |
| 140 // we have not yet established our first estimate. By acting on the over-use, | 140 // we have not yet established our first estimate. By acting on the over-use, |
| 141 // we will end up with a valid estimate. | 141 // we will end up with a valid estimate. |
| 142 if (!bitrate_is_initialized_ && current_input_.bw_state != kBwOverusing) | 142 if (!bitrate_is_initialized_ && current_input_.bw_state != kBwOverusing) |
| 143 return current_bitrate_bps_; | 143 return current_bitrate_bps_; |
| 144 updated_ = false; | 144 updated_ = false; |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 } | 299 } |
| 300 | 300 |
| 301 void AimdRateControl::ChangeRegion(RateControlRegion region) { | 301 void AimdRateControl::ChangeRegion(RateControlRegion region) { |
| 302 rate_control_region_ = region; | 302 rate_control_region_ = region; |
| 303 } | 303 } |
| 304 | 304 |
| 305 void AimdRateControl::ChangeState(RateControlState new_state) { | 305 void AimdRateControl::ChangeState(RateControlState new_state) { |
| 306 rate_control_state_ = new_state; | 306 rate_control_state_ = new_state; |
| 307 } | 307 } |
| 308 } // namespace webrtc | 308 } // namespace webrtc |
| OLD | NEW |