OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 last_processed_capture_time_ms_(-1), | 186 last_processed_capture_time_ms_(-1), |
187 num_pixels_(0), | 187 num_pixels_(0), |
188 next_process_time_ms_(clock_->TimeInMilliseconds()), | 188 next_process_time_ms_(clock_->TimeInMilliseconds()), |
189 last_overuse_time_ms_(-1), | 189 last_overuse_time_ms_(-1), |
190 checks_above_threshold_(0), | 190 checks_above_threshold_(0), |
191 num_overuse_detections_(0), | 191 num_overuse_detections_(0), |
192 last_rampup_time_ms_(-1), | 192 last_rampup_time_ms_(-1), |
193 in_quick_rampup_(false), | 193 in_quick_rampup_(false), |
194 current_rampup_delay_ms_(kStandardRampUpDelayMs), | 194 current_rampup_delay_ms_(kStandardRampUpDelayMs), |
195 usage_(new SendProcessingUsage(options)) { | 195 usage_(new SendProcessingUsage(options)) { |
196 RTC_DCHECK(metrics_observer); | |
197 processing_thread_.DetachFromThread(); | 196 processing_thread_.DetachFromThread(); |
198 } | 197 } |
199 | 198 |
200 OveruseFrameDetector::~OveruseFrameDetector() { | 199 OveruseFrameDetector::~OveruseFrameDetector() { |
201 } | 200 } |
202 | 201 |
203 void OveruseFrameDetector::EncodedFrameTimeMeasured(int encode_duration_ms) { | 202 void OveruseFrameDetector::EncodedFrameTimeMeasured(int encode_duration_ms) { |
204 if (!metrics_) | 203 if (!metrics_) |
205 metrics_ = rtc::Optional<CpuOveruseMetrics>(CpuOveruseMetrics()); | 204 metrics_ = rtc::Optional<CpuOveruseMetrics>(CpuOveruseMetrics()); |
206 metrics_->encode_usage_percent = usage_->Value(); | 205 metrics_->encode_usage_percent = usage_->Value(); |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 bool OveruseFrameDetector::IsUnderusing(const CpuOveruseMetrics& metrics, | 372 bool OveruseFrameDetector::IsUnderusing(const CpuOveruseMetrics& metrics, |
374 int64_t time_now) { | 373 int64_t time_now) { |
375 int delay = in_quick_rampup_ ? kQuickRampUpDelayMs : current_rampup_delay_ms_; | 374 int delay = in_quick_rampup_ ? kQuickRampUpDelayMs : current_rampup_delay_ms_; |
376 if (time_now < last_rampup_time_ms_ + delay) | 375 if (time_now < last_rampup_time_ms_ + delay) |
377 return false; | 376 return false; |
378 | 377 |
379 return metrics.encode_usage_percent < | 378 return metrics.encode_usage_percent < |
380 options_.low_encode_usage_threshold_percent; | 379 options_.low_encode_usage_threshold_percent; |
381 } | 380 } |
382 } // namespace webrtc | 381 } // namespace webrtc |
OLD | NEW |