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

Rui Zhang git at videolan.org
Tue Jul 17 10:11:50 CEST 2012


vlc/vlc-2.0 | branch: master | Rui Zhang <bbcallen at gmail.com> | Thu Jul 12 19:59:25 2012 +0800| [74632021986be07f4afe48347167b84f60b04d5b] | 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

> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.0.git/?a=commit;h=74632021986be07f4afe48347167b84f60b04d5b
---

 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 3264b11..ada3849 100644
--- a/modules/demux/avformat/demux.c
+++ b/modules/demux/avformat/demux.c
@@ -571,8 +571,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