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/modules/bitrate_controller/include/bitrate_controller.h" | 17 #include "webrtc/modules/bitrate_controller/include/bitrate_controller.h" |
18 #include "webrtc/modules/congestion_controller/acknowledge_bitrate_estimator.h" | 18 #include "webrtc/modules/congestion_controller/acknowledged_bitrate_estimator.h" |
19 #include "webrtc/modules/congestion_controller/probe_controller.h" | 19 #include "webrtc/modules/congestion_controller/probe_controller.h" |
20 #include "webrtc/modules/pacing/alr_detector.h" | |
20 #include "webrtc/modules/remote_bitrate_estimator/include/bwe_defines.h" | 21 #include "webrtc/modules/remote_bitrate_estimator/include/bwe_defines.h" |
21 #include "webrtc/rtc_base/checks.h" | 22 #include "webrtc/rtc_base/checks.h" |
22 #include "webrtc/rtc_base/logging.h" | 23 #include "webrtc/rtc_base/logging.h" |
23 #include "webrtc/rtc_base/ptr_util.h" | 24 #include "webrtc/rtc_base/ptr_util.h" |
24 #include "webrtc/rtc_base/rate_limiter.h" | 25 #include "webrtc/rtc_base/rate_limiter.h" |
25 #include "webrtc/rtc_base/socket.h" | 26 #include "webrtc/rtc_base/socket.h" |
27 #include "webrtc/rtc_base/timeutils.h" | |
26 | 28 |
27 namespace webrtc { | 29 namespace webrtc { |
30 | |
28 namespace { | 31 namespace { |
29 | 32 |
30 static const int64_t kRetransmitWindowSizeMs = 500; | 33 static const int64_t kRetransmitWindowSizeMs = 500; |
31 | 34 |
32 // 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. |
33 static void ClampBitrates(int* bitrate_bps, | 36 static void ClampBitrates(int* bitrate_bps, |
34 int* min_bitrate_bps, | 37 int* min_bitrate_bps, |
35 int* max_bitrate_bps) { | 38 int* max_bitrate_bps) { |
36 // TODO(holmer): We should make sure the default bitrates are set to 10 kbps, | 39 // TODO(holmer): We should make sure the default bitrates are set to 10 kbps, |
37 // and that we don't try to set the min bitrate to 0 from any applications. | 40 // and that we don't try to set the min bitrate to 0 from any applications. |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
270 pacing_info); | 273 pacing_info); |
271 } | 274 } |
272 | 275 |
273 void SendSideCongestionController::OnTransportFeedback( | 276 void SendSideCongestionController::OnTransportFeedback( |
274 const rtcp::TransportFeedback& feedback) { | 277 const rtcp::TransportFeedback& feedback) { |
275 RTC_DCHECK_RUNS_SERIALIZED(&worker_race_); | 278 RTC_DCHECK_RUNS_SERIALIZED(&worker_race_); |
276 transport_feedback_adapter_.OnTransportFeedback(feedback); | 279 transport_feedback_adapter_.OnTransportFeedback(feedback); |
277 std::vector<PacketFeedback> feedback_vector = ReceivedPacketFeedbackVector( | 280 std::vector<PacketFeedback> feedback_vector = ReceivedPacketFeedbackVector( |
278 transport_feedback_adapter_.GetTransportFeedbackVector()); | 281 transport_feedback_adapter_.GetTransportFeedbackVector()); |
279 SortPacketFeedbackVector(&feedback_vector); | 282 SortPacketFeedbackVector(&feedback_vector); |
283 | |
284 rtc::Optional<int64_t> alr_start_time_ms = | |
terelius
2017/07/14 15:44:52
If we are never going to use the value, could we c
tschumi
2017/07/17 06:41:04
Done.
| |
285 pacer_->GetApplicationLimitedRegionStartTime(); | |
286 if (!alr_start_time_ms && last_alr_start_time_ms_) { | |
287 acknowledged_bitrate_estimator_->SetAlrEndedTimeMs(rtc::TimeMillis()); | |
288 } | |
289 last_alr_start_time_ms_ = alr_start_time_ms; | |
290 | |
280 acknowledged_bitrate_estimator_->IncomingPacketFeedbackVector( | 291 acknowledged_bitrate_estimator_->IncomingPacketFeedbackVector( |
281 feedback_vector); | 292 feedback_vector); |
282 DelayBasedBwe::Result result; | 293 DelayBasedBwe::Result result; |
283 { | 294 { |
284 rtc::CritScope cs(&bwe_lock_); | 295 rtc::CritScope cs(&bwe_lock_); |
285 result = delay_based_bwe_->IncomingPacketFeedbackVector( | 296 result = delay_based_bwe_->IncomingPacketFeedbackVector( |
286 feedback_vector, acknowledged_bitrate_estimator_->bitrate_bps()); | 297 feedback_vector, acknowledged_bitrate_estimator_->bitrate_bps()); |
287 } | 298 } |
288 if (result.updated) | 299 if (result.updated) |
289 bitrate_controller_->OnDelayBasedBweResult(result); | 300 bitrate_controller_->OnDelayBasedBweResult(result); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
347 bool SendSideCongestionController::IsSendQueueFull() const { | 358 bool SendSideCongestionController::IsSendQueueFull() const { |
348 return pacer_->ExpectedQueueTimeMs() > PacedSender::kMaxQueueLengthMs; | 359 return pacer_->ExpectedQueueTimeMs() > PacedSender::kMaxQueueLengthMs; |
349 } | 360 } |
350 | 361 |
351 bool SendSideCongestionController::IsNetworkDown() const { | 362 bool SendSideCongestionController::IsNetworkDown() const { |
352 rtc::CritScope cs(&network_state_lock_); | 363 rtc::CritScope cs(&network_state_lock_); |
353 return network_state_ == kNetworkDown; | 364 return network_state_ == kNetworkDown; |
354 } | 365 } |
355 | 366 |
356 } // namespace webrtc | 367 } // namespace webrtc |
OLD | NEW |