OSDN Git Service

fix a problem reading flv files that have null packets
authorjstebbins <jstebbins@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Sun, 2 Jan 2011 20:35:30 +0000 (20:35 +0000)
committerjstebbins <jstebbins@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Sun, 2 Jan 2011 20:35:30 +0000 (20:35 +0000)
ffmpeg will return error code EAGAIN for these packets.  we were terminating
when seeing this error code.

git-svn-id: svn://localhost/HandBrake/trunk@3724 b64f7644-9d1e-0410-96f1-a4d463321fa5

libhb/stream.c

index 32d4077..7d9b016 100644 (file)
@@ -3432,6 +3432,12 @@ static int ffmpeg_read( hb_stream_t *stream, hb_buffer_t *buf )
   again:
     if ( ( err = av_read_frame( stream->ffmpeg_ic, stream->ffmpeg_pkt )) < 0 )
     {
+        // av_read_frame can return EAGAIN.  In this case, it expects
+        // to be called again to get more data.
+        if ( err == AVERROR(EAGAIN) )
+        {
+            goto again;
+        }
         // XXX the following conditional is to handle avi files that
         // use M$ 'packed b-frames' and occasionally have negative
         // sizes for the null frames these require.