diff options
author | leozhang <nowerzt@gmail.com> | 2020-10-12 19:59:39 +0800 |
---|---|---|
committer | Timo Rothenpieler <timo@rothenpieler.org> | 2020-10-12 21:09:21 +0200 |
commit | b9727870ae26eadbaa443828d856f33c79938579 (patch) | |
tree | 3c68013c129eb8ee85df2a12d20344c19bd1cfa0 | |
parent | d40679d89c44fd9decc06d12a411007e73de1bd0 (diff) |
avfilter/vf_scale_cuda: unload cuModule on uninit
Signed-off-by: leozhang <nowerzt@gmail.com>
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
-rw-r--r-- | libavfilter/vf_scale_cuda.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/libavfilter/vf_scale_cuda.c b/libavfilter/vf_scale_cuda.c index 1ffb73f831..9d59ed4863 100644 --- a/libavfilter/vf_scale_cuda.c +++ b/libavfilter/vf_scale_cuda.c @@ -120,6 +120,16 @@ static av_cold void cudascale_uninit(AVFilterContext *ctx) { CUDAScaleContext *s = ctx->priv; + if (s->hwctx && s->cu_module) { + CudaFunctions *cu = s->hwctx->internal->cuda_dl; + CUcontext dummy; + + CHECK_CU(cu->cuCtxPushCurrent(s->hwctx->cuda_ctx)); + CHECK_CU(cu->cuModuleUnload(s->cu_module)); + s->cu_module = NULL; + CHECK_CU(cu->cuCtxPopCurrent(&dummy)); + } + av_frame_free(&s->frame); av_buffer_unref(&s->frames_ctx); av_frame_free(&s->tmp_frame); |