changeset 29618:1a4d159c0436

Fix an endless loop if all programs are empty.
author reimar
date Tue, 08 Sep 2009 09:08:05 +0000
parents 3343d5151134
children f53e91506133
files libmpdemux/demux_lavf.c
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demux_lavf.c	Tue Sep 08 09:07:23 2009 +0000
+++ b/libmpdemux/demux_lavf.c	Tue Sep 08 09:08:05 2009 +0000
@@ -707,6 +707,7 @@
             demux_program_t *prog = arg;
             AVProgram *program;
             int p, i;
+            int start;
 
             if(priv->avfc->nb_programs < 2)
                 return DEMUXER_CTRL_NOTIMPL;
@@ -728,6 +729,7 @@
                 p = i;
             }
             prog->vid = prog->aid = prog->sid = -2;	//no audio and no video by default
+            start = p;
 redo:
             program = priv->avfc->programs[p];
             for(i=0; i<program->nb_stream_indexes; i++)
@@ -751,6 +753,8 @@
             if(prog->progid == -1 && prog->vid == -2 && prog->aid == -2)
             {
                 p = (p + 1) % priv->avfc->nb_programs;
+                if (p == start)
+                    return DEMUXER_CTRL_DONTKNOW;
                 goto redo;
             }
             priv->cur_program = prog->progid = program->id;