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..832a9a4148dc6546d0d4abecfd5ea43713e63814 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 defined(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), |
frame_timeout_interval_ms(1500), |
min_frame_samples(120), |
min_process_count(3), |
- high_threshold_consecutive_count(2) {} |
+ high_threshold_consecutive_count(2) { |
+#if defined (WEBRTC_MAC) |
tommi
2016/02/04 20:32:44
#if defined(WEBRTC_MAC)
torbjorng (webrtc)
2016/02/05 16:31:05
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; |
+ // TODO(torbjorng): Add syscall error checking, fallback code. |
+ host_info(mach_host_self(), HOST_BASIC_INFO, (host_info_t)&hbi, &datasize); |
tommi
2016/02/04 20:32:44
Can you change the cast to a C++ cast? As is it l
Robert Sesek
2016/02/04 22:37:15
The result of mach_host_self must be deallocated.
tommi (sloooow) - chröme
2016/02/04 22:44:40
Ah, thanks for catching that!
Now this makes more
torbjorng (webrtc)
2016/02/05 16:31:05
Yes, host_info_t is a ptr (it is in fact int*).
F
torbjorng (webrtc)
2016/02/05 16:31:05
Robert: I changed the code to look more like in ot
tommi
2016/02/05 22:56:35
Thanks, I'm familiar with APIs like these :) I wa
Robert Sesek
2016/02/05 22:59:58
Thanks! This is now OK. mach_task_self() is actual
|
+ |
+ 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 |
tommi
2016/02/04 20:32:44
nit:
#endif // WEBRTC_MAC
torbjorng (webrtc)
2016/02/05 16:31:05
Done.
|
+ // Make high = 2 * low + epsilon. |
+ high_encode_usage_threshold_percent = |
+ 33 * low_encode_usage_threshold_percent / 16 + 1; |
tommi
2016/02/04 20:32:44
4 space indent. (or just run git cl format?)
torbjorng (webrtc)
2016/02/05 16:31:06
Done.
|
+ } |
int low_encode_usage_threshold_percent; // Threshold for triggering underuse. |
int high_encode_usage_threshold_percent; // Threshold for triggering overuse. |