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

Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
This commit is contained in:
Roman Arzumanyan 2023-09-29 15:36:31 +03:00 committed by Timo Rothenpieler
parent 442d9412d2
commit f904e60c32
1 changed files with 1 additions and 1 deletions

View File

@ -290,7 +290,7 @@ static void cuda_device_uninit(AVHWDeviceContext *device_ctx)
if (hwctx->internal->is_allocated && hwctx->cuda_ctx) { if (hwctx->internal->is_allocated && hwctx->cuda_ctx) {
if (hwctx->internal->flags & AV_CUDA_USE_PRIMARY_CONTEXT) if (hwctx->internal->flags & AV_CUDA_USE_PRIMARY_CONTEXT)
CHECK_CU(cu->cuDevicePrimaryCtxRelease(hwctx->internal->cuda_device)); 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)); CHECK_CU(cu->cuCtxDestroy(hwctx->cuda_ctx));
hwctx->cuda_ctx = NULL; hwctx->cuda_ctx = NULL;