[vlc-commits] avformat: avoid EOF if av_read_frame returns AVERROR(EAGAIN)

Rui Zhang git at videolan.org
Sun Jul 22 22:24:07 CEST 2012


vlc/vlc-1.1 | branch: master | Rui Zhang <bbcallen at gmail.com> | Thu Jul 12 19:59:25 2012 +0800| [0b1cd3370b578fae5d828bd406d28683b7919b0e] | committer: Jean-Baptiste Kempf

avformat: avoid EOF if av_read_frame returns AVERROR(EAGAIN)

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
(cherry picked from commit 352ea7df94b18869277457c79e7d5c10f388f075)

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

In fact, it closes #7145
(cherry picked from commit 74632021986be07f4afe48347167b84f60b04d5b)

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-1.1.git/?a=commit;h=0b1cd3370b578fae5d828bd406d28683b7919b0e
---

 modules/demux/avformat/demux.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/modules/demux/avformat/demux.c b/modules/demux/avformat/demux.c
index bd7c166..ecbe7e8 100644
--- a/modules/demux/avformat/demux.c
+++ b/modules/demux/avformat/demux.c
@@ -536,8 +536,13 @@ static int Demux( demux_t *p_demux )
     int64_t     i_start_time;
 
     /* Read a frame */
-    if( av_read_frame( p_sys->ic, &pkt ) )
+    int i_av_ret = av_read_frame( p_sys->ic, &pkt );
+    if( i_av_ret )
     {
+        /* Avoid EOF if av_read_frame returns AVERROR(EAGAIN) */
+        if( i_av_ret == AVERROR(EAGAIN) )
+            return 1;
+
         return 0;
     }
     if( pkt.stream_index < 0 || pkt.stream_index >= p_sys->i_tk )



More information about the vlc-commits mailing list