Chromium Code Reviews| 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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 163 packet_router_(new PacketRouter()), | 163 packet_router_(new PacketRouter()), |
| 164 pacer_(new PacedSender(clock_, packet_router_.get())), | 164 pacer_(new PacedSender(clock_, packet_router_.get())), |
| 165 remote_bitrate_estimator_( | 165 remote_bitrate_estimator_( |
| 166 new WrappingBitrateEstimator(remote_bitrate_observer, clock_)), | 166 new WrappingBitrateEstimator(remote_bitrate_observer, clock_)), |
| 167 bitrate_controller_( | 167 bitrate_controller_( |
| 168 BitrateController::CreateBitrateController(clock_, event_log)), | 168 BitrateController::CreateBitrateController(clock_, event_log)), |
| 169 retransmission_rate_limiter_( | 169 retransmission_rate_limiter_( |
| 170 new RateLimiter(clock, kRetransmitWindowSizeMs)), | 170 new RateLimiter(clock, kRetransmitWindowSizeMs)), |
| 171 remote_estimator_proxy_(clock_, packet_router_.get()), | 171 remote_estimator_proxy_(clock_, packet_router_.get()), |
| 172 transport_feedback_adapter_(bitrate_controller_.get(), clock_), | 172 transport_feedback_adapter_(bitrate_controller_.get(), clock_), |
| 173 start_bitrate_bps_(0), | |
| 173 min_bitrate_bps_(RemoteBitrateEstimator::kDefaultMinBitrateBps), | 174 min_bitrate_bps_(RemoteBitrateEstimator::kDefaultMinBitrateBps), |
| 174 max_bitrate_bps_(0), | 175 max_bitrate_bps_(0), |
| 175 last_reported_bitrate_bps_(0), | 176 last_reported_bitrate_bps_(0), |
| 176 last_reported_fraction_loss_(0), | 177 last_reported_fraction_loss_(0), |
| 177 last_reported_rtt_(0), | 178 last_reported_rtt_(0), |
| 178 network_state_(kNetworkUp) { | 179 network_state_(kNetworkUp) { |
| 179 Init(); | 180 Init(); |
| 180 } | 181 } |
| 181 | 182 |
| 182 CongestionController::CongestionController( | 183 CongestionController::CongestionController( |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 221 } | 222 } |
| 222 | 223 |
| 223 void CongestionController::SetBweBitrates(int min_bitrate_bps, | 224 void CongestionController::SetBweBitrates(int min_bitrate_bps, |
| 224 int start_bitrate_bps, | 225 int start_bitrate_bps, |
| 225 int max_bitrate_bps) { | 226 int max_bitrate_bps) { |
| 226 ClampBitrates(&start_bitrate_bps, &min_bitrate_bps, &max_bitrate_bps); | 227 ClampBitrates(&start_bitrate_bps, &min_bitrate_bps, &max_bitrate_bps); |
| 227 bitrate_controller_->SetBitrates(start_bitrate_bps, | 228 bitrate_controller_->SetBitrates(start_bitrate_bps, |
| 228 min_bitrate_bps, | 229 min_bitrate_bps, |
| 229 max_bitrate_bps); | 230 max_bitrate_bps); |
| 230 | 231 |
| 232 if (start_bitrate_bps > 0) | |
| 233 start_bitrate_bps_ = start_bitrate_bps; | |
| 231 { | 234 { |
| 232 // Only do probing if: | 235 // Only do probing if: |
| 233 // - we are mid-call, which we consider to be if | 236 // - we are mid-call, which we consider to be if |
|
philipel
2016/08/23 10:55:28
Nit: remove the last '-' since this is no longer a
| |
| 234 // |last_reported_bitrate_bps_| != 0, and | 237 // |last_reported_bitrate_bps_| is valid (> 0) and |
| 235 // - the current bitrate is lower than the new |max_bitrate_bps|, and | 238 // |last_reported_bitrate_bps_| != |start_bitrate_bps_|, and |
| 236 // - we actually want to increase the |max_bitrate_bps_|. | 239 // the current bitrate is lower than the new |max_bitrate_bps|, and |
| 240 // we actually want to increase the |max_bitrate_bps_|. | |
| 237 rtc::CritScope cs(&critsect_); | 241 rtc::CritScope cs(&critsect_); |
| 238 if (last_reported_bitrate_bps_ != 0 && | 242 if (last_reported_bitrate_bps_ && |
| 243 last_reported_bitrate_bps_ != start_bitrate_bps_ && | |
| 239 last_reported_bitrate_bps_ < max_bitrate_bps && | 244 last_reported_bitrate_bps_ < max_bitrate_bps && |
| 240 max_bitrate_bps > max_bitrate_bps_) { | 245 max_bitrate_bps > max_bitrate_bps_) { |
| 241 pacer_->CreateProbeCluster(max_bitrate_bps, 5); | 246 pacer_->CreateProbeCluster(max_bitrate_bps, 5); |
| 242 } | 247 } |
| 243 } | 248 } |
| 244 max_bitrate_bps_ = max_bitrate_bps; | 249 max_bitrate_bps_ = max_bitrate_bps; |
| 245 | 250 |
| 246 if (remote_bitrate_estimator_) | 251 if (remote_bitrate_estimator_) |
| 247 remote_bitrate_estimator_->SetMinBitrate(min_bitrate_bps); | 252 remote_bitrate_estimator_->SetMinBitrate(min_bitrate_bps); |
| 248 min_bitrate_bps_ = min_bitrate_bps; | 253 min_bitrate_bps_ = min_bitrate_bps; |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 387 bool CongestionController::IsSendQueueFull() const { | 392 bool CongestionController::IsSendQueueFull() const { |
| 388 return pacer_->ExpectedQueueTimeMs() > PacedSender::kMaxQueueLengthMs; | 393 return pacer_->ExpectedQueueTimeMs() > PacedSender::kMaxQueueLengthMs; |
| 389 } | 394 } |
| 390 | 395 |
| 391 bool CongestionController::IsNetworkDown() const { | 396 bool CongestionController::IsNetworkDown() const { |
| 392 rtc::CritScope cs(&critsect_); | 397 rtc::CritScope cs(&critsect_); |
| 393 return network_state_ == kNetworkDown; | 398 return network_state_ == kNetworkDown; |
| 394 } | 399 } |
| 395 | 400 |
| 396 } // namespace webrtc | 401 } // namespace webrtc |
| OLD | NEW |