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/send_side_congestion_cont
roller.h" | 11 #include "webrtc/modules/congestion_controller/include/send_side_congestion_cont
roller.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/ptr_util.h" | 19 #include "webrtc/base/ptr_util.h" |
20 #include "webrtc/base/rate_limiter.h" | 20 #include "webrtc/base/rate_limiter.h" |
21 #include "webrtc/base/socket.h" | 21 #include "webrtc/base/socket.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/acknowledge_bitrate_estimator.h" | 23 #include "webrtc/modules/congestion_controller/acknowledged_bitrate_estimator.h" |
24 #include "webrtc/modules/congestion_controller/probe_controller.h" | 24 #include "webrtc/modules/congestion_controller/probe_controller.h" |
25 #include "webrtc/modules/remote_bitrate_estimator/include/bwe_defines.h" | 25 #include "webrtc/modules/remote_bitrate_estimator/include/bwe_defines.h" |
26 | 26 |
27 namespace webrtc { | 27 namespace webrtc { |
28 namespace { | 28 namespace { |
29 | 29 |
30 static const int64_t kRetransmitWindowSizeMs = 500; | 30 static const int64_t kRetransmitWindowSizeMs = 500; |
31 | 31 |
32 // Makes sure that the bitrate and the min, max values are in valid range. | 32 // Makes sure that the bitrate and the min, max values are in valid range. |
33 static void ClampBitrates(int* bitrate_bps, | 33 static void ClampBitrates(int* bitrate_bps, |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 Observer* observer, | 82 Observer* observer, |
83 RtcEventLog* event_log, | 83 RtcEventLog* event_log, |
84 std::unique_ptr<PacedSender> pacer) | 84 std::unique_ptr<PacedSender> pacer) |
85 : clock_(clock), | 85 : clock_(clock), |
86 observer_(observer), | 86 observer_(observer), |
87 event_log_(event_log), | 87 event_log_(event_log), |
88 pacer_(std::move(pacer)), | 88 pacer_(std::move(pacer)), |
89 bitrate_controller_( | 89 bitrate_controller_( |
90 BitrateController::CreateBitrateController(clock_, event_log)), | 90 BitrateController::CreateBitrateController(clock_, event_log)), |
91 acknowledged_bitrate_estimator_( | 91 acknowledged_bitrate_estimator_( |
92 rtc::MakeUnique<AcknowledgedBitrateEstimator>()), | 92 rtc::MakeUnique<AcknowledgedBitrateEstimator>( |
| 93 rtc::MakeUnique<BitrateEstimatorCreator>())), |
93 probe_controller_(new ProbeController(pacer_.get(), clock_)), | 94 probe_controller_(new ProbeController(pacer_.get(), clock_)), |
94 retransmission_rate_limiter_( | 95 retransmission_rate_limiter_( |
95 new RateLimiter(clock, kRetransmitWindowSizeMs)), | 96 new RateLimiter(clock, kRetransmitWindowSizeMs)), |
96 transport_feedback_adapter_(clock_), | 97 transport_feedback_adapter_(clock_), |
97 last_reported_bitrate_bps_(0), | 98 last_reported_bitrate_bps_(0), |
98 last_reported_fraction_loss_(0), | 99 last_reported_fraction_loss_(0), |
99 last_reported_rtt_(0), | 100 last_reported_rtt_(0), |
100 network_state_(kNetworkUp), | 101 network_state_(kNetworkUp), |
101 min_bitrate_bps_(congestion_controller::GetMinBitrateBps()), | 102 min_bitrate_bps_(congestion_controller::GetMinBitrateBps()), |
102 delay_based_bwe_(new DelayBasedBwe(event_log_, clock_)) { | 103 delay_based_bwe_(new DelayBasedBwe(event_log_, clock_)) { |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 } | 272 } |
272 | 273 |
273 void SendSideCongestionController::OnTransportFeedback( | 274 void SendSideCongestionController::OnTransportFeedback( |
274 const rtcp::TransportFeedback& feedback) { | 275 const rtcp::TransportFeedback& feedback) { |
275 RTC_DCHECK_RUNS_SERIALIZED(&worker_race_); | 276 RTC_DCHECK_RUNS_SERIALIZED(&worker_race_); |
276 transport_feedback_adapter_.OnTransportFeedback(feedback); | 277 transport_feedback_adapter_.OnTransportFeedback(feedback); |
277 std::vector<PacketFeedback> feedback_vector = ReceivedPacketFeedbackVector( | 278 std::vector<PacketFeedback> feedback_vector = ReceivedPacketFeedbackVector( |
278 transport_feedback_adapter_.GetTransportFeedbackVector()); | 279 transport_feedback_adapter_.GetTransportFeedbackVector()); |
279 SortPacketFeedbackVector(&feedback_vector); | 280 SortPacketFeedbackVector(&feedback_vector); |
280 acknowledged_bitrate_estimator_->IncomingPacketFeedbackVector( | 281 acknowledged_bitrate_estimator_->IncomingPacketFeedbackVector( |
281 feedback_vector); | 282 feedback_vector, |
| 283 static_cast<bool>(pacer_->GetApplicationLimitedRegionStartTime())); |
282 DelayBasedBwe::Result result; | 284 DelayBasedBwe::Result result; |
283 { | 285 { |
284 rtc::CritScope cs(&bwe_lock_); | 286 rtc::CritScope cs(&bwe_lock_); |
285 result = delay_based_bwe_->IncomingPacketFeedbackVector( | 287 result = delay_based_bwe_->IncomingPacketFeedbackVector( |
286 feedback_vector, acknowledged_bitrate_estimator_->bitrate_bps()); | 288 feedback_vector, acknowledged_bitrate_estimator_->bitrate_bps()); |
287 } | 289 } |
288 if (result.updated) | 290 if (result.updated) |
289 bitrate_controller_->OnDelayBasedBweResult(result); | 291 bitrate_controller_->OnDelayBasedBweResult(result); |
290 } | 292 } |
291 | 293 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 bool SendSideCongestionController::IsSendQueueFull() const { | 349 bool SendSideCongestionController::IsSendQueueFull() const { |
348 return pacer_->ExpectedQueueTimeMs() > PacedSender::kMaxQueueLengthMs; | 350 return pacer_->ExpectedQueueTimeMs() > PacedSender::kMaxQueueLengthMs; |
349 } | 351 } |
350 | 352 |
351 bool SendSideCongestionController::IsNetworkDown() const { | 353 bool SendSideCongestionController::IsNetworkDown() const { |
352 rtc::CritScope cs(&network_state_lock_); | 354 rtc::CritScope cs(&network_state_lock_); |
353 return network_state_ == kNetworkDown; | 355 return network_state_ == kNetworkDown; |
354 } | 356 } |
355 | 357 |
356 } // namespace webrtc | 358 } // namespace webrtc |
OLD | NEW |