| 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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 RemoteBitrateObserver* remote_bitrate_observer) | 140 RemoteBitrateObserver* remote_bitrate_observer) |
| 141 : clock_(clock), | 141 : clock_(clock), |
| 142 pacer_(new PacedSender(clock_, | 142 pacer_(new PacedSender(clock_, |
| 143 &packet_router_, | 143 &packet_router_, |
| 144 BitrateController::kDefaultStartBitrateKbps, | 144 BitrateController::kDefaultStartBitrateKbps, |
| 145 PacedSender::kDefaultPaceMultiplier * | 145 PacedSender::kDefaultPaceMultiplier * |
| 146 BitrateController::kDefaultStartBitrateKbps, | 146 BitrateController::kDefaultStartBitrateKbps, |
| 147 0)), | 147 0)), |
| 148 remote_bitrate_estimator_( | 148 remote_bitrate_estimator_( |
| 149 new WrappingBitrateEstimator(remote_bitrate_observer, clock_)), | 149 new WrappingBitrateEstimator(remote_bitrate_observer, clock_)), |
| 150 pacer_thread_(ProcessThread::Create("PacerThread")), | |
| 151 // Constructed last as this object calls the provided callback on | 150 // Constructed last as this object calls the provided callback on |
| 152 // construction. | 151 // construction. |
| 153 bitrate_controller_( | 152 bitrate_controller_( |
| 154 BitrateController::CreateBitrateController(clock_, bitrate_observer)), | 153 BitrateController::CreateBitrateController(clock_, bitrate_observer)), |
| 155 remote_estimator_proxy_(clock_, &packet_router_), | 154 remote_estimator_proxy_(clock_, &packet_router_), |
| 156 transport_feedback_adapter_(bitrate_controller_.get(), clock_), | 155 transport_feedback_adapter_(bitrate_controller_.get(), clock_), |
| 157 min_bitrate_bps_(RemoteBitrateEstimator::kDefaultMinBitrateBps) { | 156 min_bitrate_bps_(RemoteBitrateEstimator::kDefaultMinBitrateBps) { |
| 158 transport_feedback_adapter_.SetBitrateEstimator( | 157 transport_feedback_adapter_.SetBitrateEstimator( |
| 159 new RemoteBitrateEstimatorAbsSendTime(&transport_feedback_adapter_, | 158 new RemoteBitrateEstimatorAbsSendTime(&transport_feedback_adapter_, |
| 160 clock_)); | 159 clock_)); |
| 161 transport_feedback_adapter_.GetBitrateEstimator()->SetMinBitrate( | 160 transport_feedback_adapter_.GetBitrateEstimator()->SetMinBitrate( |
| 162 min_bitrate_bps_); | 161 min_bitrate_bps_); |
| 163 pacer_thread_->RegisterModule(pacer_.get()); | |
| 164 pacer_thread_->RegisterModule(&remote_estimator_proxy_); | |
| 165 pacer_thread_->Start(); | |
| 166 } | 162 } |
| 167 | 163 |
| 168 CongestionController::~CongestionController() { | 164 CongestionController::~CongestionController() { |
| 169 pacer_thread_->Stop(); | |
| 170 pacer_thread_->DeRegisterModule(pacer_.get()); | |
| 171 pacer_thread_->DeRegisterModule(&remote_estimator_proxy_); | |
| 172 } | 165 } |
| 173 | 166 |
| 174 | 167 |
| 175 void CongestionController::SetBweBitrates(int min_bitrate_bps, | 168 void CongestionController::SetBweBitrates(int min_bitrate_bps, |
| 176 int start_bitrate_bps, | 169 int start_bitrate_bps, |
| 177 int max_bitrate_bps) { | 170 int max_bitrate_bps) { |
| 178 RTC_DCHECK(config_thread_checker_.CalledOnValidThread()); | 171 RTC_DCHECK(config_thread_checker_.CalledOnValidThread()); |
| 179 // TODO(holmer): We should make sure the default bitrates are set to 10 kbps, | 172 // TODO(holmer): We should make sure the default bitrates are set to 10 kbps, |
| 180 // and that we don't try to set the min bitrate to 0 from any applications. | 173 // and that we don't try to set the min bitrate to 0 from any applications. |
| 181 // The congestion controller should allow a min bitrate of 0. | 174 // The congestion controller should allow a min bitrate of 0. |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 remote_bitrate_estimator_->TimeUntilNextProcess()); | 241 remote_bitrate_estimator_->TimeUntilNextProcess()); |
| 249 } | 242 } |
| 250 | 243 |
| 251 int32_t CongestionController::Process() { | 244 int32_t CongestionController::Process() { |
| 252 bitrate_controller_->Process(); | 245 bitrate_controller_->Process(); |
| 253 remote_bitrate_estimator_->Process(); | 246 remote_bitrate_estimator_->Process(); |
| 254 return 0; | 247 return 0; |
| 255 } | 248 } |
| 256 | 249 |
| 257 } // namespace webrtc | 250 } // namespace webrtc |
| OLD | NEW |