From a17e8a1a77ebcb7b2deb5dee3739581881700871 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Wed, 18 Jan 2023 13:26:25 +0100 Subject: Fix crash on error: dont do av_buffer_unref on frame contex because device_ctx frees it as well --- src/capture/nvfbc.c | 2 +- src/capture/xcomposite_cuda.c | 2 +- src/capture/xcomposite_drm.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/capture/nvfbc.c b/src/capture/nvfbc.c index ff3f9b7..9587972 100644 --- a/src/capture/nvfbc.c +++ b/src/capture/nvfbc.c @@ -172,7 +172,7 @@ static bool ffmpeg_create_cuda_contexts(gsr_capture_nvfbc *cap_nvfbc, AVCodecCon fprintf(stderr, "gsr error: cuda_create_codec_context failed: failed to initialize hardware frame context " "(note: ffmpeg version needs to be > 4.0)\n"); av_buffer_unref(&device_ctx); - av_buffer_unref(&frame_context); + //av_buffer_unref(&frame_context); return false; } diff --git a/src/capture/xcomposite_cuda.c b/src/capture/xcomposite_cuda.c index 6b2b72c..6c8550c 100644 --- a/src/capture/xcomposite_cuda.c +++ b/src/capture/xcomposite_cuda.c @@ -126,7 +126,7 @@ static bool cuda_create_codec_context(gsr_capture_xcomposite_cuda *cap_xcomp, AV fprintf(stderr, "Error: Failed to initialize hardware frame context " "(note: ffmpeg version needs to be > 4.0)\n"); av_buffer_unref(&device_ctx); - av_buffer_unref(&frame_context); + //av_buffer_unref(&frame_context); cap_xcomp->cuda.cuCtxPopCurrent_v2(&old_ctx); return false; } diff --git a/src/capture/xcomposite_drm.c b/src/capture/xcomposite_drm.c index 4c14769..6e3f7bb 100644 --- a/src/capture/xcomposite_drm.c +++ b/src/capture/xcomposite_drm.c @@ -80,7 +80,7 @@ static bool drm_create_codec_context(gsr_capture_xcomposite_drm *cap_xcomp, AVCo fprintf(stderr, "Error: Failed to initialize hardware frame context " "(note: ffmpeg version needs to be > 4.0)\n"); av_buffer_unref(&device_ctx); - av_buffer_unref(&frame_context); + //av_buffer_unref(&frame_context); return false; } -- cgit v1.2.3