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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 { | 125 { |
126 rtc::CritScope cs(&critsect_); | 126 rtc::CritScope cs(&critsect_); |
127 reserved_bitrate_bps_ = reserved_bitrate_bps; | 127 reserved_bitrate_bps_ = reserved_bitrate_bps; |
128 } | 128 } |
129 MaybeTriggerOnNetworkChanged(); | 129 MaybeTriggerOnNetworkChanged(); |
130 } | 130 } |
131 | 131 |
132 void BitrateControllerImpl::OnReceivedEstimatedBitrate(uint32_t bitrate) { | 132 void BitrateControllerImpl::OnReceivedEstimatedBitrate(uint32_t bitrate) { |
133 { | 133 { |
134 rtc::CritScope cs(&critsect_); | 134 rtc::CritScope cs(&critsect_); |
135 bandwidth_estimation_.UpdateReceiverEstimate(bitrate); | 135 bandwidth_estimation_.UpdateReceiverEstimate(clock_->TimeInMilliseconds(), |
| 136 bitrate); |
136 } | 137 } |
137 MaybeTriggerOnNetworkChanged(); | 138 MaybeTriggerOnNetworkChanged(); |
138 } | 139 } |
139 | 140 |
140 int64_t BitrateControllerImpl::TimeUntilNextProcess() { | 141 int64_t BitrateControllerImpl::TimeUntilNextProcess() { |
141 const int64_t kBitrateControllerUpdateIntervalMs = 25; | 142 const int64_t kBitrateControllerUpdateIntervalMs = 25; |
142 rtc::CritScope cs(&critsect_); | 143 rtc::CritScope cs(&critsect_); |
143 int64_t time_since_update_ms = | 144 int64_t time_since_update_ms = |
144 clock_->TimeInMilliseconds() - last_bitrate_update_ms_; | 145 clock_->TimeInMilliseconds() - last_bitrate_update_ms_; |
145 return std::max<int64_t>( | 146 return std::max<int64_t>( |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 bandwidth_estimation_.CurrentEstimate(&bitrate, &fraction_loss, &rtt); | 212 bandwidth_estimation_.CurrentEstimate(&bitrate, &fraction_loss, &rtt); |
212 if (bitrate > 0) { | 213 if (bitrate > 0) { |
213 bitrate = bitrate - std::min<int>(bitrate, reserved_bitrate_bps_); | 214 bitrate = bitrate - std::min<int>(bitrate, reserved_bitrate_bps_); |
214 bitrate = std::max(bitrate, bandwidth_estimation_.GetMinBitrate()); | 215 bitrate = std::max(bitrate, bandwidth_estimation_.GetMinBitrate()); |
215 *bandwidth = bitrate; | 216 *bandwidth = bitrate; |
216 return true; | 217 return true; |
217 } | 218 } |
218 return false; | 219 return false; |
219 } | 220 } |
220 } // namespace webrtc | 221 } // namespace webrtc |
OLD | NEW |