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 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 return retransmission_rate_limiter_.get(); | 302 return retransmission_rate_limiter_.get(); |
303 } | 303 } |
304 | 304 |
305 void CongestionController::SetAllocatedSendBitrateLimits( | 305 void CongestionController::SetAllocatedSendBitrateLimits( |
306 int min_send_bitrate_bps, | 306 int min_send_bitrate_bps, |
307 int max_padding_bitrate_bps) { | 307 int max_padding_bitrate_bps) { |
308 pacer_->SetSendBitrateLimits(min_send_bitrate_bps, max_padding_bitrate_bps); | 308 pacer_->SetSendBitrateLimits(min_send_bitrate_bps, max_padding_bitrate_bps); |
309 } | 309 } |
310 | 310 |
311 int64_t CongestionController::GetPacerQueuingDelayMs() const { | 311 int64_t CongestionController::GetPacerQueuingDelayMs() const { |
312 return pacer_->QueueInMs(); | 312 return IsNetworkDown() ? 0 : pacer_->QueueInMs(); |
313 } | 313 } |
314 | 314 |
315 void CongestionController::SignalNetworkState(NetworkState state) { | 315 void CongestionController::SignalNetworkState(NetworkState state) { |
316 LOG(LS_INFO) << "SignalNetworkState " | 316 LOG(LS_INFO) << "SignalNetworkState " |
317 << (state == kNetworkUp ? "Up" : "Down"); | 317 << (state == kNetworkUp ? "Up" : "Down"); |
318 if (state == kNetworkUp) { | 318 if (state == kNetworkUp) { |
319 pacer_->Resume(); | 319 pacer_->Resume(); |
320 } else { | 320 } else { |
321 pacer_->Pause(); | 321 pacer_->Pause(); |
322 } | 322 } |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 bool CongestionController::IsSendQueueFull() const { | 393 bool CongestionController::IsSendQueueFull() const { |
394 return pacer_->ExpectedQueueTimeMs() > PacedSender::kMaxQueueLengthMs; | 394 return pacer_->ExpectedQueueTimeMs() > PacedSender::kMaxQueueLengthMs; |
395 } | 395 } |
396 | 396 |
397 bool CongestionController::IsNetworkDown() const { | 397 bool CongestionController::IsNetworkDown() const { |
398 rtc::CritScope cs(&critsect_); | 398 rtc::CritScope cs(&critsect_); |
399 return network_state_ == kNetworkDown; | 399 return network_state_ == kNetworkDown; |
400 } | 400 } |
401 | 401 |
402 } // namespace webrtc | 402 } // namespace webrtc |
OLD | NEW |