Browse code

Dont give up after 100kb of zero bytes but returnd EAGAIN fixes issue1729

Originally committed as revision 21738 to svn://svn.ffmpeg.org/ffmpeg/trunk

Michael Niedermayer authored on 2010/02/10 23:25:57
Showing 1 changed files
... ...
@@ -247,8 +247,13 @@ static int mpegps_read_pes_header(AVFormatContext *s,
247 247
         startcode = find_next_start_code(s->pb, &size, &m->header_state);
248 248
         last_sync = url_ftell(s->pb);
249 249
     //printf("startcode=%x pos=0x%"PRIx64"\n", startcode, url_ftell(s->pb));
250
-    if (startcode < 0)
251
-        return AVERROR(EIO);
250
+    if (startcode < 0){
251
+        if(url_feof(s->pb))
252
+            return AVERROR_EOF;
253
+        //FIXME we should remember header_state
254
+        return AVERROR(EAGAIN);
255
+    }
256
+
252 257
     if (startcode == PACK_START_CODE)
253 258
         goto redo;
254 259
     if (startcode == SYSTEM_HEADER_START_CODE)