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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 } | 182 } |
183 MaybeTriggerOnNetworkChanged(); | 183 MaybeTriggerOnNetworkChanged(); |
184 } | 184 } |
185 | 185 |
186 void BitrateControllerImpl::OnDelayBasedBweResult( | 186 void BitrateControllerImpl::OnDelayBasedBweResult( |
187 const DelayBasedBwe::Result& result) { | 187 const DelayBasedBwe::Result& result) { |
188 if (!result.updated) | 188 if (!result.updated) |
189 return; | 189 return; |
190 { | 190 { |
191 rtc::CritScope cs(&critsect_); | 191 rtc::CritScope cs(&critsect_); |
| 192 bandwidth_estimation_.UpdateDelayBasedEstimate(clock_->TimeInMilliseconds(), |
| 193 result.target_bitrate_bps); |
192 if (result.probe) { | 194 if (result.probe) { |
193 bandwidth_estimation_.SetSendBitrate(result.target_bitrate_bps); | 195 bandwidth_estimation_.SetSendBitrate(result.target_bitrate_bps); |
194 } else { | |
195 bandwidth_estimation_.UpdateDelayBasedEstimate( | |
196 clock_->TimeInMilliseconds(), result.target_bitrate_bps); | |
197 } | 196 } |
198 } | 197 } |
199 MaybeTriggerOnNetworkChanged(); | 198 MaybeTriggerOnNetworkChanged(); |
200 } | 199 } |
201 | 200 |
202 int64_t BitrateControllerImpl::TimeUntilNextProcess() { | 201 int64_t BitrateControllerImpl::TimeUntilNextProcess() { |
203 const int64_t kBitrateControllerUpdateIntervalMs = 25; | 202 const int64_t kBitrateControllerUpdateIntervalMs = 25; |
204 rtc::CritScope cs(&critsect_); | 203 rtc::CritScope cs(&critsect_); |
205 int64_t time_since_update_ms = | 204 int64_t time_since_update_ms = |
206 clock_->TimeInMilliseconds() - last_bitrate_update_ms_; | 205 clock_->TimeInMilliseconds() - last_bitrate_update_ms_; |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 bandwidth_estimation_.CurrentEstimate(&bitrate, &fraction_loss, &rtt); | 283 bandwidth_estimation_.CurrentEstimate(&bitrate, &fraction_loss, &rtt); |
285 if (bitrate > 0) { | 284 if (bitrate > 0) { |
286 bitrate = bitrate - std::min<int>(bitrate, reserved_bitrate_bps_); | 285 bitrate = bitrate - std::min<int>(bitrate, reserved_bitrate_bps_); |
287 bitrate = std::max(bitrate, bandwidth_estimation_.GetMinBitrate()); | 286 bitrate = std::max(bitrate, bandwidth_estimation_.GetMinBitrate()); |
288 *bandwidth = bitrate; | 287 *bandwidth = bitrate; |
289 return true; | 288 return true; |
290 } | 289 } |
291 return false; | 290 return false; |
292 } | 291 } |
293 } // namespace webrtc | 292 } // namespace webrtc |
OLD | NEW |