OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 rtt_ = rtt; | 97 rtt_ = rtt; |
98 } | 98 } |
99 | 99 |
100 void AimdRateControl::Update(const RateControlInput* input, int64_t now_ms) { | 100 void AimdRateControl::Update(const RateControlInput* input, int64_t now_ms) { |
101 assert(input); | 101 assert(input); |
102 | 102 |
103 // Set the initial bit rate value to what we're receiving the first half | 103 // Set the initial bit rate value to what we're receiving the first half |
104 // second. | 104 // second. |
105 if (!bitrate_is_initialized_) { | 105 if (!bitrate_is_initialized_) { |
106 const int64_t kInitializationTimeMs = 5000; | 106 const int64_t kInitializationTimeMs = 5000; |
107 DCHECK_LE(kBitrateWindowMs, kInitializationTimeMs); | 107 RTC_DCHECK_LE(kBitrateWindowMs, kInitializationTimeMs); |
108 if (time_first_incoming_estimate_ < 0) { | 108 if (time_first_incoming_estimate_ < 0) { |
109 if (input->_incomingBitRate > 0) { | 109 if (input->_incomingBitRate > 0) { |
110 time_first_incoming_estimate_ = now_ms; | 110 time_first_incoming_estimate_ = now_ms; |
111 } | 111 } |
112 } else if (now_ms - time_first_incoming_estimate_ > kInitializationTimeMs && | 112 } else if (now_ms - time_first_incoming_estimate_ > kInitializationTimeMs && |
113 input->_incomingBitRate > 0) { | 113 input->_incomingBitRate > 0) { |
114 current_bitrate_bps_ = input->_incomingBitRate; | 114 current_bitrate_bps_ = input->_incomingBitRate; |
115 bitrate_is_initialized_ = true; | 115 bitrate_is_initialized_ = true; |
116 } | 116 } |
117 } | 117 } |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 } | 302 } |
303 | 303 |
304 void AimdRateControl::ChangeRegion(RateControlRegion region) { | 304 void AimdRateControl::ChangeRegion(RateControlRegion region) { |
305 rate_control_region_ = region; | 305 rate_control_region_ = region; |
306 } | 306 } |
307 | 307 |
308 void AimdRateControl::ChangeState(RateControlState new_state) { | 308 void AimdRateControl::ChangeState(RateControlState new_state) { |
309 rate_control_state_ = new_state; | 309 rate_control_state_ = new_state; |
310 } | 310 } |
311 } // namespace webrtc | 311 } // namespace webrtc |
OLD | NEW |