diff options
author | Timo Rothenpieler <timo@rothenpieler.org> | 2018-01-28 12:39:03 +0100 |
---|---|---|
committer | Timo Rothenpieler <timo@rothenpieler.org> | 2018-01-28 12:39:06 +0100 |
commit | 32bc4e77f61a5483c83a360b9ccbfc2840daba1e (patch) | |
tree | 364a7e1e49766bc46216347e9c9f81d8c1cfd6b9 | |
parent | bbe1b21022e4872bc64066d46a4567dc1b655f7a (diff) | |
download | ffmpeg-32bc4e77f61a5483c83a360b9ccbfc2840daba1e.tar.gz |
avcodec/nvenc: unregister input resource when unmapping
Currently the resource is only ever unregistered when the
registered_frames array is fully in use and an unmapped entry is re-used
and cleaned up.
I'm pretty sure the frame will have been cleaned up before that happens,
so I'm kinda surprised this never blew up.
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
-rw-r--r-- | libavcodec/nvenc.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c index 0ecaa15162..a8194231ae 100644 --- a/libavcodec/nvenc.c +++ b/libavcodec/nvenc.c @@ -1797,6 +1797,8 @@ static int process_output_surface(AVCodecContext *avctx, AVPacket *pkt, NvencSur ctx->registered_frames[tmpoutsurf->reg_idx].mapped -= 1; if (ctx->registered_frames[tmpoutsurf->reg_idx].mapped == 0) { p_nvenc->nvEncUnmapInputResource(ctx->nvencoder, ctx->registered_frames[tmpoutsurf->reg_idx].in_map.mappedResource); + p_nvenc->nvEncUnregisterResource(ctx->nvencoder, ctx->registered_frames[tmpoutsurf->reg_idx].regptr); + ctx->registered_frames[tmpoutsurf->reg_idx].regptr = NULL; } else if (ctx->registered_frames[tmpoutsurf->reg_idx].mapped < 0) { res = AVERROR_BUG; goto error; |