[FFmpeg-cvslog] avcodec/nvenc: unregister input resource when unmapping
Timo Rothenpieler
git at videolan.org
Sun Jan 28 14:14:09 EET 2018
ffmpeg | branch: master | Timo Rothenpieler <timo at rothenpieler.org> | Sun Jan 28 12:39:03 2018 +0100| [32bc4e77f61a5483c83a360b9ccbfc2840daba1e] | committer: Timo Rothenpieler
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 at rothenpieler.org>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=32bc4e77f61a5483c83a360b9ccbfc2840daba1e
---
libavcodec/nvenc.c | 2 ++
1 file changed, 2 insertions(+)
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;
More information about the ffmpeg-cvslog
mailing list