Chromium Code Reviews| Index: webrtc/video/overuse_frame_detector.h |
| diff --git a/webrtc/video/overuse_frame_detector.h b/webrtc/video/overuse_frame_detector.h |
| index 0ef2e43857d2601c800c48a09d0dc6e237692e53..f817ec9cacaf847c187e4b00abc8925ef2c74684 100644 |
| --- a/webrtc/video/overuse_frame_detector.h |
| +++ b/webrtc/video/overuse_frame_detector.h |
| @@ -19,6 +19,10 @@ |
| #include "webrtc/base/thread_checker.h" |
| #include "webrtc/modules/include/module.h" |
| +#if WEBRTC_MAC |
| +#include <mach/mach.h> |
| +#endif |
| + |
| namespace webrtc { |
| class Clock; |
| @@ -38,12 +42,34 @@ class CpuOveruseObserver { |
| struct CpuOveruseOptions { |
| CpuOveruseOptions() |
| - : low_encode_usage_threshold_percent(55), |
| - high_encode_usage_threshold_percent(85), |
| + : low_encode_usage_threshold_percent(42), |
|
tommi
2016/02/04 16:40:02
Is 42 something that should be set for all platfor
torbjorng (webrtc)
2016/02/04 16:54:58
I decreased this to make it about 85/2; the interv
|
| frame_timeout_interval_ms(1500), |
| min_frame_samples(120), |
| min_process_count(3), |
| - high_threshold_consecutive_count(2) {} |
| + high_threshold_consecutive_count(2) { |
| +#if WEBRTC_MAC |
|
tommi
2016/02/04 16:40:02
nit: #if defined(WEBRTC_MAC)
torbjorng (webrtc)
2016/02/04 16:54:59
Done.
|
| + // This is a proof-of-concept hack for letting the physical core count |
| + // affect the interval into which we attempt to scale. For now, the code |
| + // is Mac OS specific, since that's the platform were we saw the problem. |
| + // Note that we make the interval 2x+epsilon wide, since scaling steps are |
| + // close to that. |
| + struct host_basic_info hbi; |
| + mach_msg_type_number_t datasize; |
| + // FIXME(torbjorng): Add syscall error checking, fallback code. |
|
tommi
2016/02/04 16:40:02
nit: s/FIXME/TODO
torbjorng (webrtc)
2016/02/04 16:54:59
Done.
|
| + host_info(mach_host_self(), HOST_BASIC_INFO, (host_info_t)&hbi, &datasize); |
|
tommi
2016/02/04 16:40:02
does this work as expected inside the sandbox?
torbjorng (webrtc)
2016/02/04 16:54:58
Good question. I will verify that. I observed chr
|
| + |
| + if (hbi.physical_cpu == 1) { |
| + low_encode_usage_threshold_percent = 17; |
| + } else if (hbi.physical_cpu == 2) { |
| + low_encode_usage_threshold_percent = 27; |
| + } else { |
| + // Init list default. |
| + } |
| +#endif |
| + // Make high = low + epsilon. |
| + high_encode_usage_threshold_percent |
| + = 33 * low_encode_usage_threshold_percent / 16 + 1; |
|
tommi
2016/02/04 16:40:02
nit: assignment operator on previous line (could a
torbjorng (webrtc)
2016/02/04 16:54:58
Done.
|
| + } |
| int low_encode_usage_threshold_percent; // Threshold for triggering underuse. |
| int high_encode_usage_threshold_percent; // Threshold for triggering overuse. |