Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: James Almer <jamrial@gmail.com>
To: ffmpeg-devel@ffmpeg.org
Subject: Re: [FFmpeg-devel] [PATCH] fftools/ffmpeg_dec: abort if avcodec_send_packet() returns EAGAIN
Date: Fri, 26 May 2023 16:57:01 -0300
Message-ID: <afdd156c-ddab-2c54-c6b6-370f79b2efe1@gmail.com> (raw)
In-Reply-To: <20230524113154.1508-1-jamrial@gmail.com>

On 5/24/2023 8:31 AM, James Almer wrote:
> As the comment in the code mentions, EAGAIN is not an expected value here
> because we call avcodec_receive_frame() until all frames have been returned.
> avcodec_send_packet() returning EAGAIN means a packet is still buffered, which
> hints that the underlying decoder is buggy and not fetching packets as it
> should.
> 
> An example of this behavior was in the libdav1d wrapper before f209614290,
> where feeding it split frames (or individual OBUs) would result in the CLI
> eventually printing the unuseful "Error submitting packet to decoder: Resource
> temporarily unavailable" error message, and just keep until EOF without
> returning new frames.
> 
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
> Now compiling.
> 
>   fftools/ffmpeg_dec.c | 5 +++++
>   1 file changed, 5 insertions(+)
> 
> diff --git a/fftools/ffmpeg_dec.c b/fftools/ffmpeg_dec.c
> index e06747d9c4..b1db9b30d0 100644
> --- a/fftools/ffmpeg_dec.c
> +++ b/fftools/ffmpeg_dec.c
> @@ -390,6 +390,11 @@ int dec_packet(InputStream *ist, const AVPacket *pkt, int no_eof)
>       if (ret < 0 && !(ret == AVERROR_EOF && !pkt)) {
>           // In particular, we don't expect AVERROR(EAGAIN), because we read all
>           // decoded frames with avcodec_receive_frame() until done.
> +        if (ret == AVERROR(EAGAIN)) {
> +            av_log(ist, AV_LOG_FATAL, "A decoder returned an unexpected error code. "
> +                   "This is a bug, please report it.\n");
> +            exit_program(1);
> +        }
>           av_log(ist, AV_LOG_ERROR, "Error submitting %s to decoder: %s\n",
>                  pkt ? "packet" : "EOF", av_err2str(ret));
>           if (exit_on_error)

Will apply.
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

      reply	other threads:[~2023-05-26 19:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-22 22:18 James Almer
2023-05-24 11:31 ` James Almer
2023-05-26 19:57   ` James Almer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=afdd156c-ddab-2c54-c6b6-370f79b2efe1@gmail.com \
    --to=jamrial@gmail.com \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git