Skip to content

Commit 925a1b2

Browse files
committed
obs-ffmpeg: Set needs_compat_ver before struct version checks
Because 4a8e8bb changed the NVENCAPI_STRUCT_VERSION define to rely on enc->needs_compat_ver, we must do the conditional check and define needs_compat_ver before any structs are initialized because they will check the version when doing so by calling NVENCAPI_STRUCT_VERSION internally. In this case, make sure that we define enc->needs_compat_ver before NV_ENCODE_API_FUNCTION_LIST_VER is called for NV_ENCODE_API_FUNCTION_LIST. (cherry picked from commit 24470b3)
1 parent 0823770 commit 925a1b2

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

plugins/obs-ffmpeg/obs-nvenc.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1105,6 +1105,9 @@ static void *nvenc_create_internal(enum codec_type codec, obs_data_t *settings,
11051105
enc->codec = codec;
11061106
enc->first_packet = true;
11071107

1108+
if (get_nvenc_ver() == COMPATIBILITY_VERSION) {
1109+
enc->needs_compat_ver = true;
1110+
}
11081111
NV_ENCODE_API_FUNCTION_LIST init = {NV_ENCODE_API_FUNCTION_LIST_VER};
11091112

11101113
switch (enc->codec) {
@@ -1128,9 +1131,6 @@ static void *nvenc_create_internal(enum codec_type codec, obs_data_t *settings,
11281131
if (!init_d3d11(enc, settings)) {
11291132
goto fail;
11301133
}
1131-
if (get_nvenc_ver() == COMPATIBILITY_VERSION) {
1132-
enc->needs_compat_ver = true;
1133-
}
11341134
if (!init_session(enc)) {
11351135
goto fail;
11361136
}

0 commit comments

Comments
 (0)