diff options
author | Anton Khirnov <anton@khirnov.net> | 2017-01-24 15:00:22 +0100 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2024-08-12 14:42:20 +0200 |
commit | 5acbdd2264d3b90dc11369f9e031e762f260882e (patch) | |
tree | 5c3a28851bb00d5c5411297dd234efd194ae0077 /libavcodec/avcodec.c | |
parent | 4d209dada78aabedc765f393794c1a3e137b1b4f (diff) | |
download | ffmpeg-5acbdd2264d3b90dc11369f9e031e762f260882e.tar.gz |
lavc: convert frame threading to the receive_frame() pattern
Reorganize the code such that the frame threading code does not call the
decoders directly, but instead calls back into the generic decoding
code. This avoids duplicating the logic that wraps the decoder
invocation and allows receive_frame()-based decoders to use frame
threading.
Further work by Timo Rothenpieler <timo@rothenpieler.org>.
Diffstat (limited to 'libavcodec/avcodec.c')
-rw-r--r-- | libavcodec/avcodec.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/libavcodec/avcodec.c b/libavcodec/avcodec.c index 214dca4566..6065f1b689 100644 --- a/libavcodec/avcodec.c +++ b/libavcodec/avcodec.c @@ -381,10 +381,13 @@ void avcodec_flush_buffers(AVCodecContext *avctx) avci->draining = 0; avci->draining_done = 0; - av_frame_unref(avci->buffer_frame); - av_packet_unref(avci->buffer_pkt); + if (avci->buffer_frame) + av_frame_unref(avci->buffer_frame); + if (avci->buffer_pkt) + av_packet_unref(avci->buffer_pkt); - if (HAVE_THREADS && avctx->active_thread_type & FF_THREAD_FRAME) + if (HAVE_THREADS && avctx->active_thread_type & FF_THREAD_FRAME && + !avci->is_frame_mt) ff_thread_flush(avctx); else if (ffcodec(avctx->codec)->flush) ffcodec(avctx->codec)->flush(avctx); |