[FFmpeg-cvslog] avcodec/avcodec: Avoid av_frame_unref(NULL)
Andreas Rheinhardt
git at videolan.org
Wed Apr 13 19:04:54 EEST 2022
ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Wed Apr 13 15:40:05 2022 +0200| [3649051dc4e1ede5999a7c688864e5a616f985ee] | committer: Andreas Rheinhardt
avcodec/avcodec: Avoid av_frame_unref(NULL)
It works, but it is not documented to work.
Reviewed-by: Anton Khirnov <anton at khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3649051dc4e1ede5999a7c688864e5a616f985ee
---
libavcodec/avcodec.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/libavcodec/avcodec.c b/libavcodec/avcodec.c
index e0f38ac42a..ded6b5b307 100644
--- a/libavcodec/avcodec.c
+++ b/libavcodec/avcodec.c
@@ -420,6 +420,8 @@ void avcodec_flush_buffers(AVCodecContext *avctx)
"that doesn't support it\n");
return;
}
+ if (avci->in_frame)
+ av_frame_unref(avci->in_frame);
}
avci->draining = 0;
@@ -432,7 +434,6 @@ void avcodec_flush_buffers(AVCodecContext *avctx)
while (av_fifo_read(avci->pkt_props, avci->last_pkt_props, 1) >= 0)
av_packet_unref(avci->last_pkt_props);
- av_frame_unref(avci->in_frame);
av_packet_unref(avci->in_pkt);
if (HAVE_THREADS && avctx->active_thread_type & FF_THREAD_FRAME)
More information about the ffmpeg-cvslog
mailing list