| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 | 136 |
| 137 void BitrateControllerImpl::OnReceivedEstimatedBitrate(uint32_t bitrate) { | 137 void BitrateControllerImpl::OnReceivedEstimatedBitrate(uint32_t bitrate) { |
| 138 { | 138 { |
| 139 rtc::CritScope cs(&critsect_); | 139 rtc::CritScope cs(&critsect_); |
| 140 bandwidth_estimation_.UpdateReceiverEstimate(clock_->TimeInMilliseconds(), | 140 bandwidth_estimation_.UpdateReceiverEstimate(clock_->TimeInMilliseconds(), |
| 141 bitrate); | 141 bitrate); |
| 142 } | 142 } |
| 143 MaybeTriggerOnNetworkChanged(); | 143 MaybeTriggerOnNetworkChanged(); |
| 144 } | 144 } |
| 145 | 145 |
| 146 void BitrateControllerImpl::UpdateDelayBasedEstimate(uint32_t bitrate_bps) { |
| 147 { |
| 148 rtc::CritScope cs(&critsect_); |
| 149 bandwidth_estimation_.UpdateDelayBasedEstimate(clock_->TimeInMilliseconds(), |
| 150 bitrate_bps); |
| 151 } |
| 152 MaybeTriggerOnNetworkChanged(); |
| 153 } |
| 154 |
| 146 int64_t BitrateControllerImpl::TimeUntilNextProcess() { | 155 int64_t BitrateControllerImpl::TimeUntilNextProcess() { |
| 147 const int64_t kBitrateControllerUpdateIntervalMs = 25; | 156 const int64_t kBitrateControllerUpdateIntervalMs = 25; |
| 148 rtc::CritScope cs(&critsect_); | 157 rtc::CritScope cs(&critsect_); |
| 149 int64_t time_since_update_ms = | 158 int64_t time_since_update_ms = |
| 150 clock_->TimeInMilliseconds() - last_bitrate_update_ms_; | 159 clock_->TimeInMilliseconds() - last_bitrate_update_ms_; |
| 151 return std::max<int64_t>( | 160 return std::max<int64_t>( |
| 152 kBitrateControllerUpdateIntervalMs - time_since_update_ms, 0); | 161 kBitrateControllerUpdateIntervalMs - time_since_update_ms, 0); |
| 153 } | 162 } |
| 154 | 163 |
| 155 int32_t BitrateControllerImpl::Process() { | 164 int32_t BitrateControllerImpl::Process() { |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 bandwidth_estimation_.CurrentEstimate(&bitrate, &fraction_loss, &rtt); | 226 bandwidth_estimation_.CurrentEstimate(&bitrate, &fraction_loss, &rtt); |
| 218 if (bitrate > 0) { | 227 if (bitrate > 0) { |
| 219 bitrate = bitrate - std::min<int>(bitrate, reserved_bitrate_bps_); | 228 bitrate = bitrate - std::min<int>(bitrate, reserved_bitrate_bps_); |
| 220 bitrate = std::max(bitrate, bandwidth_estimation_.GetMinBitrate()); | 229 bitrate = std::max(bitrate, bandwidth_estimation_.GetMinBitrate()); |
| 221 *bandwidth = bitrate; | 230 *bandwidth = bitrate; |
| 222 return true; | 231 return true; |
| 223 } | 232 } |
| 224 return false; | 233 return false; |
| 225 } | 234 } |
| 226 } // namespace webrtc | 235 } // namespace webrtc |
| OLD | NEW |