]> git.sesse.net Git - vlc/commitdiff
Fixed decoder_GetDisplayDate while buffering.
authorLaurent Aimar <fenrir@videolan.org>
Wed, 8 Oct 2008 20:58:23 +0000 (22:58 +0200)
committerLaurent Aimar <fenrir@videolan.org>
Wed, 8 Oct 2008 22:11:17 +0000 (00:11 +0200)
modules/codec/avcodec/video.c
modules/codec/quicktime.c
src/input/decoder.c

index 7a534e2a05c2ae14ca9f316342c3f1c417b97355..c27856cd5303c0933d3509a0f8c7a3630384d38e 100644 (file)
@@ -590,8 +590,11 @@ picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block )
             p_sys->i_pts = p_sys->p_ff_pic->pts;
 
         /* Update frame late count (except when doing preroll) */
-        if( p_sys->i_pts && decoder_GetDisplayDate(p_dec, p_sys->i_pts) <= mdate() &&
-            !(p_block->i_flags & BLOCK_FLAG_PREROLL) )
+        mtime_t i_display_date = 0;
+        if( !(p_block->i_flags & BLOCK_FLAG_PREROLL) )
+            i_display_date = decoder_GetDisplayDate( p_dec, p_sys->i_pts );
+        i_display_date = 0;
+        if( i_display_date > 0 && i_display_date <= mdate() )
         {
             p_sys->i_late_frames++;
             if( p_sys->i_late_frames == 1 )
index b0f7321cf657c7901333e2cfe1871b84f207a45f..bcf4dd22d2c5ce79ff330e8ffcb058a31567335f 100644 (file)
@@ -573,7 +573,12 @@ static aout_buffer_t *DecodeAudio( decoder_t *p_dec, block_t **pp_block )
     if( p_sys->i_out_frames <= 0 )
     {
         p_sys->pts = p_block->i_pts;
-        if( decoder_GetDisplayDate( p_dec, p_block->i_pts ) < mdate() )
+
+        mtime_t i_display_date = 0;
+        if( !(p_block->i_flags & BLOCK_FLAG_PREROLL) )
+            i_display_date = decoder_GetDisplayDate( p_dec, p_block->i_pts );
+
+        if( i_display_date > 0 && i_display_date < mdate() )
         {
             block_Release( p_block );
             *pp_block = NULL;
@@ -894,7 +899,11 @@ static picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block )
  
     i_pts = p_block->i_pts ? p_block->i_pts : p_block->i_dts;
 
-    if( decoder_GetDisplayDate( p_dec, i_pts ) < mdate() )
+    mtime_t i_display_date = 0;
+    if( !(p_block->i_flags & BLOCK_FLAG_PREROLL) )
+        i_display_date = decoder_GetDisplayDate( p_dec, i_pts );
+
+    if( i_display_date > 0 && i_display_date < mdate() )
     {
         p_sys->i_late++;
     }
index a941a328f5cfc13171d0e3360adcaeec00b45af4..c52750423264092006d68517797569a3d82181ae 100644 (file)
@@ -185,8 +185,14 @@ mtime_t decoder_GetDisplayDate( decoder_t *p_dec, mtime_t i_ts )
 {
     decoder_owner_sys_t *p_owner = p_dec->p_owner;
 
-    if( !p_owner->p_clock )
+    vlc_mutex_lock( &p_owner->lock );
+    if( p_owner->b_buffering )
+        i_ts = 0;
+    vlc_mutex_unlock( &p_owner->lock );
+
+    if( !p_owner->p_clock || !i_ts )
         return i_ts;
+
     return input_clock_GetTS( p_owner->p_clock, NULL, p_owner->p_input->i_pts_delay, i_ts );
 }
 /* decoder_GetDisplayRate: