Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(496)

Side by Side Diff: webrtc/modules/congestion_controller/congestion_controller.cc

Issue 2340763004: Add AlrDetector (Closed)
Patch Set: Addressed comments Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/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/base/thread_annotations.h" 22 #include "webrtc/base/thread_annotations.h"
23 #include "webrtc/modules/bitrate_controller/include/bitrate_controller.h" 23 #include "webrtc/modules/bitrate_controller/include/bitrate_controller.h"
24 #include "webrtc/modules/congestion_controller/delay_based_bwe.h" 24 #include "webrtc/modules/congestion_controller/delay_based_bwe.h"
25 #include "webrtc/modules/congestion_controller/probe_controller.h" 25 #include "webrtc/modules/congestion_controller/probe_controller.h"
26 #include "webrtc/modules/congestion_controller/alr_detector.h"
26 #include "webrtc/modules/remote_bitrate_estimator/include/send_time_history.h" 27 #include "webrtc/modules/remote_bitrate_estimator/include/send_time_history.h"
27 #include "webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_s end_time.h" 28 #include "webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_s end_time.h"
28 #include "webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_singl e_stream.h" 29 #include "webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_singl e_stream.h"
29 #include "webrtc/modules/utility/include/process_thread.h" 30 #include "webrtc/modules/utility/include/process_thread.h"
30 #include "webrtc/system_wrappers/include/critical_section_wrapper.h" 31 #include "webrtc/system_wrappers/include/critical_section_wrapper.h"
31 #include "webrtc/video/payload_router.h" 32 #include "webrtc/video/payload_router.h"
32 33
33 namespace webrtc { 34 namespace webrtc {
34 namespace { 35 namespace {
35 36
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 } // namespace 156 } // namespace
156 157
157 CongestionController::CongestionController( 158 CongestionController::CongestionController(
158 Clock* clock, 159 Clock* clock,
159 Observer* observer, 160 Observer* observer,
160 RemoteBitrateObserver* remote_bitrate_observer, 161 RemoteBitrateObserver* remote_bitrate_observer,
161 RtcEventLog* event_log) 162 RtcEventLog* event_log)
162 : clock_(clock), 163 : clock_(clock),
163 observer_(observer), 164 observer_(observer),
164 packet_router_(new PacketRouter()), 165 packet_router_(new PacketRouter()),
165 pacer_(new PacedSender(clock_, packet_router_.get())), 166 alr_detector_(new AlrDetector()),
167 pacer_(
168 new PacedSender(clock_, packet_router_.get(), alr_detector_.get())),
166 remote_bitrate_estimator_( 169 remote_bitrate_estimator_(
167 new WrappingBitrateEstimator(remote_bitrate_observer, clock_)), 170 new WrappingBitrateEstimator(remote_bitrate_observer, clock_)),
168 bitrate_controller_( 171 bitrate_controller_(
169 BitrateController::CreateBitrateController(clock_, event_log)), 172 BitrateController::CreateBitrateController(clock_, event_log)),
170 probe_controller_(new ProbeController(pacer_.get(), clock_)), 173 probe_controller_(new ProbeController(pacer_.get(), clock_)),
171 retransmission_rate_limiter_( 174 retransmission_rate_limiter_(
172 new RateLimiter(clock, kRetransmitWindowSizeMs)), 175 new RateLimiter(clock, kRetransmitWindowSizeMs)),
173 remote_estimator_proxy_(clock_, packet_router_.get()), 176 remote_estimator_proxy_(clock_, packet_router_.get()),
174 transport_feedback_adapter_(clock_), 177 transport_feedback_adapter_(clock_),
175 min_bitrate_bps_(RemoteBitrateEstimator::kDefaultMinBitrateBps), 178 min_bitrate_bps_(RemoteBitrateEstimator::kDefaultMinBitrateBps),
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 return; 342 return;
340 343
341 uint32_t bitrate_bps; 344 uint32_t bitrate_bps;
342 uint8_t fraction_loss; 345 uint8_t fraction_loss;
343 int64_t rtt; 346 int64_t rtt;
344 bool estimate_changed = bitrate_controller_->GetNetworkParameters( 347 bool estimate_changed = bitrate_controller_->GetNetworkParameters(
345 &bitrate_bps, &fraction_loss, &rtt); 348 &bitrate_bps, &fraction_loss, &rtt);
346 if (estimate_changed) { 349 if (estimate_changed) {
347 pacer_->SetEstimatedBitrate(bitrate_bps); 350 pacer_->SetEstimatedBitrate(bitrate_bps);
348 probe_controller_->SetEstimatedBitrate(bitrate_bps); 351 probe_controller_->SetEstimatedBitrate(bitrate_bps);
352 alr_detector_->SetEstimatedBitrate(bitrate_bps);
349 retransmission_rate_limiter_->SetMaxRate(bitrate_bps); 353 retransmission_rate_limiter_->SetMaxRate(bitrate_bps);
350 } 354 }
351 355
352 bitrate_bps = IsNetworkDown() || IsSendQueueFull() ? 0 : bitrate_bps; 356 bitrate_bps = IsNetworkDown() || IsSendQueueFull() ? 0 : bitrate_bps;
353 357
354 if (HasNetworkParametersToReportChanged(bitrate_bps, fraction_loss, rtt)) { 358 if (HasNetworkParametersToReportChanged(bitrate_bps, fraction_loss, rtt)) {
355 observer_->OnNetworkChanged(bitrate_bps, fraction_loss, rtt); 359 observer_->OnNetworkChanged(bitrate_bps, fraction_loss, rtt);
356 } 360 }
357 } 361 }
358 362
(...skipping 19 matching lines...) Expand all
378 bool CongestionController::IsSendQueueFull() const { 382 bool CongestionController::IsSendQueueFull() const {
379 return pacer_->ExpectedQueueTimeMs() > PacedSender::kMaxQueueLengthMs; 383 return pacer_->ExpectedQueueTimeMs() > PacedSender::kMaxQueueLengthMs;
380 } 384 }
381 385
382 bool CongestionController::IsNetworkDown() const { 386 bool CongestionController::IsNetworkDown() const {
383 rtc::CritScope cs(&critsect_); 387 rtc::CritScope cs(&critsect_);
384 return network_state_ == kNetworkDown; 388 return network_state_ == kNetworkDown;
385 } 389 }
386 390
387 } // namespace webrtc 391 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698