plugins: alsa: increase follower write synchronization when htimestamps are enabled

alsa_write_sync can insert or remove some data from alsa when
resynchronization is needed.
Avail and delay are equal when high precision timestamps are not allowed.
When the high precision timestamps are enabled, the delay is avail
adjusted to current_time.

Signed-off-by: Martin Geier <martin.geier@streamunlimited.com>
This commit is contained in:
Martin Geier 2025-06-13 12:33:35 +02:00 committed by Wim Taymans
parent 7e135a5235
commit d04ee91714

View file

@ -3020,10 +3020,10 @@ static int alsa_write_sync(struct state *state, uint64_t current_time)
state->name, avail, delay,
target, state->threshold, suppressed);
if (avail > target)
snd_pcm_rewind(state->hndl, avail - target);
else if (avail < target)
spa_alsa_silence(state, target - avail);
if (delay > target)
snd_pcm_rewind(state->hndl, delay - target);
else if (delay < target)
spa_alsa_silence(state, target - delay);
avail = target;
}
spa_dll_init(&state->dll);