avfilter/vf_scale_cuda: unload cuModule on uninit

Signed-off-by: leozhang <nowerzt@gmail.com>
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
This commit is contained in:
leozhang 2020-10-12 19:59:39 +08:00 committed by Timo Rothenpieler
parent d40679d89c
commit b9727870ae
1 changed files with 10 additions and 0 deletions

View File

@ -120,6 +120,16 @@ static av_cold void cudascale_uninit(AVFilterContext *ctx)
{ {
CUDAScaleContext *s = ctx->priv; 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_frame_free(&s->frame);
av_buffer_unref(&s->frames_ctx); av_buffer_unref(&s->frames_ctx);
av_frame_free(&s->tmp_frame); av_frame_free(&s->tmp_frame);