Chromium Code Reviews| 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 | |
|
stefan-webrtc
2017/06/30 15:31:34
End with .
terelius
2017/07/04 11:01:11
Done.
| |
| 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(); | |
| 216 printf("Halving send rate because no acknowledged bitrate\n"); | |
|
stefan-webrtc
2017/06/30 15:31:34
Remove
terelius
2017/07/04 11:01:11
Done. Thanks.
| |
| 204 } | 217 } |
| 205 } else { | 218 } else { |
| 206 if (probe_bitrate_bps) { | 219 if (probe_bitrate_bps) { |
| 207 rate_control_.SetEstimate(*probe_bitrate_bps, now_ms); | 220 rate_control_.SetEstimate(*probe_bitrate_bps, now_ms); |
| 208 result.probe = true; | 221 result.probe = true; |
| 209 } | 222 } |
| 210 result.updated = UpdateEstimate(now_ms, acked_bitrate_bps, overusing, | 223 result.updated = UpdateEstimate(now_ms, acked_bitrate_bps, overusing, |
| 211 &result.target_bitrate_bps); | 224 &result.target_bitrate_bps); |
| 212 } | 225 } |
| 213 if (result.updated) { | 226 if (result.updated) { |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 265 void DelayBasedBwe::SetMinBitrate(int min_bitrate_bps) { | 278 void DelayBasedBwe::SetMinBitrate(int min_bitrate_bps) { |
| 266 // Called from both the configuration thread and the network thread. Shouldn't | 279 // Called from both the configuration thread and the network thread. Shouldn't |
| 267 // be called from the network thread in the future. | 280 // be called from the network thread in the future. |
| 268 rate_control_.SetMinBitrate(min_bitrate_bps); | 281 rate_control_.SetMinBitrate(min_bitrate_bps); |
| 269 } | 282 } |
| 270 | 283 |
| 271 int64_t DelayBasedBwe::GetExpectedBwePeriodMs() const { | 284 int64_t DelayBasedBwe::GetExpectedBwePeriodMs() const { |
| 272 return rate_control_.GetExpectedBandwidthPeriodMs(); | 285 return rate_control_.GetExpectedBandwidthPeriodMs(); |
| 273 } | 286 } |
| 274 } // namespace webrtc | 287 } // namespace webrtc |
| OLD | NEW |