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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
197 // transferred to the task queue when PostDelayedTask was called. | 197 // transferred to the task queue when PostDelayedTask was called. |
198 return false; | 198 return false; |
199 } | 199 } |
200 rtc::SequencedTaskChecker task_checker_; | 200 rtc::SequencedTaskChecker task_checker_; |
201 OveruseFrameDetector* overuse_detector_; | 201 OveruseFrameDetector* overuse_detector_; |
202 }; | 202 }; |
203 | 203 |
204 OveruseFrameDetector::OveruseFrameDetector( | 204 OveruseFrameDetector::OveruseFrameDetector( |
205 Clock* clock, | 205 Clock* clock, |
206 const CpuOveruseOptions& options, | 206 const CpuOveruseOptions& options, |
207 CpuOveruseObserver* observer, | 207 ScalingInterface* observer, |
perkj_webrtc
2016/10/07 07:41:16
?
| |
208 EncodedFrameObserver* encoder_timing, | 208 EncodedFrameObserver* encoder_timing, |
209 CpuOveruseMetricsObserver* metrics_observer) | 209 CpuOveruseMetricsObserver* metrics_observer) |
210 : check_overuse_task_(nullptr), | 210 : check_overuse_task_(nullptr), |
211 options_(options), | 211 options_(options), |
212 observer_(observer), | 212 observer_(observer), |
213 encoder_timing_(encoder_timing), | 213 encoder_timing_(encoder_timing), |
214 metrics_observer_(metrics_observer), | 214 metrics_observer_(metrics_observer), |
215 clock_(clock), | 215 clock_(clock), |
216 num_process_times_(0), | 216 num_process_times_(0), |
217 last_capture_time_ms_(-1), | 217 last_capture_time_ms_(-1), |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
363 current_rampup_delay_ms_ = kStandardRampUpDelayMs; | 363 current_rampup_delay_ms_ = kStandardRampUpDelayMs; |
364 } | 364 } |
365 } | 365 } |
366 | 366 |
367 last_overuse_time_ms_ = now; | 367 last_overuse_time_ms_ = now; |
368 in_quick_rampup_ = false; | 368 in_quick_rampup_ = false; |
369 checks_above_threshold_ = 0; | 369 checks_above_threshold_ = 0; |
370 ++num_overuse_detections_; | 370 ++num_overuse_detections_; |
371 | 371 |
372 if (observer_) | 372 if (observer_) |
373 observer_->OveruseDetected(); | 373 observer_->ScaleDown(); |
374 } else if (IsUnderusing(*metrics_, now)) { | 374 } else if (IsUnderusing(*metrics_, now)) { |
375 last_rampup_time_ms_ = now; | 375 last_rampup_time_ms_ = now; |
376 in_quick_rampup_ = true; | 376 in_quick_rampup_ = true; |
377 | 377 |
378 if (observer_) | 378 if (observer_) |
379 observer_->NormalUsage(); | 379 observer_->ScaleUp(); |
380 } | 380 } |
381 | 381 |
382 int rampup_delay = | 382 int rampup_delay = |
383 in_quick_rampup_ ? kQuickRampUpDelayMs : current_rampup_delay_ms_; | 383 in_quick_rampup_ ? kQuickRampUpDelayMs : current_rampup_delay_ms_; |
384 | 384 |
385 LOG(LS_VERBOSE) << " Frame stats: " | 385 LOG(LS_VERBOSE) << " Frame stats: " |
386 << " encode usage " << metrics_->encode_usage_percent | 386 << " encode usage " << metrics_->encode_usage_percent |
387 << " overuse detections " << num_overuse_detections_ | 387 << " overuse detections " << num_overuse_detections_ |
388 << " rampup delay " << rampup_delay; | 388 << " rampup delay " << rampup_delay; |
389 } | 389 } |
(...skipping 13 matching lines...) Expand all Loading... | |
403 int64_t time_now) { | 403 int64_t time_now) { |
404 RTC_DCHECK_CALLED_SEQUENTIALLY(&task_checker_); | 404 RTC_DCHECK_CALLED_SEQUENTIALLY(&task_checker_); |
405 int delay = in_quick_rampup_ ? kQuickRampUpDelayMs : current_rampup_delay_ms_; | 405 int delay = in_quick_rampup_ ? kQuickRampUpDelayMs : current_rampup_delay_ms_; |
406 if (time_now < last_rampup_time_ms_ + delay) | 406 if (time_now < last_rampup_time_ms_ + delay) |
407 return false; | 407 return false; |
408 | 408 |
409 return metrics.encode_usage_percent < | 409 return metrics.encode_usage_percent < |
410 options_.low_encode_usage_threshold_percent; | 410 options_.low_encode_usage_threshold_percent; |
411 } | 411 } |
412 } // namespace webrtc | 412 } // namespace webrtc |
OLD | NEW |