[vlc-devel] commit: Fixed decoder_GetDisplayDate while buffering. (Laurent Aimar )

git version control git at videolan.org
Thu Oct 9 00:14:28 CEST 2008


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Wed Oct  8 22:58:23 2008 +0200| [350b1da975a31ab011d04250a3bfbadb2d6e192e] | committer: Laurent Aimar 

Fixed decoder_GetDisplayDate while buffering.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=350b1da975a31ab011d04250a3bfbadb2d6e192e
---

 modules/codec/avcodec/video.c |    7 +++++--
 modules/codec/quicktime.c     |   13 +++++++++++--
 src/input/decoder.c           |    8 +++++++-
 3 files changed, 23 insertions(+), 5 deletions(-)

diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c
index 7a534e2..c27856c 100644
--- a/modules/codec/avcodec/video.c
+++ b/modules/codec/avcodec/video.c
@@ -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 )
diff --git a/modules/codec/quicktime.c b/modules/codec/quicktime.c
index b0f7321..bcf4dd2 100644
--- a/modules/codec/quicktime.c
+++ b/modules/codec/quicktime.c
@@ -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++;
     }
diff --git a/src/input/decoder.c b/src/input/decoder.c
index a941a32..c527504 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -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:




More information about the vlc-devel mailing list