vlc | branch: master | Steve Lhomme <[email protected]> | Thu Jun 7 11:19:17 2018 +0200| [8b3a838a4500312500a56126ccb7b4426578840f] | committer: Steve Lhomme
demux:asf: make sure the length cannot be negative > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=8b3a838a4500312500a56126ccb7b4426578840f --- modules/demux/asf/asf.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/modules/demux/asf/asf.c b/modules/demux/asf/asf.c index f9cc4ce28e..30786754a5 100644 --- a/modules/demux/asf/asf.c +++ b/modules/demux/asf/asf.c @@ -437,7 +437,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args ) SeekPrepare( p_demux ); - if( p_sys->b_index && p_sys->i_length > 0 ) + if( p_sys->b_index && p_sys->i_length != 0 ) { va_list acpy; va_copy( acpy, args ); @@ -495,7 +495,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args ) case DEMUX_GET_POSITION: if( p_sys->i_time == VLC_TICK_INVALID ) return VLC_EGENERIC; - if( p_sys->i_length > 0 ) + if( p_sys->i_length != 0 ) { pf = va_arg( args, double * ); *pf = p_sys->i_time / (double)p_sys->i_length; @@ -515,7 +515,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args ) SeekPrepare( p_demux ); - if( p_sys->b_index && p_sys->i_length > 0 ) + if( p_sys->b_index && p_sys->i_length != 0 ) { va_list acpy; va_copy( acpy, args ); @@ -1237,12 +1237,12 @@ static int DemuxInit( demux_t *p_demux ) /* calculate the time duration in micro-s */ p_sys->i_length = VLC_TICK_FROM_MSFTIME(p_sys->p_fp->i_play_duration) * (vlc_tick_t)i_count / - (vlc_tick_t)p_sys->p_fp->i_data_packets_count - p_sys->p_fp->i_preroll; - if( p_sys->i_length < 0 ) + (vlc_tick_t)p_sys->p_fp->i_data_packets_count; + if( p_sys->i_length <= p_sys->p_fp->i_preroll ) p_sys->i_length = 0; - - if( p_sys->i_length > 0 ) + else { + p_sys->i_length -= p_sys->p_fp->i_preroll; p_sys->i_bitrate = 8 * i_size * CLOCK_FREQ / p_sys->i_length; } } _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
