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 |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 uint32_t packets_since_absolute_send_time_; | 146 uint32_t packets_since_absolute_send_time_; |
147 int min_bitrate_bps_; | 147 int min_bitrate_bps_; |
148 | 148 |
149 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(WrappingBitrateEstimator); | 149 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(WrappingBitrateEstimator); |
150 }; | 150 }; |
151 | 151 |
152 } // namespace | 152 } // namespace |
153 | 153 |
154 CongestionController::CongestionController( | 154 CongestionController::CongestionController( |
155 Clock* clock, | 155 Clock* clock, |
156 BitrateObserver* bitrate_observer, | |
157 RemoteBitrateObserver* remote_bitrate_observer) | |
158 : clock_(clock), | |
159 observer_(nullptr), | |
160 packet_router_(new PacketRouter()), | |
161 pacer_(new PacedSender(clock_, packet_router_.get())), | |
162 remote_bitrate_estimator_( | |
163 new WrappingBitrateEstimator(remote_bitrate_observer, clock_)), | |
164 bitrate_controller_( | |
165 BitrateController::CreateBitrateController(clock_, bitrate_observer)), | |
166 remote_estimator_proxy_(clock_, packet_router_.get()), | |
167 transport_feedback_adapter_(bitrate_controller_.get(), clock_), | |
168 min_bitrate_bps_(RemoteBitrateEstimator::kDefaultMinBitrateBps), | |
169 last_reported_bitrate_bps_(0), | |
170 last_reported_fraction_loss_(0), | |
171 last_reported_rtt_(0), | |
172 network_state_(kNetworkUp) { | |
173 Init(); | |
174 } | |
175 | |
176 CongestionController::CongestionController( | |
177 Clock* clock, | |
178 Observer* observer, | 156 Observer* observer, |
179 RemoteBitrateObserver* remote_bitrate_observer) | 157 RemoteBitrateObserver* remote_bitrate_observer, |
| 158 RtcEventLog* event_log) |
180 : clock_(clock), | 159 : clock_(clock), |
181 observer_(observer), | 160 observer_(observer), |
182 packet_router_(new PacketRouter()), | 161 packet_router_(new PacketRouter()), |
183 pacer_(new PacedSender(clock_, packet_router_.get())), | 162 pacer_(new PacedSender(clock_, packet_router_.get())), |
184 remote_bitrate_estimator_( | 163 remote_bitrate_estimator_( |
185 new WrappingBitrateEstimator(remote_bitrate_observer, clock_)), | 164 new WrappingBitrateEstimator(remote_bitrate_observer, clock_)), |
186 bitrate_controller_(BitrateController::CreateBitrateController(clock_)), | 165 bitrate_controller_( |
| 166 BitrateController::CreateBitrateController(clock_, event_log)), |
187 remote_estimator_proxy_(clock_, packet_router_.get()), | 167 remote_estimator_proxy_(clock_, packet_router_.get()), |
188 transport_feedback_adapter_(bitrate_controller_.get(), clock_), | 168 transport_feedback_adapter_(bitrate_controller_.get(), clock_), |
189 min_bitrate_bps_(RemoteBitrateEstimator::kDefaultMinBitrateBps), | 169 min_bitrate_bps_(RemoteBitrateEstimator::kDefaultMinBitrateBps), |
190 last_reported_bitrate_bps_(0), | 170 last_reported_bitrate_bps_(0), |
191 last_reported_fraction_loss_(0), | 171 last_reported_fraction_loss_(0), |
192 last_reported_rtt_(0), | 172 last_reported_rtt_(0), |
193 network_state_(kNetworkUp) { | 173 network_state_(kNetworkUp) { |
194 Init(); | 174 Init(); |
195 } | 175 } |
196 | 176 |
197 CongestionController::CongestionController( | 177 CongestionController::CongestionController( |
198 Clock* clock, | 178 Clock* clock, |
199 Observer* observer, | 179 Observer* observer, |
200 RemoteBitrateObserver* remote_bitrate_observer, | 180 RemoteBitrateObserver* remote_bitrate_observer, |
| 181 RtcEventLog* event_log, |
201 std::unique_ptr<PacketRouter> packet_router, | 182 std::unique_ptr<PacketRouter> packet_router, |
202 std::unique_ptr<PacedSender> pacer) | 183 std::unique_ptr<PacedSender> pacer) |
203 : clock_(clock), | 184 : clock_(clock), |
204 observer_(observer), | 185 observer_(observer), |
205 packet_router_(std::move(packet_router)), | 186 packet_router_(std::move(packet_router)), |
206 pacer_(std::move(pacer)), | 187 pacer_(std::move(pacer)), |
207 remote_bitrate_estimator_( | 188 remote_bitrate_estimator_( |
208 new WrappingBitrateEstimator(remote_bitrate_observer, clock_)), | 189 new WrappingBitrateEstimator(remote_bitrate_observer, clock_)), |
209 // Constructed last as this object calls the provided callback on | 190 // Constructed last as this object calls the provided callback on |
210 // construction. | 191 // construction. |
211 bitrate_controller_(BitrateController::CreateBitrateController(clock_)), | 192 bitrate_controller_( |
| 193 BitrateController::CreateBitrateController(clock_, event_log)), |
212 remote_estimator_proxy_(clock_, packet_router_.get()), | 194 remote_estimator_proxy_(clock_, packet_router_.get()), |
213 transport_feedback_adapter_(bitrate_controller_.get(), clock_), | 195 transport_feedback_adapter_(bitrate_controller_.get(), clock_), |
214 min_bitrate_bps_(RemoteBitrateEstimator::kDefaultMinBitrateBps), | 196 min_bitrate_bps_(RemoteBitrateEstimator::kDefaultMinBitrateBps), |
215 last_reported_bitrate_bps_(0), | 197 last_reported_bitrate_bps_(0), |
216 last_reported_fraction_loss_(0), | 198 last_reported_fraction_loss_(0), |
217 last_reported_rtt_(0), | 199 last_reported_rtt_(0), |
218 network_state_(kNetworkUp) { | 200 network_state_(kNetworkUp) { |
219 Init(); | 201 Init(); |
220 } | 202 } |
221 | 203 |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 bool CongestionController::IsSendQueueFull() const { | 349 bool CongestionController::IsSendQueueFull() const { |
368 return pacer_->ExpectedQueueTimeMs() > PacedSender::kMaxQueueLengthMs; | 350 return pacer_->ExpectedQueueTimeMs() > PacedSender::kMaxQueueLengthMs; |
369 } | 351 } |
370 | 352 |
371 bool CongestionController::IsNetworkDown() const { | 353 bool CongestionController::IsNetworkDown() const { |
372 rtc::CritScope cs(&critsect_); | 354 rtc::CritScope cs(&critsect_); |
373 return network_state_ == kNetworkDown; | 355 return network_state_ == kNetworkDown; |
374 } | 356 } |
375 | 357 |
376 } // namespace webrtc | 358 } // namespace webrtc |
OLD | NEW |