From 4246961070183543f9931865acc414c410557ca5 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Wed, 16 Feb 2022 21:10:03 +0100 Subject: [PATCH] alsa: use rewind to remove excess delay When the delay is too big, rewind a little to reduce it when resync. --- spa/plugins/alsa/alsa-pcm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spa/plugins/alsa/alsa-pcm.c b/spa/plugins/alsa/alsa-pcm.c index c3c42c5c8..0d1e2844a 100644 --- a/spa/plugins/alsa/alsa-pcm.c +++ b/spa/plugins/alsa/alsa-pcm.c @@ -1889,7 +1889,7 @@ int spa_alsa_write(struct state *state) spa_log_warn(state->log, "%s: follower delay:%ld target:%ld thr:%u, resync", state->props.device, delay, target, state->threshold); if (delay > target) - max_write = delay - target; + snd_pcm_rewind(state->hndl, delay - target); else if (delay < target) spa_alsa_silence(state, target - delay); delay = target;