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 int32_t RemoteBitrateEstimatorSingleStream::Process() { | 121 void RemoteBitrateEstimatorSingleStream::Process() { |
122 if (TimeUntilNextProcess() > 0) { | 122 if (TimeUntilNextProcess() > 0) { |
123 return 0; | 123 return; |
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; | |
131 } | 130 } |
132 | 131 |
133 int64_t RemoteBitrateEstimatorSingleStream::TimeUntilNextProcess() { | 132 int64_t RemoteBitrateEstimatorSingleStream::TimeUntilNextProcess() { |
134 if (last_process_time_ < 0) { | 133 if (last_process_time_ < 0) { |
135 return 0; | 134 return 0; |
136 } | 135 } |
137 { | 136 { |
138 CriticalSectionScoped cs_(crit_sect_.get()); | 137 CriticalSectionScoped cs_(crit_sect_.get()); |
139 return last_process_time_ + process_interval_ms_ - | 138 return last_process_time_ + process_interval_ms_ - |
140 clock_->TimeInMilliseconds(); | 139 clock_->TimeInMilliseconds(); |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 (*ssrcs)[i] = it->first; | 224 (*ssrcs)[i] = it->first; |
226 } | 225 } |
227 } | 226 } |
228 | 227 |
229 void RemoteBitrateEstimatorSingleStream::SetMinBitrate(int min_bitrate_bps) { | 228 void RemoteBitrateEstimatorSingleStream::SetMinBitrate(int min_bitrate_bps) { |
230 CriticalSectionScoped cs(crit_sect_.get()); | 229 CriticalSectionScoped cs(crit_sect_.get()); |
231 remote_rate_->SetMinBitrate(min_bitrate_bps); | 230 remote_rate_->SetMinBitrate(min_bitrate_bps); |
232 } | 231 } |
233 | 232 |
234 } // namespace webrtc | 233 } // namespace webrtc |
OLD | NEW |