From f904e60c32a87f4124c3b94598a3b0141cd8b1b9 Mon Sep 17 00:00:00 2001 From: Roman Arzumanyan Date: Fri, 29 Sep 2023 15:36:31 +0300 Subject: [PATCH] libavutil/hwcontext_cuda: don't destroy external context when using current CUDA context Signed-off-by: Timo Rothenpieler --- libavutil/hwcontext_cuda.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavutil/hwcontext_cuda.c b/libavutil/hwcontext_cuda.c index c648723285..0312d3b9d7 100644 --- a/libavutil/hwcontext_cuda.c +++ b/libavutil/hwcontext_cuda.c @@ -290,7 +290,7 @@ static void cuda_device_uninit(AVHWDeviceContext *device_ctx) if (hwctx->internal->is_allocated && hwctx->cuda_ctx) { if (hwctx->internal->flags & AV_CUDA_USE_PRIMARY_CONTEXT) CHECK_CU(cu->cuDevicePrimaryCtxRelease(hwctx->internal->cuda_device)); - else + else if (!(hwctx->internal->flags & AV_CUDA_USE_CURRENT_CONTEXT)) CHECK_CU(cu->cuCtxDestroy(hwctx->cuda_ctx)); hwctx->cuda_ctx = NULL;