[vlc-devel] [PATCH 2/2] clock: assert that there is only one master
Thomas Guillem
thomas at gllm.fr
Fri Sep 18 15:02:12 CEST 2020
If a second master was created, the first one was automatically
downgraded without notifying the owner.
This was never the case since es_out.c, the only clock client (for now)
is always ensuring that only one master is created.
---
src/clock/clock.c | 7 ++-----
src/clock/clock.h | 2 ++
2 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/src/clock/clock.c b/src/clock/clock.c
index 3001d76514c..cfbb5eb6f6d 100644
--- a/src/clock/clock.c
+++ b/src/clock/clock.c
@@ -565,11 +565,8 @@ vlc_clock_t *vlc_clock_main_CreateMaster(vlc_clock_main_t *main_clock,
return NULL;
vlc_mutex_lock(&main_clock->lock);
- if (main_clock->master != NULL)
- {
- vlc_clock_master_reset(main_clock->master);
- vlc_clock_set_slave_callbacks(main_clock->master);
- }
+ assert(main_clock->master == NULL);
+
vlc_clock_set_master_callbacks(clock);
main_clock->master = clock;
main_clock->rc++;
diff --git a/src/clock/clock.h b/src/clock/clock.h
index ec4c1ac9859..e7373391697 100644
--- a/src/clock/clock.h
+++ b/src/clock/clock.h
@@ -96,6 +96,8 @@ void vlc_clock_main_ChangePause(vlc_clock_main_t *clock, vlc_tick_t system_now,
/**
* This function creates a new master vlc_clock_t interface
*
+ * @warning There can be only one master at a given time.
+ *
* You must use vlc_clock_Delete to free it.
*/
vlc_clock_t *vlc_clock_main_CreateMaster(vlc_clock_main_t *main_clock,
--
2.28.0
More information about the vlc-devel
mailing list