[vlc-commits] codec: get_display_date: add system_now

Thomas Guillem git at videolan.org
Mon Mar 11 10:19:14 CET 2019


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Wed Mar  6 17:52:15 2019 +0100| [335148796a60e4526bdfcedb37e59fecb5af3e1d] | committer: Thomas Guillem

codec: get_display_date: add system_now

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

 include/vlc_codec.h           |  8 +++++---
 modules/codec/avcodec/video.c |  2 +-
 modules/codec/synchro.c       | 14 +++++++-------
 3 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/include/vlc_codec.h b/include/vlc_codec.h
index f001b03768..118adc0330 100644
--- a/include/vlc_codec.h
+++ b/include/vlc_codec.h
@@ -61,7 +61,7 @@ struct decoder_owner_callbacks
 
             /* Display date
              * cf. decoder_GetDisplayDate */
-            vlc_tick_t  (*get_display_date)( decoder_t *, vlc_tick_t );
+            vlc_tick_t  (*get_display_date)( decoder_t *, vlc_tick_t, vlc_tick_t );
             /* Display rate
              * cf. decoder_GetDisplayRate */
             float       (*get_display_rate)( decoder_t * );
@@ -447,14 +447,16 @@ static inline int decoder_GetInputAttachments( decoder_t *dec,
  * You MUST use it *only* for gathering statistics about speed.
  */
 VLC_USED
-static inline vlc_tick_t decoder_GetDisplayDate( decoder_t *dec, vlc_tick_t i_ts )
+static inline vlc_tick_t decoder_GetDisplayDate( decoder_t *dec,
+                                                 vlc_tick_t system_now,
+                                                 vlc_tick_t i_ts )
 {
     vlc_assert( dec->fmt_in.i_cat == VIDEO_ES && dec->cbs != NULL );
 
     if( !dec->cbs->video.get_display_date )
         return VLC_TICK_INVALID;
 
-    return dec->cbs->video.get_display_date( dec, i_ts );
+    return dec->cbs->video.get_display_date( dec, system_now, i_ts );
 }
 
 /**
diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c
index 26ecffcade..e7c34938b1 100644
--- a/modules/codec/avcodec/video.c
+++ b/modules/codec/avcodec/video.c
@@ -805,7 +805,7 @@ static void update_late_frame_count( decoder_t *p_dec, block_t *p_block,
    /* Update frame late count (except when doing preroll) */
    vlc_tick_t i_display_date = VLC_TICK_INVALID;
    if( !p_block || !(p_block->i_flags & BLOCK_FLAG_PREROLL) )
-       i_display_date = decoder_GetDisplayDate( p_dec, i_pts );
+       i_display_date = decoder_GetDisplayDate( p_dec, current_time, i_pts );
 
    vlc_tick_t i_threshold = i_next_pts != VLC_TICK_INVALID
                           ? (i_next_pts - i_pts) / 2 : VLC_TICK_FROM_MS(20);
diff --git a/modules/codec/synchro.c b/modules/codec/synchro.c
index e7f62b119d..d06c0204d7 100644
--- a/modules/codec/synchro.c
+++ b/modules/codec/synchro.c
@@ -233,11 +233,11 @@ bool decoder_SynchroChoose( decoder_synchro_t * p_synchro, int i_coding_type,
     case I_CODING_TYPE:
         if( b_low_delay )
         {
-            pts = decoder_GetDisplayDate( p_synchro->p_dec, S.current_pts );
+            pts = decoder_GetDisplayDate( p_synchro->p_dec, now, S.current_pts );
         }
         else if( S.backward_pts != VLC_TICK_INVALID )
         {
-            pts = decoder_GetDisplayDate( p_synchro->p_dec, S.backward_pts );
+            pts = decoder_GetDisplayDate( p_synchro->p_dec, now, S.backward_pts );
         }
         else
         {
@@ -246,7 +246,7 @@ bool decoder_SynchroChoose( decoder_synchro_t * p_synchro, int i_coding_type,
              *                      |       +- current picture
              *                      +- current PTS
              */
-            pts = decoder_GetDisplayDate( p_synchro->p_dec, S.current_pts ) + period * (S.i_n_b + 2);
+            pts = decoder_GetDisplayDate( p_synchro->p_dec, now, S.current_pts ) + period * (S.i_n_b + 2);
         }
 
         if( (1 + S.i_n_p * (S.i_n_b + 1)) * period > S.p_tau[I_CODING_TYPE] )
@@ -270,15 +270,15 @@ bool decoder_SynchroChoose( decoder_synchro_t * p_synchro, int i_coding_type,
     case P_CODING_TYPE:
         if( b_low_delay )
         {
-            pts = decoder_GetDisplayDate( p_synchro->p_dec, S.current_pts );
+            pts = decoder_GetDisplayDate( p_synchro->p_dec, now, S.current_pts );
         }
         else if( S.backward_pts != VLC_TICK_INVALID )
         {
-            pts = decoder_GetDisplayDate( p_synchro->p_dec, S.backward_pts );
+            pts = decoder_GetDisplayDate( p_synchro->p_dec, now, S.backward_pts );
         }
         else
         {
-            pts = decoder_GetDisplayDate( p_synchro->p_dec, S.current_pts + period * (S.i_n_b + 1) );
+            pts = decoder_GetDisplayDate( p_synchro->p_dec, now, S.current_pts + period * (S.i_n_b + 1) );
         }
 
         if( p_synchro->i_nb_ref < 1 )
@@ -313,7 +313,7 @@ bool decoder_SynchroChoose( decoder_synchro_t * p_synchro, int i_coding_type,
         break;
 
     case B_CODING_TYPE:
-        pts = decoder_GetDisplayDate( p_synchro->p_dec, S.current_pts );
+        pts = decoder_GetDisplayDate( p_synchro->p_dec, now, S.current_pts );
 
         if( p_synchro->i_nb_ref < 2 )
         {



More information about the vlc-commits mailing list