diff options
author | wm4 <wm4@nowhere> | 2015-11-08 19:31:09 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2015-11-08 19:33:38 +0100 |
commit | 16cd20c46f02a052f06742329dc375a695bb6e0b (patch) | |
tree | 3c25698603d960176e994708f4b9328425b7cb35 /video | |
parent | 8f7b12d9ae3f1034cc86cea520bbb7579b1a3a25 (diff) |
win32: request MMCSS "Playback" profile
Diffstat (limited to 'video')
-rw-r--r-- | video/out/w32_common.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/video/out/w32_common.c b/video/out/w32_common.c index 09088df79d..667d7b425a 100644 --- a/video/out/w32_common.c +++ b/video/out/w32_common.c @@ -24,6 +24,7 @@ #include <initguid.h> #include <ole2.h> #include <shobjidl.h> +#include <avrt.h> #include "options/options.h" #include "input/keycodes.h" @@ -107,6 +108,8 @@ struct vo_w32_state { // updates on move/resize/displaychange double display_fps; + + HANDLE avrt_handle; }; typedef struct tagDropTarget { @@ -1263,6 +1266,11 @@ int vo_w32_init(struct vo *vo) goto fail; } + // While the UI runs in its own thread, the thread in which this function + // runs in will be the renderer thread. Apply magic MMCSS cargo-cult, + // which might stop Windows from throttling clock rate and so on. + w32->avrt_handle = AvSetMmThreadCharacteristicsW(L"Playback", &(DWORD){0}); + return 1; fail: talloc_free(w32); @@ -1393,6 +1401,8 @@ void vo_w32_uninit(struct vo *vo) mp_dispatch_run(w32->dispatch, do_terminate, w32); pthread_join(w32->thread, NULL); + AvRevertMmThreadCharacteristics(w32->avrt_handle); + talloc_free(w32); vo->w32 = NULL; } |