Patch attached. - Andreas
From b409d3603879068dde860117fb2f0a5ba1840154 Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt <andreas.rheinha...@outlook.com> Date: Mon, 5 May 2025 14:13:58 +0200 Subject: [PATCH] fftools/ffmpeg_dec: Always receive frames from decoder
Up until now if avcodec_send_packet() returned an error, no attempt to receive a frame from the decoder would be made. Instead the decoder was presumed to be drained, so that more packets could be sent to it. Yet this need not be so: It can happen that a packet would decode to multiple frames and that decoding the first of these (the one that is decoded during the avcodec_send_packet() call) returns an error, in which case the decoder is not yet ready to receive more input as the remaining parts of the packet have not been decoded yet. In this case, an AERROR_BUG is triggered. This happens in ticket #11553 with VP9 (which uses a BSF to split VP9 superframes and is therefore affected by this). Fix this by always calling avcodec_receive_frame() unless xerror is set. Signed-off-by: Andreas Rheinhardt <andreas.rheinha...@outlook.com> --- fftools/ffmpeg_dec.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/fftools/ffmpeg_dec.c b/fftools/ffmpeg_dec.c index 62edbb6c24..b06455c7b1 100644 --- a/fftools/ffmpeg_dec.c +++ b/fftools/ffmpeg_dec.c @@ -733,13 +733,12 @@ static int packet_decode(DecoderPriv *dp, AVPacket *pkt, AVFrame *frame) av_log(dp, AV_LOG_ERROR, "Error submitting %s to decoder: %s\n", pkt ? "packet" : "EOF", av_err2str(ret)); - if (ret != AVERROR_EOF) { - dp->dec.decode_errors++; - if (!exit_on_error) - ret = 0; - } + if (ret == AVERROR_EOF) + return ret; - return ret; + dp->dec.decode_errors++; + if (exit_on_error) + return ret; } while (1) { -- 2.45.2
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".