| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 int64_t now_ms = clock_->TimeInMilliseconds(); | 194 int64_t now_ms = clock_->TimeInMilliseconds(); |
| 195 | 195 |
| 196 rtc::Optional<int> probe_bitrate_bps = | 196 rtc::Optional<int> probe_bitrate_bps = |
| 197 probe_bitrate_estimator_.FetchAndResetLastEstimatedBitrateBps(); | 197 probe_bitrate_estimator_.FetchAndResetLastEstimatedBitrateBps(); |
| 198 // Currently overusing the bandwidth. | 198 // Currently overusing the bandwidth. |
| 199 if (overusing) { | 199 if (overusing) { |
| 200 if (acked_bitrate_bps && | 200 if (acked_bitrate_bps && |
| 201 rate_control_.TimeToReduceFurther(now_ms, *acked_bitrate_bps)) { | 201 rate_control_.TimeToReduceFurther(now_ms, *acked_bitrate_bps)) { |
| 202 result.updated = UpdateEstimate(now_ms, acked_bitrate_bps, overusing, | 202 result.updated = UpdateEstimate(now_ms, acked_bitrate_bps, overusing, |
| 203 &result.target_bitrate_bps); | 203 &result.target_bitrate_bps); |
| 204 } else if (!acked_bitrate_bps && rate_control_.ValidEstimate() && |
| 205 rate_control_.TimeToReduceFurther( |
| 206 now_ms, rate_control_.LatestEstimate() / 2 - 1)) { |
| 207 // Overusing before we have a measured acknowledged bitrate. We check |
| 208 // TimeToReduceFurther (with a fake acknowledged bitrate) to avoid |
| 209 // reducing too often. |
| 210 // TODO(tschumim): Improve this and/or the acknowledged bitrate estimator |
| 211 // so that we (almost) always have a bitrate estimate. |
| 212 rate_control_.SetEstimate(rate_control_.LatestEstimate() / 2, now_ms); |
| 213 result.updated = true; |
| 214 result.probe = false; |
| 215 result.target_bitrate_bps = rate_control_.LatestEstimate(); |
| 204 } | 216 } |
| 205 } else { | 217 } else { |
| 206 if (probe_bitrate_bps) { | 218 if (probe_bitrate_bps) { |
| 207 result.probe = true; | 219 result.probe = true; |
| 208 result.updated = true; | 220 result.updated = true; |
| 209 result.target_bitrate_bps = *probe_bitrate_bps; | 221 result.target_bitrate_bps = *probe_bitrate_bps; |
| 210 rate_control_.SetEstimate(*probe_bitrate_bps, now_ms); | 222 rate_control_.SetEstimate(*probe_bitrate_bps, now_ms); |
| 211 } else { | 223 } else { |
| 212 result.updated = UpdateEstimate(now_ms, acked_bitrate_bps, overusing, | 224 result.updated = UpdateEstimate(now_ms, acked_bitrate_bps, overusing, |
| 213 &result.target_bitrate_bps); | 225 &result.target_bitrate_bps); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 void DelayBasedBwe::SetMinBitrate(int min_bitrate_bps) { | 282 void DelayBasedBwe::SetMinBitrate(int min_bitrate_bps) { |
| 271 // Called from both the configuration thread and the network thread. Shouldn't | 283 // Called from both the configuration thread and the network thread. Shouldn't |
| 272 // be called from the network thread in the future. | 284 // be called from the network thread in the future. |
| 273 rate_control_.SetMinBitrate(min_bitrate_bps); | 285 rate_control_.SetMinBitrate(min_bitrate_bps); |
| 274 } | 286 } |
| 275 | 287 |
| 276 int64_t DelayBasedBwe::GetExpectedBwePeriodMs() const { | 288 int64_t DelayBasedBwe::GetExpectedBwePeriodMs() const { |
| 277 return rate_control_.GetExpectedBandwidthPeriodMs(); | 289 return rate_control_.GetExpectedBandwidthPeriodMs(); |
| 278 } | 290 } |
| 279 } // namespace webrtc | 291 } // namespace webrtc |
| OLD | NEW |