From c153f39720e00875d13c2bd606bf6ce28d834365 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Tue, 5 Dec 2023 15:11:01 +0100 Subject: [PATCH] alsa: reset dll when we reprogram the timers --- spa/plugins/alsa/alsa-seq.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/spa/plugins/alsa/alsa-seq.c b/spa/plugins/alsa/alsa-seq.c index 83265ae30..62dd6be0d 100644 --- a/spa/plugins/alsa/alsa-seq.c +++ b/spa/plugins/alsa/alsa-seq.c @@ -850,8 +850,11 @@ static int set_timers(struct seq_state *state) int res; if ((res = spa_system_clock_gettime(state->data_system, CLOCK_MONOTONIC, &now)) < 0) - return res; + return res; + state->queue_time = 0; + state->queue_corr = 1.0; + spa_dll_init(&state->dll); state->next_time = SPA_TIMESPEC_TO_NSEC(&now); if (state->following) { set_timeout(state, 0); @@ -898,11 +901,9 @@ int spa_alsa_seq_start(struct seq_state *state) state->source.rmask = 0; spa_loop_add_source(state->data_loop, &state->source); - state->queue_time = 0; - spa_dll_init(&state->dll); - set_timers(state); + res = set_timers(state); - return 0; + return res; } static int do_reassign_follower(struct spa_loop *loop, @@ -913,7 +914,10 @@ static int do_reassign_follower(struct spa_loop *loop, void *user_data) { struct seq_state *state = user_data; - set_timers(state); + int res; + + if ((res = set_timers(state)) < 0) + spa_log_error(state->log, "can't set timers: %s", spa_strerror(res)); return 0; }