diff --git a/spa/plugins/alsa/alsa-pcm.c b/spa/plugins/alsa/alsa-pcm.c index 9449225b5..e7b859f5c 100644 --- a/spa/plugins/alsa/alsa-pcm.c +++ b/spa/plugins/alsa/alsa-pcm.c @@ -2115,7 +2115,7 @@ int spa_alsa_read(struct state *state) if (state->following && state->alsa_started) { uint64_t current_time; - snd_pcm_uframes_t delay, target; + snd_pcm_uframes_t avail, delay, target; uint32_t threshold = state->threshold; current_time = state->position->clock.nsec; @@ -2123,6 +2123,8 @@ int spa_alsa_read(struct state *state) if ((res = get_status(state, current_time, &delay, &target)) < 0) return res; + avail = delay; + if (state->alsa_sync) { spa_log_warn(state->log, "%s: follower delay:%lu target:%lu thr:%u, resync", state->props.device, delay, target, threshold); @@ -2137,7 +2139,7 @@ int spa_alsa_read(struct state *state) if ((res = update_time(state, current_time, delay, target, true)) < 0) return res; - if (delay < state->read_size) + if (avail < state->read_size) max_read = 0; }