Fix crash on error: dont do av_buffer_unref on frame contex because device_ctx frees it as well

This commit is contained in:
dec05eba 2023-01-18 13:26:25 +01:00
parent bf6fbea736
commit a17e8a1a77
3 changed files with 3 additions and 3 deletions

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}