Commit 76e67e8c authored by Gildas Bazin's avatar Gildas Bazin

* modules/demux/avi/avi.c: Fixed infinite loop in the AVI demux on broken/incomplete files

parent 6f2c07b9
...@@ -29,6 +29,7 @@ Input: ...@@ -29,6 +29,7 @@ Input:
Demux: Demux:
* Annodex (http://www.annodex.net) support. * Annodex (http://www.annodex.net) support.
* mmsh streaming fixes. * mmsh streaming fixes.
* Fixed infinite loop in the AVI demux on broken/incomplete files.
Subtitles: Subtitles:
* Subviewer and subviewer v2 subtitles support. * Subviewer and subviewer v2 subtitles support.
......
...@@ -693,6 +693,8 @@ static int Demux_Seekable( demux_t *p_demux ) ...@@ -693,6 +693,8 @@ static int Demux_Seekable( demux_t *p_demux )
if( i_pos == -1 ) if( i_pos == -1 )
{ {
int i_loop_count = 0;
/* no valid index, we will parse directly the stream /* no valid index, we will parse directly the stream
* in case we fail we will disable all finished stream */ * in case we fail we will disable all finished stream */
if( p_sys->i_movi_lastchunk_pos >= p_sys->i_movi_begin + 12 ) if( p_sys->i_movi_lastchunk_pos >= p_sys->i_movi_begin + 12 )
...@@ -727,6 +729,19 @@ static int Demux_Seekable( demux_t *p_demux ) ...@@ -727,6 +729,19 @@ static int Demux_Seekable( demux_t *p_demux )
"cannot skip packet, track disabled" ); "cannot skip packet, track disabled" );
return( AVI_TrackStopFinishedStreams( p_demux ) ? 0 : 1 ); return( AVI_TrackStopFinishedStreams( p_demux ) ? 0 : 1 );
} }
/* Prevents from eating all the CPU with broken files.
* This value should be low enough so that it doesn't
* affect the reading speed too much. */
if( !(++i_loop_count % 1024) )
{
if( p_demux->b_die ) return -1;
msleep( 10000 );
if( !(i_loop_count % (1024 * 10)) )
msg_Warn( p_demux,
"doesn't seem to find any data..." );
}
continue; continue;
} }
else else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment