[FFmpeg-cvslog] libavutil/hwcontext_cuda: don't destroy external context when using current CUDA context

Roman Arzumanyan git at videolan.org
Fri Sep 29 20:45:31 EEST 2023


ffmpeg | branch: master | Roman Arzumanyan <r.arzumanyan at visionlabs.ai> | Fri Sep 29 15:36:31 2023 +0300| [f904e60c32a87f4124c3b94598a3b0141cd8b1b9] | committer: Timo Rothenpieler

libavutil/hwcontext_cuda: don't destroy external context when using current CUDA context

Signed-off-by: Timo Rothenpieler <timo at rothenpieler.org>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f904e60c32a87f4124c3b94598a3b0141cd8b1b9
---

 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;



More information about the ffmpeg-cvslog mailing list