alsa: reset alsa_sync when linked

When a linked node needs to be resynced we actually never clear the
flag or reset the dll. Move the code around so that it still does
the reset of the flag and dll without actually doing the resync in
the ringbuffer when it is a linked node.
This commit is contained in:
Wim Taymans 2025-06-11 13:06:54 +02:00
parent 524da5962d
commit 3fdcf0d34c

View file

@ -3002,10 +3002,11 @@ static int alsa_write_sync(struct state *state, uint64_t current_time)
if (SPA_UNLIKELY((res = update_time(state, current_time, delay, target, following)) < 0))
return res;
if (following && state->alsa_started && !state->linked) {
if (following && state->alsa_started) {
if (SPA_UNLIKELY(state->alsa_sync)) {
enum spa_log_level lev;
if (!state->linked) {
if (SPA_UNLIKELY(state->alsa_sync_warning))
lev = SPA_LOG_LEVEL_WARN;
else
@ -3024,6 +3025,7 @@ static int alsa_write_sync(struct state *state, uint64_t current_time)
else if (avail < target)
spa_alsa_silence(state, target - avail);
avail = target;
}
spa_dll_init(&state->dll);
state->alsa_sync = false;
} else
@ -3268,10 +3270,10 @@ static int alsa_read_sync(struct state *state, uint64_t current_time)
return res;
max_read = state->buffer_frames;
if (following && !state->linked) {
if (following) {
if (state->alsa_sync) {
if (!state->linked) {
enum spa_log_level lev;
if (SPA_UNLIKELY(state->alsa_sync_warning))
lev = SPA_LOG_LEVEL_WARN;
else
@ -3290,6 +3292,7 @@ static int alsa_read_sync(struct state *state, uint64_t current_time)
snd_pcm_forward(state->hndl, avail - target);
avail = target;
}
}
state->alsa_sync = false;
spa_dll_init(&state->dll);
} else