| 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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 { | 179 { |
| 180 rtc::CritScope cs(&critsect_); | 180 rtc::CritScope cs(&critsect_); |
| 181 bandwidth_estimation_.UpdateReceiverEstimate(clock_->TimeInMilliseconds(), | 181 bandwidth_estimation_.UpdateReceiverEstimate(clock_->TimeInMilliseconds(), |
| 182 bitrate); | 182 bitrate); |
| 183 BWE_TEST_LOGGING_PLOT(1, "REMB[kbps]", clock_->TimeInMilliseconds(), | 183 BWE_TEST_LOGGING_PLOT(1, "REMB[kbps]", clock_->TimeInMilliseconds(), |
| 184 bitrate / 1000); | 184 bitrate / 1000); |
| 185 } | 185 } |
| 186 MaybeTriggerOnNetworkChanged(); | 186 MaybeTriggerOnNetworkChanged(); |
| 187 } | 187 } |
| 188 | 188 |
| 189 void BitrateControllerImpl::OnProbeBitrate(uint32_t bitrate_bps) { | 189 void BitrateControllerImpl::OnDelayBasedBweResult( |
| 190 const DelayBasedBwe::Result& result) { |
| 191 if (!result.updated) |
| 192 return; |
| 190 { | 193 { |
| 191 rtc::CritScope cs(&critsect_); | 194 rtc::CritScope cs(&critsect_); |
| 192 bandwidth_estimation_.SetSendBitrate(bitrate_bps); | 195 if (result.probe) { |
| 196 bandwidth_estimation_.SetSendBitrate(result.target_bitrate_bps); |
| 197 } else { |
| 198 bandwidth_estimation_.UpdateDelayBasedEstimate( |
| 199 clock_->TimeInMilliseconds(), result.target_bitrate_bps); |
| 200 } |
| 193 } | 201 } |
| 194 MaybeTriggerOnNetworkChanged(); | 202 MaybeTriggerOnNetworkChanged(); |
| 195 } | 203 } |
| 196 | |
| 197 // TODO(isheriff): Perhaps need new interface for invocation from DelayBasedBwe. | |
| 198 void BitrateControllerImpl::OnReceiveBitrateChanged( | |
| 199 const std::vector<uint32_t>& ssrcs, | |
| 200 uint32_t bitrate_bps) { | |
| 201 { | |
| 202 rtc::CritScope cs(&critsect_); | |
| 203 bandwidth_estimation_.UpdateDelayBasedEstimate(clock_->TimeInMilliseconds(), | |
| 204 bitrate_bps); | |
| 205 } | |
| 206 MaybeTriggerOnNetworkChanged(); | |
| 207 } | |
| 208 | 204 |
| 209 int64_t BitrateControllerImpl::TimeUntilNextProcess() { | 205 int64_t BitrateControllerImpl::TimeUntilNextProcess() { |
| 210 const int64_t kBitrateControllerUpdateIntervalMs = 25; | 206 const int64_t kBitrateControllerUpdateIntervalMs = 25; |
| 211 rtc::CritScope cs(&critsect_); | 207 rtc::CritScope cs(&critsect_); |
| 212 int64_t time_since_update_ms = | 208 int64_t time_since_update_ms = |
| 213 clock_->TimeInMilliseconds() - last_bitrate_update_ms_; | 209 clock_->TimeInMilliseconds() - last_bitrate_update_ms_; |
| 214 return std::max<int64_t>( | 210 return std::max<int64_t>( |
| 215 kBitrateControllerUpdateIntervalMs - time_since_update_ms, 0); | 211 kBitrateControllerUpdateIntervalMs - time_since_update_ms, 0); |
| 216 } | 212 } |
| 217 | 213 |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 bandwidth_estimation_.CurrentEstimate(&bitrate, &fraction_loss, &rtt); | 287 bandwidth_estimation_.CurrentEstimate(&bitrate, &fraction_loss, &rtt); |
| 292 if (bitrate > 0) { | 288 if (bitrate > 0) { |
| 293 bitrate = bitrate - std::min<int>(bitrate, reserved_bitrate_bps_); | 289 bitrate = bitrate - std::min<int>(bitrate, reserved_bitrate_bps_); |
| 294 bitrate = std::max(bitrate, bandwidth_estimation_.GetMinBitrate()); | 290 bitrate = std::max(bitrate, bandwidth_estimation_.GetMinBitrate()); |
| 295 *bandwidth = bitrate; | 291 *bandwidth = bitrate; |
| 296 return true; | 292 return true; |
| 297 } | 293 } |
| 298 return false; | 294 return false; |
| 299 } | 295 } |
| 300 } // namespace webrtc | 296 } // namespace webrtc |
| OLD | NEW |