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 |
11 #include "webrtc/modules/congestion_controller/include/congestion_controller.h" | 11 #include "webrtc/modules/congestion_controller/include/congestion_controller.h" |
12 | 12 |
13 #include <algorithm> | 13 #include <algorithm> |
14 #include <memory> | 14 #include <memory> |
15 #include <vector> | 15 #include <vector> |
16 | 16 |
17 #include "webrtc/base/checks.h" | 17 #include "webrtc/base/checks.h" |
18 #include "webrtc/base/logging.h" | 18 #include "webrtc/base/logging.h" |
19 #include "webrtc/base/rate_limiter.h" | 19 #include "webrtc/base/rate_limiter.h" |
20 #include "webrtc/base/socket.h" | 20 #include "webrtc/base/socket.h" |
21 #include "webrtc/modules/bitrate_controller/include/bitrate_controller.h" | 21 #include "webrtc/modules/bitrate_controller/include/bitrate_controller.h" |
22 #include "webrtc/modules/congestion_controller/probe_controller.h" | 22 #include "webrtc/modules/congestion_controller/probe_controller.h" |
23 #include "webrtc/modules/remote_bitrate_estimator/include/bwe_defines.h" | 23 #include "webrtc/modules/remote_bitrate_estimator/include/bwe_defines.h" |
24 #include "webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_s
end_time.h" | 24 #include "webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_s
end_time.h" |
25 #include "webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_singl
e_stream.h" | 25 #include "webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_singl
e_stream.h" |
| 26 #include "webrtc/modules/rtp_rtcp/source/rtp_header_extension.h" |
26 #include "webrtc/system_wrappers/include/critical_section_wrapper.h" | 27 #include "webrtc/system_wrappers/include/critical_section_wrapper.h" |
27 | 28 |
28 namespace webrtc { | 29 namespace webrtc { |
29 namespace { | 30 namespace { |
30 | 31 |
31 static const uint32_t kTimeOffsetSwitchThreshold = 30; | 32 static const uint32_t kTimeOffsetSwitchThreshold = 30; |
32 static const int64_t kRetransmitWindowSizeMs = 500; | 33 static const int64_t kRetransmitWindowSizeMs = 500; |
33 | 34 |
34 // Makes sure that the bitrate and the min, max values are in valid range. | 35 // Makes sure that the bitrate and the min, max values are in valid range. |
35 static void ClampBitrates(int* bitrate_bps, | 36 static void ClampBitrates(int* bitrate_bps, |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 } | 268 } |
268 | 269 |
269 RateLimiter* CongestionController::GetRetransmissionRateLimiter() { | 270 RateLimiter* CongestionController::GetRetransmissionRateLimiter() { |
270 return retransmission_rate_limiter_.get(); | 271 return retransmission_rate_limiter_.get(); |
271 } | 272 } |
272 | 273 |
273 void CongestionController::EnablePeriodicAlrProbing(bool enable) { | 274 void CongestionController::EnablePeriodicAlrProbing(bool enable) { |
274 probe_controller_->EnablePeriodicAlrProbing(enable); | 275 probe_controller_->EnablePeriodicAlrProbing(enable); |
275 } | 276 } |
276 | 277 |
| 278 bool CongestionController::UseSendSideBwe( |
| 279 bool transport_cc, |
| 280 const RtpHeaderExtensionMap& rtp_header_extensions) { |
| 281 // Has the RTCP feedback message been negotiated? |
| 282 if (!transport_cc) |
| 283 return false; |
| 284 // Has the RTP header extension been negotiated? |
| 285 return rtp_header_extensions.IsRegistered( |
| 286 kRtpExtensionTransportSequenceNumber); |
| 287 } |
| 288 |
277 void CongestionController::SetAllocatedSendBitrateLimits( | 289 void CongestionController::SetAllocatedSendBitrateLimits( |
278 int min_send_bitrate_bps, | 290 int min_send_bitrate_bps, |
279 int max_padding_bitrate_bps) { | 291 int max_padding_bitrate_bps) { |
280 pacer_->SetSendBitrateLimits(min_send_bitrate_bps, max_padding_bitrate_bps); | 292 pacer_->SetSendBitrateLimits(min_send_bitrate_bps, max_padding_bitrate_bps); |
281 } | 293 } |
282 | 294 |
283 int64_t CongestionController::GetPacerQueuingDelayMs() const { | 295 int64_t CongestionController::GetPacerQueuingDelayMs() const { |
284 return IsNetworkDown() ? 0 : pacer_->QueueInMs(); | 296 return IsNetworkDown() ? 0 : pacer_->QueueInMs(); |
285 } | 297 } |
286 | 298 |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 bool CongestionController::IsSendQueueFull() const { | 383 bool CongestionController::IsSendQueueFull() const { |
372 return pacer_->ExpectedQueueTimeMs() > PacedSender::kMaxQueueLengthMs; | 384 return pacer_->ExpectedQueueTimeMs() > PacedSender::kMaxQueueLengthMs; |
373 } | 385 } |
374 | 386 |
375 bool CongestionController::IsNetworkDown() const { | 387 bool CongestionController::IsNetworkDown() const { |
376 rtc::CritScope cs(&critsect_); | 388 rtc::CritScope cs(&critsect_); |
377 return network_state_ == kNetworkDown; | 389 return network_state_ == kNetworkDown; |
378 } | 390 } |
379 | 391 |
380 } // namespace webrtc | 392 } // namespace webrtc |
OLD | NEW |