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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 if (prior_state != kBwOverusing || | 111 if (prior_state != kBwOverusing || |
112 remote_rate_->TimeToReduceFurther(now_ms, incoming_bitrate_bps)) { | 112 remote_rate_->TimeToReduceFurther(now_ms, incoming_bitrate_bps)) { |
113 // The first overuse should immediately trigger a new estimate. | 113 // The first overuse should immediately trigger a new estimate. |
114 // We also have to update the estimate immediately if we are overusing | 114 // We also have to update the estimate immediately if we are overusing |
115 // and the target bitrate is too high compared to what we are receiving. | 115 // and the target bitrate is too high compared to what we are receiving. |
116 UpdateEstimate(now_ms); | 116 UpdateEstimate(now_ms); |
117 } | 117 } |
118 } | 118 } |
119 } | 119 } |
120 | 120 |
121 void RemoteBitrateEstimatorSingleStream::Process() { | 121 int32_t RemoteBitrateEstimatorSingleStream::Process() { |
122 if (TimeUntilNextProcess() > 0) { | 122 if (TimeUntilNextProcess() > 0) { |
123 return; | 123 return 0; |
124 } | 124 } |
125 { | 125 { |
126 CriticalSectionScoped cs(crit_sect_.get()); | 126 CriticalSectionScoped cs(crit_sect_.get()); |
127 UpdateEstimate(clock_->TimeInMilliseconds()); | 127 UpdateEstimate(clock_->TimeInMilliseconds()); |
128 } | 128 } |
129 last_process_time_ = clock_->TimeInMilliseconds(); | 129 last_process_time_ = clock_->TimeInMilliseconds(); |
| 130 return 0; |
130 } | 131 } |
131 | 132 |
132 int64_t RemoteBitrateEstimatorSingleStream::TimeUntilNextProcess() { | 133 int64_t RemoteBitrateEstimatorSingleStream::TimeUntilNextProcess() { |
133 if (last_process_time_ < 0) { | 134 if (last_process_time_ < 0) { |
134 return 0; | 135 return 0; |
135 } | 136 } |
136 { | 137 { |
137 CriticalSectionScoped cs_(crit_sect_.get()); | 138 CriticalSectionScoped cs_(crit_sect_.get()); |
138 return last_process_time_ + process_interval_ms_ - | 139 return last_process_time_ + process_interval_ms_ - |
139 clock_->TimeInMilliseconds(); | 140 clock_->TimeInMilliseconds(); |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 (*ssrcs)[i] = it->first; | 225 (*ssrcs)[i] = it->first; |
225 } | 226 } |
226 } | 227 } |
227 | 228 |
228 void RemoteBitrateEstimatorSingleStream::SetMinBitrate(int min_bitrate_bps) { | 229 void RemoteBitrateEstimatorSingleStream::SetMinBitrate(int min_bitrate_bps) { |
229 CriticalSectionScoped cs(crit_sect_.get()); | 230 CriticalSectionScoped cs(crit_sect_.get()); |
230 remote_rate_->SetMinBitrate(min_bitrate_bps); | 231 remote_rate_->SetMinBitrate(min_bitrate_bps); |
231 } | 232 } |
232 | 233 |
233 } // namespace webrtc | 234 } // namespace webrtc |
OLD | NEW |