[vlc-devel] [PATCH 01/13] clock: rename SetFirstPcr to SetReferencePoint
Thomas Guillem
thomas at gllm.fr
Wed Aug 21 16:13:52 CEST 2019
And document it.
---
src/clock/clock.c | 24 ++++++++++++------------
src/clock/clock.h | 11 +++++++++--
src/input/es_out.c | 6 ++----
3 files changed, 23 insertions(+), 18 deletions(-)
diff --git a/src/clock/clock.c b/src/clock/clock.c
index 15a6cf68e4..9cc0c66bb6 100644
--- a/src/clock/clock.c
+++ b/src/clock/clock.c
@@ -50,7 +50,7 @@ struct vlc_clock_main_t
vlc_tick_t pause_date;
clock_point_t wait_sync_ref; /* When the master */
- clock_point_t first_pcr;
+ 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 */
bool abort;
@@ -207,9 +207,9 @@ vlc_clock_monotonic_to_system_locked(vlc_clock_t *clock, vlc_tick_t now,
* is used to introduce the same delay than the input clock (first PTS
* - first PCR). */
const vlc_tick_t pcr_delay =
- main_clock->first_pcr.system == VLC_TICK_INVALID ? 0 :
- (ts - main_clock->first_pcr.stream) / rate +
- main_clock->first_pcr.system - now;
+ main_clock->ref.system == VLC_TICK_INVALID ? 0 :
+ (ts - main_clock->ref.stream) / rate +
+ main_clock->ref.system - now;
const vlc_tick_t input_delay = main_clock->input_dejitter + pcr_delay;
@@ -340,7 +340,7 @@ vlc_clock_main_t *vlc_clock_main_New(void)
main_clock->offset = VLC_TICK_INVALID;
main_clock->delay = 0;
- main_clock->first_pcr =
+ main_clock->ref =
clock_point_Create(VLC_TICK_INVALID, VLC_TICK_INVALID);
main_clock->wait_sync_ref = main_clock->last =
clock_point_Create(VLC_TICK_INVALID, VLC_TICK_INVALID);
@@ -368,18 +368,18 @@ void vlc_clock_main_Reset(vlc_clock_main_t *main_clock)
{
vlc_mutex_lock(&main_clock->lock);
vlc_clock_main_reset(main_clock);
- main_clock->first_pcr =
+ main_clock->ref =
clock_point_Create(VLC_TICK_INVALID, VLC_TICK_INVALID);
vlc_mutex_unlock(&main_clock->lock);
}
-void vlc_clock_main_SetFirstPcr(vlc_clock_main_t *main_clock,
- vlc_tick_t system_now, vlc_tick_t ts)
+void vlc_clock_main_SetReferencePoint(vlc_clock_main_t *main_clock,
+ vlc_tick_t system_now, vlc_tick_t ts)
{
vlc_mutex_lock(&main_clock->lock);
- if (main_clock->first_pcr.system == VLC_TICK_INVALID)
+ if (main_clock->ref.system == VLC_TICK_INVALID)
{
- main_clock->first_pcr = clock_point_Create(system_now, ts);
+ main_clock->ref = clock_point_Create(system_now, ts);
main_clock->wait_sync_ref =
clock_point_Create(VLC_TICK_INVALID, VLC_TICK_INVALID);
}
@@ -414,8 +414,8 @@ void vlc_clock_main_ChangePause(vlc_clock_main_t *main_clock, vlc_tick_t now,
main_clock->last.system += delay;
main_clock->offset += delay;
}
- if (main_clock->first_pcr.system != VLC_TICK_INVALID)
- main_clock->first_pcr.system += delay;
+ if (main_clock->ref.system != VLC_TICK_INVALID)
+ main_clock->ref.system += delay;
if (main_clock->wait_sync_ref.system != VLC_TICK_INVALID)
main_clock->wait_sync_ref.system += delay;
main_clock->pause_date = VLC_TICK_INVALID;
diff --git a/src/clock/clock.h b/src/clock/clock.h
index 8f281523d8..dbfa9dd3d3 100644
--- a/src/clock/clock.h
+++ b/src/clock/clock.h
@@ -50,8 +50,15 @@ void vlc_clock_main_Abort(vlc_clock_main_t *main_clock);
*/
void vlc_clock_main_Reset(vlc_clock_main_t *main_clock);
-void vlc_clock_main_SetFirstPcr(vlc_clock_main_t *main_clock,
- vlc_tick_t system_now, vlc_tick_t ts);
+/**
+ * Set the clock reference point.
+ *
+ * 0:0 by default and reset after each vlc_clock_main_Reset() call. It need to
+ * be called after a seek/flush/buffering in order to tell when the flushed
+ * stream starts.
+ */
+void vlc_clock_main_SetReferencePoint(vlc_clock_main_t *main_clock,
+ vlc_tick_t system_now, vlc_tick_t ts);
void vlc_clock_main_SetInputDejitter(vlc_clock_main_t *main_clock,
vlc_tick_t delay);
diff --git a/src/input/es_out.c b/src/input/es_out.c
index be19053e78..0ea21d9fa6 100644
--- a/src/input/es_out.c
+++ b/src/input/es_out.c
@@ -1006,10 +1006,8 @@ static void EsOutDecodersStopBuffering( es_out_t *out, bool b_forced )
const vlc_tick_t update = i_current_date + i_wakeup_delay - i_buffering_duration;
- /* Send the first PCR to the output clock. This will be used as a reference
- * point for the sync point. */
- vlc_clock_main_SetFirstPcr(p_sys->p_pgrm->p_main_clock, update,
- i_stream_start);
+ vlc_clock_main_SetReferencePoint(p_sys->p_pgrm->p_main_clock, update,
+ i_stream_start);
input_clock_ChangeSystemOrigin( p_sys->p_pgrm->p_input_clock, true, update );
--
2.20.1
More information about the vlc-devel
mailing list