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-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to