[FFmpeg-cvslog] avfilter/vf_scale_cuda: unload cuModule on uninit

leozhang git at videolan.org
Mon Oct 12 22:10:32 EEST 2020


ffmpeg | branch: master | leozhang <nowerzt at gmail.com> | Mon Oct 12 19:59:39 2020 +0800| [b9727870ae26eadbaa443828d856f33c79938579] | committer: Timo Rothenpieler

avfilter/vf_scale_cuda: unload cuModule on uninit

Signed-off-by: leozhang <nowerzt at gmail.com>
Signed-off-by: Timo Rothenpieler <timo at rothenpieler.org>

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

 libavfilter/vf_scale_cuda.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

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);



More information about the ffmpeg-cvslog mailing list