aboutsummaryrefslogtreecommitdiff
path: root/src/encoder
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2024-09-20 18:34:34 +0200
committerdec05eba <dec05eba@protonmail.com>2024-09-20 18:34:34 +0200
commit559a881dfdbcac547627d3155736cf653b76870c (patch)
tree1d02d26e91691b5e05833c74fec2f823d2bb1526 /src/encoder
parent3775db5565c747faa5d4a0c574269d50ee2c5c49 (diff)
Pls work
Diffstat (limited to 'src/encoder')
-rw-r--r--src/encoder/video/cuda.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/encoder/video/cuda.c b/src/encoder/video/cuda.c
index 4111137..543a1ca 100644
--- a/src/encoder/video/cuda.c
+++ b/src/encoder/video/cuda.c
@@ -309,13 +309,10 @@ static gsr_supported_video_codecs gsr_video_encoder_cuda_get_supported_codecs(gs
NV_ENCODE_API_FUNCTION_LIST function_list;
memset(&function_list, 0, sizeof(function_list));
- function_list.version = NV_ENCODE_API_FUNCTION_LIST_VER;
+ function_list.version = NVENCAPI_STRUCT_VERSION(2);
if(nvEncodeAPICreateInstance(&function_list) != NV_ENC_SUCCESS) {
- function_list.version = NVENCAPI_STRUCT_VERSION_470(2);
- if(nvEncodeAPICreateInstance(&function_list) != NV_ENC_SUCCESS) {
- fprintf(stderr, "gsr error: gsr_video_encoder_cuda_get_supported_codecs: nvEncodeAPICreateInstance failed\n");
- goto done;
- }
+ fprintf(stderr, "gsr error: gsr_video_encoder_cuda_get_supported_codecs: nvEncodeAPICreateInstance failed\n");
+ goto done;
}
NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS params;
@@ -329,10 +326,16 @@ static gsr_supported_video_codecs gsr_video_encoder_cuda_get_supported_codecs(gs
if(function_list.nvEncOpenEncodeSessionEx(&params, &nvenc_encoder) != NV_ENC_SUCCESS) {
// Old nvidia gpus dont support the new nvenc api (which is required for av1).
// In such cases fallback to old api version if possible and try again.
+ function_list.version = NVENCAPI_STRUCT_VERSION_470(2);
+ if(nvEncodeAPICreateInstance(&function_list) != NV_ENC_SUCCESS) {
+ fprintf(stderr, "gsr error: gsr_video_encoder_cuda_get_supported_codecs: nvEncodeAPICreateInstance (retry) failed\n");
+ goto done;
+ }
+
params.version = NVENCAPI_STRUCT_VERSION_470(1);
params.apiVersion = NVENCAPI_VERSION_470;
if(function_list.nvEncOpenEncodeSessionEx(&params, &nvenc_encoder) != NV_ENC_SUCCESS) {
- fprintf(stderr, "gsr error: gsr_video_encoder_cuda_get_supported_codecs: nvEncOpenEncodeSessionEx failed\n");
+ fprintf(stderr, "gsr error: gsr_video_encoder_cuda_get_supported_codecs: nvEncOpenEncodeSessionEx (retry) failed\n");
goto done;
}
}