avcodec/avcodec: Avoid av_frame_unref(NULL)

It works, but it is not documented to work.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
release/5.1
Andreas Rheinhardt 3 years ago
parent 3a920372a1
commit 3649051dc4
  1. 3
      libavcodec/avcodec.c

@ -420,6 +420,8 @@ void avcodec_flush_buffers(AVCodecContext *avctx)
"that doesn't support it\n"); "that doesn't support it\n");
return; return;
} }
if (avci->in_frame)
av_frame_unref(avci->in_frame);
} }
avci->draining = 0; 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) while (av_fifo_read(avci->pkt_props, avci->last_pkt_props, 1) >= 0)
av_packet_unref(avci->last_pkt_props); av_packet_unref(avci->last_pkt_props);
av_frame_unref(avci->in_frame);
av_packet_unref(avci->in_pkt); av_packet_unref(avci->in_pkt);
if (HAVE_THREADS && avctx->active_thread_type & FF_THREAD_FRAME) if (HAVE_THREADS && avctx->active_thread_type & FF_THREAD_FRAME)

Loading…
Cancel
Save