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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 using_absolute_send_time_ = false; | 124 using_absolute_send_time_ = false; |
125 PickEstimator(); | 125 PickEstimator(); |
126 } | 126 } |
127 } | 127 } |
128 } | 128 } |
129 } | 129 } |
130 | 130 |
131 // Instantiate RBE for Time Offset or Absolute Send Time extensions. | 131 // Instantiate RBE for Time Offset or Absolute Send Time extensions. |
132 void PickEstimator() EXCLUSIVE_LOCKS_REQUIRED(crit_sect_.get()) { | 132 void PickEstimator() EXCLUSIVE_LOCKS_REQUIRED(crit_sect_.get()) { |
133 if (using_absolute_send_time_) { | 133 if (using_absolute_send_time_) { |
134 rbe_.reset(new RemoteBitrateEstimatorAbsSendTime(observer_)); | 134 rbe_.reset(new RemoteBitrateEstimatorAbsSendTime(observer_, clock_)); |
135 } else { | 135 } else { |
136 rbe_.reset(new RemoteBitrateEstimatorSingleStream(observer_, clock_)); | 136 rbe_.reset(new RemoteBitrateEstimatorSingleStream(observer_, clock_)); |
137 } | 137 } |
138 rbe_->SetMinBitrate(min_bitrate_bps_); | 138 rbe_->SetMinBitrate(min_bitrate_bps_); |
139 } | 139 } |
140 | 140 |
141 RemoteBitrateObserver* observer_; | 141 RemoteBitrateObserver* observer_; |
142 Clock* const clock_; | 142 Clock* const clock_; |
143 std::unique_ptr<CriticalSectionWrapper> crit_sect_; | 143 std::unique_ptr<CriticalSectionWrapper> crit_sect_; |
144 std::unique_ptr<RemoteBitrateEstimator> rbe_; | 144 std::unique_ptr<RemoteBitrateEstimator> rbe_; |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 last_reported_fraction_loss_(0), | 198 last_reported_fraction_loss_(0), |
199 last_reported_rtt_(0), | 199 last_reported_rtt_(0), |
200 network_state_(kNetworkUp) { | 200 network_state_(kNetworkUp) { |
201 Init(); | 201 Init(); |
202 } | 202 } |
203 | 203 |
204 CongestionController::~CongestionController() {} | 204 CongestionController::~CongestionController() {} |
205 | 205 |
206 void CongestionController::Init() { | 206 void CongestionController::Init() { |
207 transport_feedback_adapter_.SetBitrateEstimator( | 207 transport_feedback_adapter_.SetBitrateEstimator( |
208 new DelayBasedBwe(&transport_feedback_adapter_)); | 208 new DelayBasedBwe(&transport_feedback_adapter_, clock_)); |
209 transport_feedback_adapter_.GetBitrateEstimator()->SetMinBitrate( | 209 transport_feedback_adapter_.GetBitrateEstimator()->SetMinBitrate( |
210 min_bitrate_bps_); | 210 min_bitrate_bps_); |
211 } | 211 } |
212 | 212 |
213 void CongestionController::SetBweBitrates(int min_bitrate_bps, | 213 void CongestionController::SetBweBitrates(int min_bitrate_bps, |
214 int start_bitrate_bps, | 214 int start_bitrate_bps, |
215 int max_bitrate_bps) { | 215 int max_bitrate_bps) { |
216 ClampBitrates(&start_bitrate_bps, &min_bitrate_bps, &max_bitrate_bps); | 216 ClampBitrates(&start_bitrate_bps, &min_bitrate_bps, &max_bitrate_bps); |
217 bitrate_controller_->SetBitrates(start_bitrate_bps, | 217 bitrate_controller_->SetBitrates(start_bitrate_bps, |
218 min_bitrate_bps, | 218 min_bitrate_bps, |
(...skipping 14 matching lines...) Expand all Loading... |
233 // TODO(honghaiz): Recreate this object once the bitrate controller is | 233 // TODO(honghaiz): Recreate this object once the bitrate controller is |
234 // no longer exposed outside CongestionController. | 234 // no longer exposed outside CongestionController. |
235 bitrate_controller_->ResetBitrates(bitrate_bps, min_bitrate_bps, | 235 bitrate_controller_->ResetBitrates(bitrate_bps, min_bitrate_bps, |
236 max_bitrate_bps); | 236 max_bitrate_bps); |
237 min_bitrate_bps_ = min_bitrate_bps; | 237 min_bitrate_bps_ = min_bitrate_bps; |
238 // TODO(honghaiz): Recreate this object once the remote bitrate estimator is | 238 // TODO(honghaiz): Recreate this object once the remote bitrate estimator is |
239 // no longer exposed outside CongestionController. | 239 // no longer exposed outside CongestionController. |
240 if (remote_bitrate_estimator_) | 240 if (remote_bitrate_estimator_) |
241 remote_bitrate_estimator_->SetMinBitrate(min_bitrate_bps); | 241 remote_bitrate_estimator_->SetMinBitrate(min_bitrate_bps); |
242 | 242 |
243 RemoteBitrateEstimator* rbe = | 243 RemoteBitrateEstimator* rbe = new RemoteBitrateEstimatorAbsSendTime( |
244 new RemoteBitrateEstimatorAbsSendTime(&transport_feedback_adapter_); | 244 &transport_feedback_adapter_, clock_); |
245 transport_feedback_adapter_.SetBitrateEstimator(rbe); | 245 transport_feedback_adapter_.SetBitrateEstimator(rbe); |
246 rbe->SetMinBitrate(min_bitrate_bps); | 246 rbe->SetMinBitrate(min_bitrate_bps); |
247 // TODO(holmer): Trigger a new probe once mid-call probing is implemented. | 247 // TODO(holmer): Trigger a new probe once mid-call probing is implemented. |
248 MaybeTriggerOnNetworkChanged(); | 248 MaybeTriggerOnNetworkChanged(); |
249 } | 249 } |
250 | 250 |
251 BitrateController* CongestionController::GetBitrateController() const { | 251 BitrateController* CongestionController::GetBitrateController() const { |
252 return bitrate_controller_.get(); | 252 return bitrate_controller_.get(); |
253 } | 253 } |
254 | 254 |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 bool CongestionController::IsSendQueueFull() const { | 355 bool CongestionController::IsSendQueueFull() const { |
356 return pacer_->ExpectedQueueTimeMs() > PacedSender::kMaxQueueLengthMs; | 356 return pacer_->ExpectedQueueTimeMs() > PacedSender::kMaxQueueLengthMs; |
357 } | 357 } |
358 | 358 |
359 bool CongestionController::IsNetworkDown() const { | 359 bool CongestionController::IsNetworkDown() const { |
360 rtc::CritScope cs(&critsect_); | 360 rtc::CritScope cs(&critsect_); |
361 return network_state_ == kNetworkDown; | 361 return network_state_ == kNetworkDown; |
362 } | 362 } |
363 | 363 |
364 } // namespace webrtc | 364 } // namespace webrtc |
OLD | NEW |