[vlc-commits] clock: rework/document pause handling
Thomas Guillem
git at videolan.org
Mon Sep 23 13:36:03 CEST 2019
vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu Sep 5 11:38:23 2019 +0200| [5d3df74c8d55008f8caba68b257b3bbbb7a041d2] | committer: Thomas Guillem
clock: rework/document pause handling
Also return INT64_MAX from vlc_clock_Update() when paused.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5d3df74c8d55008f8caba68b257b3bbbb7a041d2
---
src/clock/clock.c | 4 ++--
src/clock/clock.h | 3 +++
src/video_output/video_output.c | 2 +-
3 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/clock/clock.c b/src/clock/clock.c
index 15a6cf68e4..c4e89db9db 100644
--- a/src/clock/clock.c
+++ b/src/clock/clock.c
@@ -127,7 +127,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);
- return 0;
+ return VLC_TICK_INVALID;
}
static void vlc_clock_master_reset(vlc_clock_t *clock)
@@ -266,7 +266,7 @@ static vlc_tick_t vlc_clock_slave_update(vlc_clock_t *clock,
vlc_tick_t computed = clock->to_system_locked(clock, system_now, ts, rate);
vlc_mutex_unlock(&main_clock->lock);
- return computed != INT64_MAX ? computed - system_now : VLC_TICK_INVALID;
+ return computed != INT64_MAX ? computed - system_now : INT64_MAX;
}
static void vlc_clock_slave_reset(vlc_clock_t *clock)
diff --git a/src/clock/clock.h b/src/clock/clock.h
index 8f281523d8..00dcfe235c 100644
--- a/src/clock/clock.h
+++ b/src/clock/clock.h
@@ -95,6 +95,8 @@ void vlc_clock_Delete(vlc_clock_t *clock);
/**
* This function will update the clock drift and returns the drift
+ * @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
*/
vlc_tick_t vlc_clock_Update(vlc_clock_t *clock, vlc_tick_t system_now,
vlc_tick_t ts, double rate);
@@ -120,6 +122,7 @@ int vlc_clock_Wait(vlc_clock_t *clock, vlc_tick_t system_now, vlc_tick_t ts,
/**
* This function converts a timestamp from stream to system
+ * @return the valid system time or INT64_MAX when the clock is paused
*/
vlc_tick_t vlc_clock_ConvertToSystem(vlc_clock_t *clock, vlc_tick_t system_now,
vlc_tick_t ts, double rate);
diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index 6dfddaad33..87e07dbadd 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -1176,7 +1176,7 @@ static int ThreadDisplayRenderPicture(vout_thread_t *vout, bool is_forced)
system_now = vlc_tick_now();
const vlc_tick_t drift = vlc_clock_Update(sys->clock, system_now,
pts, sys->rate);
- if (drift != VLC_TICK_INVALID)
+ if (drift != VLC_TICK_INVALID && drift != INT64_MAX)
system_now += drift;
}
sys->displayed.date = system_now;
More information about the vlc-commits
mailing list