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::OnDelayBasedBweResult( | 189 void BitrateControllerImpl::OnProbeBitrate(uint32_t bitrate_bps) { |
190 const DelayBasedBwe::Result& result) { | |
191 if (!result.updated) | |
192 return; | |
193 { | 190 { |
194 rtc::CritScope cs(&critsect_); | 191 rtc::CritScope cs(&critsect_); |
195 if (result.probe) { | 192 bandwidth_estimation_.SetSendBitrate(bitrate_bps); |
196 bandwidth_estimation_.SetSendBitrate(result.target_bitrate_bps); | |
197 } else { | |
198 bandwidth_estimation_.UpdateDelayBasedEstimate( | |
199 clock_->TimeInMilliseconds(), result.target_bitrate_bps); | |
200 } | |
201 } | 193 } |
202 MaybeTriggerOnNetworkChanged(); | 194 MaybeTriggerOnNetworkChanged(); |
203 } | 195 } |
| 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 } |
204 | 208 |
205 int64_t BitrateControllerImpl::TimeUntilNextProcess() { | 209 int64_t BitrateControllerImpl::TimeUntilNextProcess() { |
206 const int64_t kBitrateControllerUpdateIntervalMs = 25; | 210 const int64_t kBitrateControllerUpdateIntervalMs = 25; |
207 rtc::CritScope cs(&critsect_); | 211 rtc::CritScope cs(&critsect_); |
208 int64_t time_since_update_ms = | 212 int64_t time_since_update_ms = |
209 clock_->TimeInMilliseconds() - last_bitrate_update_ms_; | 213 clock_->TimeInMilliseconds() - last_bitrate_update_ms_; |
210 return std::max<int64_t>( | 214 return std::max<int64_t>( |
211 kBitrateControllerUpdateIntervalMs - time_since_update_ms, 0); | 215 kBitrateControllerUpdateIntervalMs - time_since_update_ms, 0); |
212 } | 216 } |
213 | 217 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 bandwidth_estimation_.CurrentEstimate(&bitrate, &fraction_loss, &rtt); | 291 bandwidth_estimation_.CurrentEstimate(&bitrate, &fraction_loss, &rtt); |
288 if (bitrate > 0) { | 292 if (bitrate > 0) { |
289 bitrate = bitrate - std::min<int>(bitrate, reserved_bitrate_bps_); | 293 bitrate = bitrate - std::min<int>(bitrate, reserved_bitrate_bps_); |
290 bitrate = std::max(bitrate, bandwidth_estimation_.GetMinBitrate()); | 294 bitrate = std::max(bitrate, bandwidth_estimation_.GetMinBitrate()); |
291 *bandwidth = bitrate; | 295 *bandwidth = bitrate; |
292 return true; | 296 return true; |
293 } | 297 } |
294 return false; | 298 return false; |
295 } | 299 } |
296 } // namespace webrtc | 300 } // namespace webrtc |
OLD | NEW |