| 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/constructormagic.h" | 18 #include "webrtc/base/constructormagic.h" |
| 19 #include "webrtc/base/logging.h" | 19 #include "webrtc/base/logging.h" |
| 20 #include "webrtc/base/socket.h" | 20 #include "webrtc/base/socket.h" |
| 21 #include "webrtc/base/thread_annotations.h" | 21 #include "webrtc/base/thread_annotations.h" |
| 22 #include "webrtc/modules/bitrate_controller/include/bitrate_controller.h" | 22 #include "webrtc/modules/bitrate_controller/include/bitrate_controller.h" |
| 23 #include "webrtc/modules/congestion_controller/delay_based_bwe.h" |
| 23 #include "webrtc/modules/remote_bitrate_estimator/include/send_time_history.h" | 24 #include "webrtc/modules/remote_bitrate_estimator/include/send_time_history.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_abs_s
end_time.h" |
| 25 #include "webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_singl
e_stream.h" | 26 #include "webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_singl
e_stream.h" |
| 26 #include "webrtc/modules/utility/include/process_thread.h" | 27 #include "webrtc/modules/utility/include/process_thread.h" |
| 27 #include "webrtc/system_wrappers/include/critical_section_wrapper.h" | 28 #include "webrtc/system_wrappers/include/critical_section_wrapper.h" |
| 28 #include "webrtc/video/payload_router.h" | 29 #include "webrtc/video/payload_router.h" |
| 29 | 30 |
| 30 namespace webrtc { | 31 namespace webrtc { |
| 31 namespace { | 32 namespace { |
| 32 | 33 |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 last_reported_fraction_loss_(0), | 201 last_reported_fraction_loss_(0), |
| 201 last_reported_rtt_(0), | 202 last_reported_rtt_(0), |
| 202 network_state_(kNetworkUp) { | 203 network_state_(kNetworkUp) { |
| 203 Init(); | 204 Init(); |
| 204 } | 205 } |
| 205 | 206 |
| 206 CongestionController::~CongestionController() {} | 207 CongestionController::~CongestionController() {} |
| 207 | 208 |
| 208 void CongestionController::Init() { | 209 void CongestionController::Init() { |
| 209 transport_feedback_adapter_.SetBitrateEstimator( | 210 transport_feedback_adapter_.SetBitrateEstimator( |
| 210 new RemoteBitrateEstimatorAbsSendTime(&transport_feedback_adapter_)); | 211 new DelayBasedBwe(&transport_feedback_adapter_)); |
| 211 transport_feedback_adapter_.GetBitrateEstimator()->SetMinBitrate( | 212 transport_feedback_adapter_.GetBitrateEstimator()->SetMinBitrate( |
| 212 min_bitrate_bps_); | 213 min_bitrate_bps_); |
| 213 } | 214 } |
| 214 | 215 |
| 215 | 216 |
| 216 void CongestionController::SetBweBitrates(int min_bitrate_bps, | 217 void CongestionController::SetBweBitrates(int min_bitrate_bps, |
| 217 int start_bitrate_bps, | 218 int start_bitrate_bps, |
| 218 int max_bitrate_bps) { | 219 int max_bitrate_bps) { |
| 219 // TODO(holmer): We should make sure the default bitrates are set to 10 kbps, | 220 // TODO(holmer): We should make sure the default bitrates are set to 10 kbps, |
| 220 // and that we don't try to set the min bitrate to 0 from any applications. | 221 // and that we don't try to set the min bitrate to 0 from any applications. |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 bool CongestionController::IsSendQueueFull() const { | 341 bool CongestionController::IsSendQueueFull() const { |
| 341 return pacer_->ExpectedQueueTimeMs() > PacedSender::kMaxQueueLengthMs; | 342 return pacer_->ExpectedQueueTimeMs() > PacedSender::kMaxQueueLengthMs; |
| 342 } | 343 } |
| 343 | 344 |
| 344 bool CongestionController::IsNetworkDown() const { | 345 bool CongestionController::IsNetworkDown() const { |
| 345 rtc::CritScope cs(&critsect_); | 346 rtc::CritScope cs(&critsect_); |
| 346 return network_state_ == kNetworkDown; | 347 return network_state_ == kNetworkDown; |
| 347 } | 348 } |
| 348 | 349 |
| 349 } // namespace webrtc | 350 } // namespace webrtc |
| OLD | NEW |