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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 } | 173 } |
174 MaybeTriggerOnNetworkChanged(); | 174 MaybeTriggerOnNetworkChanged(); |
175 } | 175 } |
176 | 176 |
177 // This is called upon reception of REMB or TMMBR. | 177 // This is called upon reception of REMB or TMMBR. |
178 void BitrateControllerImpl::OnReceiverEstimatedBitrate(uint32_t bitrate) { | 178 void BitrateControllerImpl::OnReceiverEstimatedBitrate(uint32_t bitrate) { |
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::OnProbeBitrate(uint32_t bitrate_bps) { |
190 { | 190 { |
191 rtc::CritScope cs(&critsect_); | 191 rtc::CritScope cs(&critsect_); |
192 bandwidth_estimation_.SetSendBitrate(bitrate_bps); | 192 bandwidth_estimation_.SetSendBitrate(bitrate_bps); |
193 } | 193 } |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 if (*bitrate != last_bitrate_bps_ || *fraction_loss != last_fraction_loss_ || | 266 if (*bitrate != last_bitrate_bps_ || *fraction_loss != last_fraction_loss_ || |
267 *rtt != last_rtt_ms_ || | 267 *rtt != last_rtt_ms_ || |
268 last_reserved_bitrate_bps_ != reserved_bitrate_bps_) { | 268 last_reserved_bitrate_bps_ != reserved_bitrate_bps_) { |
269 last_bitrate_bps_ = *bitrate; | 269 last_bitrate_bps_ = *bitrate; |
270 last_fraction_loss_ = *fraction_loss; | 270 last_fraction_loss_ = *fraction_loss; |
271 last_rtt_ms_ = *rtt; | 271 last_rtt_ms_ = *rtt; |
272 last_reserved_bitrate_bps_ = reserved_bitrate_bps_; | 272 last_reserved_bitrate_bps_ = reserved_bitrate_bps_; |
273 new_bitrate = true; | 273 new_bitrate = true; |
274 } | 274 } |
275 | 275 |
276 BWE_TEST_LOGGING_PLOT(1, "fraction_loss_[%%]", clock_->TimeInMilliseconds(), | 276 BWE_TEST_LOGGING_PLOT(1, "fraction_loss_%", clock_->TimeInMilliseconds(), |
277 (last_fraction_loss_ * 100) / 256); | 277 (last_fraction_loss_ * 100) / 256); |
278 BWE_TEST_LOGGING_PLOT(1, "rtt[ms]", clock_->TimeInMilliseconds(), | 278 BWE_TEST_LOGGING_PLOT(1, "rtt_ms", clock_->TimeInMilliseconds(), |
279 last_rtt_ms_); | 279 last_rtt_ms_); |
280 BWE_TEST_LOGGING_PLOT(1, "Target_bitrate[kbps]", clock_->TimeInMilliseconds(), | 280 BWE_TEST_LOGGING_PLOT(1, "Target_bitrate_kbps", clock_->TimeInMilliseconds(), |
281 last_bitrate_bps_ / 1000); | 281 last_bitrate_bps_ / 1000); |
282 | 282 |
283 return new_bitrate; | 283 return new_bitrate; |
284 } | 284 } |
285 | 285 |
286 bool BitrateControllerImpl::AvailableBandwidth(uint32_t* bandwidth) const { | 286 bool BitrateControllerImpl::AvailableBandwidth(uint32_t* bandwidth) const { |
287 rtc::CritScope cs(&critsect_); | 287 rtc::CritScope cs(&critsect_); |
288 int bitrate; | 288 int bitrate; |
289 uint8_t fraction_loss; | 289 uint8_t fraction_loss; |
290 int64_t rtt; | 290 int64_t rtt; |
291 bandwidth_estimation_.CurrentEstimate(&bitrate, &fraction_loss, &rtt); | 291 bandwidth_estimation_.CurrentEstimate(&bitrate, &fraction_loss, &rtt); |
292 if (bitrate > 0) { | 292 if (bitrate > 0) { |
293 bitrate = bitrate - std::min<int>(bitrate, reserved_bitrate_bps_); | 293 bitrate = bitrate - std::min<int>(bitrate, reserved_bitrate_bps_); |
294 bitrate = std::max(bitrate, bandwidth_estimation_.GetMinBitrate()); | 294 bitrate = std::max(bitrate, bandwidth_estimation_.GetMinBitrate()); |
295 *bandwidth = bitrate; | 295 *bandwidth = bitrate; |
296 return true; | 296 return true; |
297 } | 297 } |
298 return false; | 298 return false; |
299 } | 299 } |
300 } // namespace webrtc | 300 } // namespace webrtc |
OLD | NEW |