[vlc-commits] clock: handle forced points
Thomas Guillem
git at videolan.org
Mon Sep 23 13:36:13 CEST 2019
vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu Sep 5 17:13:44 2019 +0200| [dd18346e52d65fcedd9a699df798f37744119ff8] | committer: Thomas Guillem
clock: handle forced points
This won't have any effect on the clock but this will forward the forced update
point via the callback.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=dd18346e52d65fcedd9a699df798f37744119ff8
---
src/clock/clock.c | 10 +++++++++-
src/clock/clock.h | 2 ++
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/src/clock/clock.c b/src/clock/clock.c
index 83649edc07..ebbfd95bb5 100644
--- a/src/clock/clock.c
+++ b/src/clock/clock.c
@@ -123,6 +123,10 @@ static vlc_tick_t vlc_clock_master_update(vlc_clock_t *clock,
vlc_mutex_lock(&main_clock->lock);
+ /* If system_now is INT64_MAX, the update is forced, don't modify anything
+ * but only notify the new clock point. */
+ if (system_now != INT64_MAX)
+ {
if (main_clock->offset != VLC_TICK_INVALID && ts != main_clock->last.stream)
{
/* We have a reference so we can update coeff */
@@ -145,6 +149,7 @@ static vlc_tick_t vlc_clock_master_update(vlc_clock_t *clock,
main_clock->rate = rate;
vlc_cond_broadcast(&main_clock->cond);
+ }
vlc_mutex_unlock(&main_clock->lock);
@@ -291,7 +296,10 @@ static vlc_tick_t vlc_clock_slave_update(vlc_clock_t *clock,
vlc_clock_main_t *main_clock = clock->owner;
vlc_mutex_lock(&main_clock->lock);
- vlc_tick_t computed = clock->to_system_locked(clock, system_now, ts, rate);
+ /* If system_now is INT64_MAX, the update is forced, don't modify anything
+ * but only notify the new clock point. */
+ vlc_tick_t computed = system_now == INT64_MAX ? INT64_MAX
+ : clock->to_system_locked(clock, system_now, ts, rate);
vlc_mutex_unlock(&main_clock->lock);
diff --git a/src/clock/clock.h b/src/clock/clock.h
index 6b7db29694..8e9e6eb681 100644
--- a/src/clock/clock.h
+++ b/src/clock/clock.h
@@ -123,6 +123,8 @@ void vlc_clock_Delete(vlc_clock_t *clock);
/**
* This function will update the clock drift and returns the drift
+ * @param system_now valid system time or INT64_MAX is the updated point is
+ * forced (when paused for example)
* @return a valid drift relative time, VLC_TICK_INVALID if there is no drift
* (clock is master) or INT64_MAX if the clock is paused
*/
More information about the vlc-commits
mailing list