[vlc-devel] [PATCH 02/13] clock: add SetFirstPcr

Thomas Guillem thomas at gllm.fr
Wed Aug 21 16:13:53 CEST 2019


Will be used by the future "clock: forward clock update ts" commit.
---
 src/clock/clock.c | 10 ++++++++++
 src/clock/clock.h |  9 +++++++++
 2 files changed, 19 insertions(+)

diff --git a/src/clock/clock.c b/src/clock/clock.c
index 9cc0c66bb6..de2f2a61b9 100644
--- a/src/clock/clock.c
+++ b/src/clock/clock.c
@@ -53,6 +53,8 @@ struct vlc_clock_main_t
     clock_point_t ref;
     vlc_tick_t output_dejitter; /* Delay used to absorb the output clock jitter */
     vlc_tick_t input_dejitter; /* Delay used to absorb the input jitter */
+    vlc_tick_t first_pcr;
+
     bool abort;
 };
 
@@ -348,6 +350,7 @@ vlc_clock_main_t *vlc_clock_main_New(void)
     main_clock->pause_date = VLC_TICK_INVALID;
     main_clock->input_dejitter = DEFAULT_PTS_DELAY;
     main_clock->output_dejitter = AOUT_MAX_PTS_ADVANCE * 2;
+    main_clock->first_pcr = 0;
     main_clock->abort = false;
 
     AvgInit(&main_clock->coeff_avg, 10);
@@ -394,6 +397,13 @@ void vlc_clock_main_SetInputDejitter(vlc_clock_main_t *main_clock,
     vlc_mutex_unlock(&main_clock->lock);
 }
 
+void vlc_clock_main_SetFirstPcr(vlc_clock_main_t *main_clock, vlc_tick_t pcr)
+{
+    vlc_mutex_lock(&main_clock->lock);
+    main_clock->first_pcr = pcr;
+    vlc_mutex_unlock(&main_clock->lock);
+}
+
 void vlc_clock_main_ChangePause(vlc_clock_main_t *main_clock, vlc_tick_t now,
                                 bool paused)
 {
diff --git a/src/clock/clock.h b/src/clock/clock.h
index dbfa9dd3d3..b4394dec8e 100644
--- a/src/clock/clock.h
+++ b/src/clock/clock.h
@@ -62,6 +62,15 @@ void vlc_clock_main_SetReferencePoint(vlc_clock_main_t *main_clock,
 void vlc_clock_main_SetInputDejitter(vlc_clock_main_t *main_clock,
                                      vlc_tick_t delay);
 
+/**
+ * Set the first PCR
+ *
+ * 0 by default, the value stay valid after a reset call, only used as an
+ * informative value. Ts values updated via vlc_clock_Update() will be
+ * substracted from this value before being sent via update callbacks.
+ */
+void vlc_clock_main_SetFirstPcr(vlc_clock_main_t *main_clock, vlc_tick_t pcr);
+
 /**
  * This function allows changing the pause status.
  */
-- 
2.20.1



More information about the vlc-devel mailing list