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

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

Issue 2516983004: Move ownership of PacketRouter from CongestionController to Call. (Closed)
Patch Set: Add back packet_router method and 4-argument constructor. Created 4 years 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
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 145
146 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(WrappingBitrateEstimator); 146 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(WrappingBitrateEstimator);
147 }; 147 };
148 148
149 } // namespace 149 } // namespace
150 150
151 CongestionController::CongestionController( 151 CongestionController::CongestionController(
152 Clock* clock, 152 Clock* clock,
153 Observer* observer, 153 Observer* observer,
154 RemoteBitrateObserver* remote_bitrate_observer, 154 RemoteBitrateObserver* remote_bitrate_observer,
155 RtcEventLog* event_log,
156 PacketRouter* packet_router)
157 : CongestionController(
158 clock,
159 observer,
160 remote_bitrate_observer,
161 event_log,
162 packet_router,
163 std::unique_ptr<PacedSender>(new PacedSender(clock, packet_router))) {
164 }
165
166 CongestionController::CongestionController(
167 Clock* clock,
168 Observer* observer,
169 RemoteBitrateObserver* remote_bitrate_observer,
155 RtcEventLog* event_log) 170 RtcEventLog* event_log)
156 : clock_(clock), 171 : CongestionController(clock, observer, remote_bitrate_observer, event_log,
157 observer_(observer), 172 new PacketRouter()) {
158 packet_router_(new PacketRouter()), 173 // Record ownership.
159 pacer_(new PacedSender(clock_, packet_router_.get())), 174 owned_packet_router_.reset(packet_router_);
160 remote_bitrate_estimator_(
161 new WrappingBitrateEstimator(remote_bitrate_observer, clock_)),
162 bitrate_controller_(
163 BitrateController::CreateBitrateController(clock_, event_log)),
164 probe_controller_(new ProbeController(pacer_.get(), clock_)),
165 retransmission_rate_limiter_(
166 new RateLimiter(clock, kRetransmitWindowSizeMs)),
167 remote_estimator_proxy_(clock_, packet_router_.get()),
168 transport_feedback_adapter_(clock_, bitrate_controller_.get()),
169 min_bitrate_bps_(congestion_controller::GetMinBitrateBps()),
170 max_bitrate_bps_(0),
171 last_reported_bitrate_bps_(0),
172 last_reported_fraction_loss_(0),
173 last_reported_rtt_(0),
174 network_state_(kNetworkUp) {
175 Init();
176 } 175 }
177 176
178 CongestionController::CongestionController( 177 CongestionController::CongestionController(
179 Clock* clock, 178 Clock* clock,
180 Observer* observer, 179 Observer* observer,
181 RemoteBitrateObserver* remote_bitrate_observer, 180 RemoteBitrateObserver* remote_bitrate_observer,
182 RtcEventLog* event_log, 181 RtcEventLog* event_log,
183 std::unique_ptr<PacketRouter> packet_router, 182 PacketRouter* packet_router,
184 std::unique_ptr<PacedSender> pacer) 183 std::unique_ptr<PacedSender> pacer)
185 : clock_(clock), 184 : clock_(clock),
186 observer_(observer), 185 observer_(observer),
187 packet_router_(std::move(packet_router)), 186 packet_router_(packet_router),
188 pacer_(std::move(pacer)), 187 pacer_(std::move(pacer)),
189 remote_bitrate_estimator_( 188 remote_bitrate_estimator_(
190 new WrappingBitrateEstimator(remote_bitrate_observer, clock_)), 189 new WrappingBitrateEstimator(remote_bitrate_observer, clock_)),
191 // Constructed last as this object calls the provided callback on 190 // Constructed last as this object calls the provided callback on
192 // construction. 191 // construction.
193 bitrate_controller_( 192 bitrate_controller_(
194 BitrateController::CreateBitrateController(clock_, event_log)), 193 BitrateController::CreateBitrateController(clock_, event_log)),
195 probe_controller_(new ProbeController(pacer_.get(), clock_)), 194 probe_controller_(new ProbeController(pacer_.get(), clock_)),
196 retransmission_rate_limiter_( 195 retransmission_rate_limiter_(
197 new RateLimiter(clock, kRetransmitWindowSizeMs)), 196 new RateLimiter(clock, kRetransmitWindowSizeMs)),
198 remote_estimator_proxy_(clock_, packet_router_.get()), 197 remote_estimator_proxy_(clock_, packet_router_),
199 transport_feedback_adapter_(clock_, bitrate_controller_.get()), 198 transport_feedback_adapter_(clock_, bitrate_controller_.get()),
200 min_bitrate_bps_(congestion_controller::GetMinBitrateBps()), 199 min_bitrate_bps_(congestion_controller::GetMinBitrateBps()),
201 max_bitrate_bps_(0), 200 max_bitrate_bps_(0),
202 last_reported_bitrate_bps_(0), 201 last_reported_bitrate_bps_(0),
203 last_reported_fraction_loss_(0), 202 last_reported_fraction_loss_(0),
204 last_reported_rtt_(0), 203 last_reported_rtt_(0),
205 network_state_(kNetworkUp) { 204 network_state_(kNetworkUp) {
206 Init(); 205 transport_feedback_adapter_.InitBwe();
206 transport_feedback_adapter_.SetMinBitrate(min_bitrate_bps_);
207 } 207 }
208 208
209 CongestionController::~CongestionController() {} 209 CongestionController::~CongestionController() {}
210 210
211 void CongestionController::Init() {
212 transport_feedback_adapter_.InitBwe();
213 transport_feedback_adapter_.SetMinBitrate(min_bitrate_bps_);
214 }
215
216 void CongestionController::SetBweBitrates(int min_bitrate_bps, 211 void CongestionController::SetBweBitrates(int min_bitrate_bps,
217 int start_bitrate_bps, 212 int start_bitrate_bps,
218 int max_bitrate_bps) { 213 int max_bitrate_bps) {
219 ClampBitrates(&start_bitrate_bps, &min_bitrate_bps, &max_bitrate_bps); 214 ClampBitrates(&start_bitrate_bps, &min_bitrate_bps, &max_bitrate_bps);
220 bitrate_controller_->SetBitrates(start_bitrate_bps, 215 bitrate_controller_->SetBitrates(start_bitrate_bps,
221 min_bitrate_bps, 216 min_bitrate_bps,
222 max_bitrate_bps); 217 max_bitrate_bps);
223 218
224 probe_controller_->SetBitrates(min_bitrate_bps, start_bitrate_bps, 219 probe_controller_->SetBitrates(min_bitrate_bps, start_bitrate_bps,
225 max_bitrate_bps); 220 max_bitrate_bps);
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 bool CongestionController::IsSendQueueFull() const { 369 bool CongestionController::IsSendQueueFull() const {
375 return pacer_->ExpectedQueueTimeMs() > PacedSender::kMaxQueueLengthMs; 370 return pacer_->ExpectedQueueTimeMs() > PacedSender::kMaxQueueLengthMs;
376 } 371 }
377 372
378 bool CongestionController::IsNetworkDown() const { 373 bool CongestionController::IsNetworkDown() const {
379 rtc::CritScope cs(&critsect_); 374 rtc::CritScope cs(&critsect_);
380 return network_state_ == kNetworkDown; 375 return network_state_ == kNetworkDown;
381 } 376 }
382 377
383 } // namespace webrtc 378 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/call/call.cc ('k') | webrtc/modules/congestion_controller/congestion_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698