obs-nvenc: Check if device index in settings object is actually set

This commit is contained in:
derrod
2024-09-10 23:22:00 +02:00
committed by Ryan Foster
parent 4b0777a303
commit e25a8b3a4f

View File

@@ -888,13 +888,14 @@ static void *nvenc_create_base(enum codec_type codec, obs_data_t *settings,
* option as it may cause issues for people.
*/
const int gpu = (int)obs_data_get_int(settings, "device");
const bool gpu_set = obs_data_has_user_value(settings, "device");
#ifndef _WIN32
const bool force_tex = obs_data_get_bool(settings, "force_cuda_tex");
#else
const bool force_tex = false;
#endif
if (gpu != -1 && texture && !force_tex) {
if (gpu_set && gpu != -1 && texture && !force_tex) {
blog(LOG_INFO,
"[obs-nvenc] different GPU selected by user, falling back "
"to non-texture encoder");