From 2deb796f492f77fcb2e6fdc486c70d24d5fc296b Mon Sep 17 00:00:00 2001 From: Palana Date: Fri, 22 Aug 2014 05:24:01 +0200 Subject: [PATCH] Request high performance mode when using x264 encoder This should probably be reevaluated once we have global hotkeys or other functions that would require OBS to not be sent to sleep while in the background without having any sort of encoder running --- plugins/obs-x264/obs-x264.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/plugins/obs-x264/obs-x264.c b/plugins/obs-x264/obs-x264.c index 125dc736d..c55311b77 100644 --- a/plugins/obs-x264/obs-x264.c +++ b/plugins/obs-x264/obs-x264.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #ifndef _STDINT_H_INCLUDED @@ -37,18 +38,20 @@ /* ------------------------------------------------------------------------- */ struct obs_x264 { - obs_encoder_t encoder; + obs_encoder_t encoder; - x264_param_t params; - x264_t *context; + x264_param_t params; + x264_t *context; - DARRAY(uint8_t) packet_data; + DARRAY(uint8_t) packet_data; - uint8_t *extra_data; - uint8_t *sei; + uint8_t *extra_data; + uint8_t *sei; - size_t extra_data_size; - size_t sei_size; + size_t extra_data_size; + size_t sei_size; + + os_performance_token_t performance_token; }; /* ------------------------------------------------------------------------- */ @@ -78,6 +81,7 @@ static void obs_x264_destroy(void *data) struct obs_x264 *obsx264 = data; if (obsx264) { + os_end_high_performance(obsx264->performance_token); clear_data(obsx264); da_free(obsx264->packet_data); bfree(obsx264); @@ -401,6 +405,9 @@ static void *obs_x264_create(obs_data_t settings, obs_encoder_t encoder) return NULL; } + obsx264->performance_token = + os_request_high_performance("x264 encoding"); + return obsx264; }