changeset 5642:747753995dee libavformat

Dont give up after 100kb of zero bytes but returnd EAGAIN fixes issue1729
author michael
date Wed, 10 Feb 2010 14:25:57 +0000
parents 980dc98901d9
children 457efbf56d15
files mpeg.c
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mpeg.c	Wed Feb 10 12:44:16 2010 +0000
+++ b/mpeg.c	Wed Feb 10 14:25:57 2010 +0000
@@ -247,8 +247,13 @@
         startcode = find_next_start_code(s->pb, &size, &m->header_state);
         last_sync = url_ftell(s->pb);
     //printf("startcode=%x pos=0x%"PRIx64"\n", startcode, url_ftell(s->pb));
-    if (startcode < 0)
-        return AVERROR(EIO);
+    if (startcode < 0){
+        if(url_feof(s->pb))
+            return AVERROR_EOF;
+        //FIXME we should remember header_state
+        return AVERROR(EAGAIN);
+    }
+
     if (startcode == PACK_START_CODE)
         goto redo;
     if (startcode == SYSTEM_HEADER_START_CODE)