[FFmpeg-cvslog] lavc/decode: do not perform decoding when sending draining packets

Anton Khirnov git at videolan.org
Fri Jul 7 13:16:05 EEST 2023


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Tue Jun 20 16:10:10 2023 +0200| [b54603a26a53bfd89fd19b97308e64f4fbeef4b3] | committer: Anton Khirnov

lavc/decode: do not perform decoding when sending draining packets

This way decoding errors will not be returned when the user starts
draining the decoder, avoiding confusion over whether draining did or
did not start.

Fixes failures of fate-h264-attachment-631 for certain numbers of frame
threads (e.g. 5).

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b54603a26a53bfd89fd19b97308e64f4fbeef4b3
---

 libavcodec/decode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index 89c3c2a48d..269633ce10 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -674,7 +674,7 @@ int attribute_align_arg avcodec_send_packet(AVCodecContext *avctx, const AVPacke
     } else
         dc->draining_started = 1;
 
-    if (!avci->buffer_frame->buf[0]) {
+    if (!avci->buffer_frame->buf[0] && !dc->draining_started) {
         ret = decode_receive_frame_internal(avctx, avci->buffer_frame);
         if (ret < 0 && ret != AVERROR(EAGAIN) && ret != AVERROR_EOF)
             return ret;



More information about the ffmpeg-cvslog mailing list