avformat/flvdec: Change packet loop to return EAGAIN instead of looping until a valid...
authorMichael Niedermayer <michael@niedermayer.cc>
Tue, 15 Sep 2015 23:39:18 +0000 (01:39 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Wed, 16 Sep 2015 01:32:27 +0000 (03:32 +0200)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavformat/flvdec.c

index 826e0d7..cec40e0 100644 (file)
@@ -832,8 +832,10 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
             }
         }
 
-        if (size == 0)
-            continue;
+        if (size == 0) {
+            ret = AVERROR(EAGAIN);
+            goto leave;
+        }
 
         next = size + avio_tell(s->pb);
 
@@ -876,12 +878,15 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
                    type, size, flags);
 skip:
             avio_seek(s->pb, next, SEEK_SET);
-            continue;
+            ret = AVERROR(EAGAIN);
+            goto leave;
         }
 
         /* skip empty data packets */
-        if (!size)
-            continue;
+        if (!size) {
+            ret = AVERROR(EAGAIN);
+            goto leave;
+        }
 
         /* now find stream */
         for (i = 0; i < s->nb_streams; i++) {
@@ -919,7 +924,8 @@ skip:
             || st->discard >= AVDISCARD_ALL
         ) {
             avio_seek(s->pb, next, SEEK_SET);
-            continue;
+            ret = AVERROR(EAGAIN);
+            goto leave;
         }
         break;
     }