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 runningmaster
parent
571dd0f166
commit
2deb796f49
|
@ -18,6 +18,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <util/dstr.h>
|
#include <util/dstr.h>
|
||||||
#include <util/darray.h>
|
#include <util/darray.h>
|
||||||
|
#include <util/platform.h>
|
||||||
#include <obs-module.h>
|
#include <obs-module.h>
|
||||||
|
|
||||||
#ifndef _STDINT_H_INCLUDED
|
#ifndef _STDINT_H_INCLUDED
|
||||||
|
@ -37,18 +38,20 @@
|
||||||
/* ------------------------------------------------------------------------- */
|
/* ------------------------------------------------------------------------- */
|
||||||
|
|
||||||
struct obs_x264 {
|
struct obs_x264 {
|
||||||
obs_encoder_t encoder;
|
obs_encoder_t encoder;
|
||||||
|
|
||||||
x264_param_t params;
|
x264_param_t params;
|
||||||
x264_t *context;
|
x264_t *context;
|
||||||
|
|
||||||
DARRAY(uint8_t) packet_data;
|
DARRAY(uint8_t) packet_data;
|
||||||
|
|
||||||
uint8_t *extra_data;
|
uint8_t *extra_data;
|
||||||
uint8_t *sei;
|
uint8_t *sei;
|
||||||
|
|
||||||
size_t extra_data_size;
|
size_t extra_data_size;
|
||||||
size_t sei_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;
|
struct obs_x264 *obsx264 = data;
|
||||||
|
|
||||||
if (obsx264) {
|
if (obsx264) {
|
||||||
|
os_end_high_performance(obsx264->performance_token);
|
||||||
clear_data(obsx264);
|
clear_data(obsx264);
|
||||||
da_free(obsx264->packet_data);
|
da_free(obsx264->packet_data);
|
||||||
bfree(obsx264);
|
bfree(obsx264);
|
||||||
|
@ -401,6 +405,9 @@ static void *obs_x264_create(obs_data_t settings, obs_encoder_t encoder)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
obsx264->performance_token =
|
||||||
|
os_request_high_performance("x264 encoding");
|
||||||
|
|
||||||
return obsx264;
|
return obsx264;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue