[FFmpeg-devel] [PATCH] ffprobe: do not exit in case the demuxer returns AVERROR(EAGAIN)

Stefano Sabatini stefasab at gmail.com
Tue Nov 17 15:13:02 CET 2015


Fix demuxing of files for which the demuxer returns AVERROR(EAGAIN) at
some point. Also returns error code to the caller in case of different
non EOF error.
---
 ffprobe.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/ffprobe.c b/ffprobe.c
index c304a6d..481ff0b 100644
--- a/ffprobe.c
+++ b/ffprobe.c
@@ -2027,7 +2027,16 @@ static int read_interval_packets(WriterContext *w, AVFormatContext *fmt_ctx,
         ret = AVERROR(ENOMEM);
         goto end;
     }
-    while (!av_read_frame(fmt_ctx, &pkt)) {
+    while (1) {
+        ret = av_read_frame(fmt_ctx, &pkt);
+        if (ret == AVERROR(EAGAIN))
+            continue;
+        if (ret < 0) {
+            if (ret == AVERROR_EOF)
+                ret = 0;
+            break;
+        }
+
         if (fmt_ctx->nb_streams > nb_streams) {
             REALLOCZ_ARRAY_STREAM(nb_streams_frames,  nb_streams, fmt_ctx->nb_streams);
             REALLOCZ_ARRAY_STREAM(nb_streams_packets, nb_streams, fmt_ctx->nb_streams);
-- 
1.9.1



More information about the ffmpeg-devel mailing list