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 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
320 transport_feedback_adapter_.OnSentPacket(sent_packet.packet_id, | 320 transport_feedback_adapter_.OnSentPacket(sent_packet.packet_id, |
321 sent_packet.send_time_ms); | 321 sent_packet.send_time_ms); |
322 } | 322 } |
323 | 323 |
324 void CongestionController::OnRttUpdate(int64_t avg_rtt_ms, int64_t max_rtt_ms) { | 324 void CongestionController::OnRttUpdate(int64_t avg_rtt_ms, int64_t max_rtt_ms) { |
325 remote_bitrate_estimator_->OnRttUpdate(avg_rtt_ms, max_rtt_ms); | 325 remote_bitrate_estimator_->OnRttUpdate(avg_rtt_ms, max_rtt_ms); |
326 transport_feedback_adapter_.OnRttUpdate(avg_rtt_ms, max_rtt_ms); | 326 transport_feedback_adapter_.OnRttUpdate(avg_rtt_ms, max_rtt_ms); |
327 } | 327 } |
328 | 328 |
329 int64_t CongestionController::TimeUntilNextProcess() { | 329 int64_t CongestionController::TimeUntilNextProcess() { |
330 return std::min(bitrate_controller_->TimeUntilNextProcess(), | 330 // TODO(nisse): Any prettier way to get the minimum of 4 values? |
331 remote_bitrate_estimator_->TimeUntilNextProcess()); | 331 #if 0 |
332 return std::min(std::min(bitrate_controller_->TimeUntilNextProcess(), | |
333 remote_bitrate_estimator_->TimeUntilNextProcess()), | |
334 std::min(pacer_->TimeUntilNextProcess(), | |
335 remote_estimator_proxy_.TimeUntilNextProcess())); | |
336 #else | |
337 // TODO(nisse): I think this is C++11. Ok? | |
stefan-webrtc
2017/01/16 15:42:46
I think this should be fine
nisse-webrtc
2017/01/16 16:14:03
Nice, doing it this way then.
| |
338 return std::min({bitrate_controller_->TimeUntilNextProcess(), | |
339 remote_bitrate_estimator_->TimeUntilNextProcess(), | |
340 pacer_->TimeUntilNextProcess(), | |
341 remote_estimator_proxy_.TimeUntilNextProcess()}); | |
342 #endif | |
332 } | 343 } |
333 | 344 |
334 void CongestionController::Process() { | 345 void CongestionController::Process() { |
335 bitrate_controller_->Process(); | 346 bitrate_controller_->Process(); |
336 remote_bitrate_estimator_->Process(); | 347 remote_bitrate_estimator_->Process(); |
337 probe_controller_->Process(); | 348 probe_controller_->Process(); |
349 pacer_->Process(); | |
350 remote_estimator_proxy_.Process(); | |
338 MaybeTriggerOnNetworkChanged(); | 351 MaybeTriggerOnNetworkChanged(); |
339 } | 352 } |
340 | 353 |
341 void CongestionController::MaybeTriggerOnNetworkChanged() { | 354 void CongestionController::MaybeTriggerOnNetworkChanged() { |
342 // TODO(perkj): |observer_| can be nullptr if the ctor that accepts a | 355 // TODO(perkj): |observer_| can be nullptr if the ctor that accepts a |
343 // BitrateObserver is used. Remove this check once the ctor is removed. | 356 // BitrateObserver is used. Remove this check once the ctor is removed. |
344 if (!observer_) | 357 if (!observer_) |
345 return; | 358 return; |
346 | 359 |
347 uint32_t bitrate_bps; | 360 uint32_t bitrate_bps; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
387 bool CongestionController::IsSendQueueFull() const { | 400 bool CongestionController::IsSendQueueFull() const { |
388 return pacer_->ExpectedQueueTimeMs() > PacedSender::kMaxQueueLengthMs; | 401 return pacer_->ExpectedQueueTimeMs() > PacedSender::kMaxQueueLengthMs; |
389 } | 402 } |
390 | 403 |
391 bool CongestionController::IsNetworkDown() const { | 404 bool CongestionController::IsNetworkDown() const { |
392 rtc::CritScope cs(&critsect_); | 405 rtc::CritScope cs(&critsect_); |
393 return network_state_ == kNetworkDown; | 406 return network_state_ == kNetworkDown; |
394 } | 407 } |
395 | 408 |
396 } // namespace webrtc | 409 } // namespace webrtc |
OLD | NEW |