lavf/utils: remove loop on AVERROR(EAGAIN) in av_read_frame()
authorStefano Sabatini <stefasab@gmail.com>
Mon, 24 Sep 2012 18:38:14 +0000 (20:38 +0200)
committerStefano Sabatini <stefasab@gmail.com>
Mon, 24 Sep 2012 19:16:48 +0000 (21:16 +0200)
The loop was introduced in 64d340c62ad5954c1a834df2d26057135e771774, and
was likely breaking non blocking reads as it busy loops.

libavformat/utils.c

index 4f3529a..2a8fac1 100644 (file)
@@ -1409,18 +1409,12 @@ int av_read_frame(AVFormatContext *s, AVPacket *pkt)
     AVStream *st;
 
     if (!genpts) {
-        while (1) {
-            ret = s->packet_buffer ?
-                read_from_packet_buffer(&s->packet_buffer, &s->packet_buffer_end, pkt) :
-                read_frame_internal(s, pkt);
-            if (ret < 0) {
-                if (ret == AVERROR(EAGAIN))
-                    continue;
-                else
-                    return ret;
-            }
-            goto return_packet;
-        }
+        ret = s->packet_buffer ?
+            read_from_packet_buffer(&s->packet_buffer, &s->packet_buffer_end, pkt) :
+            read_frame_internal(s, pkt);
+        if (ret < 0)
+            return ret;
+        goto return_packet;
     }
 
     for (;;) {