mirror of
https://repo.dec05eba.com/gpu-screen-recorder
synced 2026-05-06 06:50:43 +09:00
Dont crash on error in nvenc query
This commit is contained in:
@@ -287,6 +287,7 @@ static gsr_supported_video_codecs gsr_video_encoder_cuda_get_supported_codecs(gs
|
|||||||
(void)encoder;
|
(void)encoder;
|
||||||
|
|
||||||
void *nvenc_lib = NULL;
|
void *nvenc_lib = NULL;
|
||||||
|
void *nvenc_encoder = NULL;
|
||||||
gsr_cuda cuda;
|
gsr_cuda cuda;
|
||||||
memset(&cuda, 0, sizeof(cuda));
|
memset(&cuda, 0, sizeof(cuda));
|
||||||
gsr_supported_video_codecs supported_video_codecs = {0};
|
gsr_supported_video_codecs supported_video_codecs = {0};
|
||||||
@@ -321,8 +322,6 @@ static gsr_supported_video_codecs gsr_video_encoder_cuda_get_supported_codecs(gs
|
|||||||
params.deviceType = NV_ENC_DEVICE_TYPE_CUDA;
|
params.deviceType = NV_ENC_DEVICE_TYPE_CUDA;
|
||||||
params.device = cuda.cu_ctx;
|
params.device = cuda.cu_ctx;
|
||||||
params.apiVersion = NVENCAPI_VERSION;
|
params.apiVersion = NVENCAPI_VERSION;
|
||||||
|
|
||||||
void *nvenc_encoder = NULL;
|
|
||||||
if(function_list.nvEncOpenEncodeSessionEx(¶ms, &nvenc_encoder) != NV_ENC_SUCCESS) {
|
if(function_list.nvEncOpenEncodeSessionEx(¶ms, &nvenc_encoder) != NV_ENC_SUCCESS) {
|
||||||
// Old nvidia gpus dont support the new nvenc api (which is required for av1).
|
// 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.
|
// In such cases fallback to old api version if possible and try again.
|
||||||
@@ -344,6 +343,7 @@ static gsr_supported_video_codecs gsr_video_encoder_cuda_get_supported_codecs(gs
|
|||||||
|
|
||||||
done:
|
done:
|
||||||
if(cleanup) {
|
if(cleanup) {
|
||||||
|
if(nvenc_encoder)
|
||||||
function_list.nvEncDestroyEncoder(nvenc_encoder);
|
function_list.nvEncDestroyEncoder(nvenc_encoder);
|
||||||
if(nvenc_lib)
|
if(nvenc_lib)
|
||||||
dlclose(nvenc_lib);
|
dlclose(nvenc_lib);
|
||||||
|
|||||||
Reference in New Issue
Block a user