PS: fix length computation
authorJean-Baptiste Kempf <jb@videolan.org>
Tue, 12 Aug 2014 09:46:46 +0000 (11:46 +0200)
committerJean-Baptiste Kempf <jb@videolan.org>
Tue, 12 Aug 2014 18:21:53 +0000 (20:21 +0200)
Should close #9412
Ref #7303 #8180 #7889 #10123 #2608

modules/demux/ps.c

index a7d96b5..0fc678d 100644 (file)
@@ -255,11 +255,11 @@ static void FindLength( demux_t *p_demux )
 
         /* Check end */
         i_size = stream_Size( p_demux->s );
 
         /* Check end */
         i_size = stream_Size( p_demux->s );
-        i_end = VLC_CLIP( i_size, 0, 20000 );
+        i_end = VLC_CLIP( i_size, 0, 200000 );
         stream_Seek( p_demux->s, i_size - i_end );
 
         i = 0;
         stream_Seek( p_demux->s, i_size - i_end );
 
         i = 0;
-        while( vlc_object_alive (p_demux) && i < 40 && Demux2( p_demux, true ) > 0 ) i++;
+        while( vlc_object_alive (p_demux) && i < 400 && Demux2( p_demux, true ) > 0 ) i++;
         if( i_current_pos >= 0 ) stream_Seek( p_demux->s, i_current_pos );
     }
 
         if( i_current_pos >= 0 ) stream_Seek( p_demux->s, i_current_pos );
     }
 
@@ -267,7 +267,7 @@ static void FindLength( demux_t *p_demux )
     for( int i = 0; i < PS_TK_COUNT; i++ )
     {
         ps_track_t *tk = &p_sys->tk[i];
     for( int i = 0; i < PS_TK_COUNT; i++ )
     {
         ps_track_t *tk = &p_sys->tk[i];
-        if( tk->i_first_pts >= 0 && tk->i_last_pts > 0 &&
+        if( tk->i_last_pts > 0 &&
             tk->i_last_pts > tk->i_first_pts )
         {
             int64_t i_length = (int64_t)tk->i_last_pts - tk->i_first_pts;
             tk->i_last_pts > tk->i_first_pts )
         {
             int64_t i_length = (int64_t)tk->i_last_pts - tk->i_first_pts;