From c2c7dd040ab1ec8ada21ce8488382ff4176766d0 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Thu, 2 Sep 2021 17:31:02 +0200 Subject: [PATCH] alsa: CLAMP the error just in case something goes wrong. The calculation of the elapsed time is actually not a good idea because it becomes larger and larger and a tiny change in the rate could result in a large difference that would make things fail quickly. Until that is fixed, this patch will need to do.. --- spa/plugins/alsa/alsa-seq.c | 1 + 1 file changed, 1 insertion(+) diff --git a/spa/plugins/alsa/alsa-seq.c b/spa/plugins/alsa/alsa-seq.c index ac8a07ad9..aed9079c5 100644 --- a/spa/plugins/alsa/alsa-seq.c +++ b/spa/plugins/alsa/alsa-seq.c @@ -732,6 +732,7 @@ static int update_time(struct seq_state *state, uint64_t nsec, bool follower) queue_elapsed = NSEC_TO_CLOCK(state->clock, state->queue_time) / corr; err = ((int64_t)clock_elapsed - (int64_t) queue_elapsed); + err = SPA_CLAMP(err, -64, 64); if (state->dll.bw == 0.0) { spa_dll_set_bw(&state->dll, SPA_DLL_BW_MAX, state->threshold,