]> git.sesse.net Git - vlc/commitdiff
Fixed asf media length (close #2674 and close #3429).
authorLaurent Aimar <fenrir@videolan.org>
Tue, 23 Mar 2010 20:29:37 +0000 (21:29 +0100)
committerLaurent Aimar <fenrir@videolan.org>
Tue, 23 Mar 2010 20:34:35 +0000 (21:34 +0100)
modules/demux/asf/asf.c

index 570868f23a2b46b7284ac512ce656418e08e644e..e408296e25a703dc4e2934be5d96473489a49f5b 100644 (file)
@@ -1014,7 +1014,9 @@ static int DemuxInit( demux_t *p_demux )
         /* calculate the time duration in micro-s */
         p_sys->i_length = (mtime_t)p_sys->p_fp->i_play_duration / 10 *
                    (mtime_t)i_count /
-                   (mtime_t)p_sys->p_fp->i_data_packets_count;
+                   (mtime_t)p_sys->p_fp->i_data_packets_count - p_sys->p_fp->i_preroll * 1000;
+        if( p_sys->i_length < 0 )
+            p_sys->i_length = 0;
 
         if( p_sys->i_length > 0 )
         {