Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Anton Khirnov <anton@khirnov.net>
To: ffmpeg-devel@ffmpeg.org
Subject: [FFmpeg-devel] [PATCH 2/5] lavf/demux: treat EAGAIN as REDO unless AVFMT_FLAG_NONBLOCK is set
Date: Tue,  8 Nov 2022 12:25:47 +0100
Message-ID: <20221108112550.8375-2-anton@khirnov.net> (raw)
In-Reply-To: <20221108112550.8375-1-anton@khirnov.net>

Lavf only supports a very limited approximation of non-blocking
behavior, so we should not return random EAGAINs to callers unless they
specifically requested it.
---
 libavformat/demux.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/libavformat/demux.c b/libavformat/demux.c
index 2dfd82a63c..5cd9522367 100644
--- a/libavformat/demux.c
+++ b/libavformat/demux.c
@@ -574,8 +574,12 @@ FF_ENABLE_DEPRECATION_WARNINGS
 
             /* Some demuxers return FFERROR_REDO when they consume
                data and discard it (ignored streams, junk, extradata).
-               We must re-call the demuxer to get the real packet. */
-            if (err == FFERROR_REDO)
+               We must re-call the demuxer to get the real packet.
+
+               Treat EAGAIN the same as FFERROR_REDO, unless the user
+               requested non-blocking behavior. */
+            if (err == FFERROR_REDO ||
+                (err == AVERROR(EAGAIN) && !(s->flags & AVFMT_FLAG_NONBLOCK)))
                 continue;
             if (!pktl || err == AVERROR(EAGAIN))
                 return err;
-- 
2.35.1

_______________________________________________
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:[~2022-11-08 11:26 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-08 11:25 [FFmpeg-devel] [PATCH 1/5] lavf/rtpdec_asf: set AVFMT_FLAG_NONBLOCK Anton Khirnov
2022-11-08 11:25 ` Anton Khirnov [this message]
2022-11-10 12:28   ` [FFmpeg-devel] [PATCH 2/5] lavf/demux: treat EAGAIN as REDO unless AVFMT_FLAG_NONBLOCK is set Michael Niedermayer
2022-11-10 12:31     ` Anton Khirnov
2022-11-10 12:52       ` Paul B Mahol
2022-11-10 13:33         ` Anton Khirnov
2022-11-10 19:52       ` Michael Niedermayer
2022-11-14  9:23         ` Anton Khirnov
2022-11-14 10:44           ` Nicolas George
2022-11-14 11:00             ` Anton Khirnov
2022-11-14 11:05               ` Nicolas George
2022-11-14 11:12                 ` Anton Khirnov
2022-11-14 12:40                   ` Nicolas George
2022-11-14 16:17                     ` Anton Khirnov
2022-11-14 16:22                       ` Nicolas George
2022-11-08 11:25 ` [FFmpeg-devel] [PATCH 3/5] lavf: replace FFERROR_REDO with AVERROR(EAGAIN) Anton Khirnov
2022-11-08 12:54   ` Nicolas George
2022-11-08 14:07     ` Anton Khirnov
2022-11-08 14:15       ` Nicolas George
2022-11-08 16:39         ` Anton Khirnov
2022-11-09  8:21           ` Nicolas George
2022-11-09  8:44             ` Paul B Mahol
2022-11-09  9:21               ` Nicolas George
2022-11-09  9:23                 ` Paul B Mahol
2022-11-09  9:29                   ` Nicolas George
2022-11-09  9:31             ` Anton Khirnov
2022-11-09  9:38               ` Nicolas George
2022-11-09 10:17                 ` Anton Khirnov
2022-11-09 10:41                   ` Nicolas George
2022-11-09 11:53                     ` Anton Khirnov
2022-11-09 12:42                       ` Nicolas George
2022-11-08 11:25 ` [FFmpeg-devel] [PATCH 4/5] fftools/ffmpeg_demux: do not set AVFMT_FLAG_NONBLOCK Anton Khirnov
2022-11-08 11:25 ` [FFmpeg-devel] [PATCH 5/5] fftools/ffmpeg: make demuxing with one file always blocking Anton Khirnov

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=20221108112550.8375-2-anton@khirnov.net \
    --to=anton@khirnov.net \
    --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