mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
alsa: update resampler requested size before reading
spa_alsa_read is called from the source process function when we are a follower and no buffer is ready yet. Part of the rate correction was performed by the ALSA driver when it woke up but now, the resampler has updated the requested size and we need to requery it before we can start reading samples. Otherwise, we end up with requested samples from before the rate update and we might not give enough samples to the resampler. In that case, the adapter will call us again and we will again try to produce a buffer worth of the requested samples, which will xrun.
This commit is contained in:
parent
fc3a199ca2
commit
685aed1de2
1 changed files with 4 additions and 0 deletions
|
|
@ -3386,6 +3386,10 @@ int spa_alsa_read(struct state *state)
|
||||||
uint64_t current_time = state->position->clock.nsec;
|
uint64_t current_time = state->position->clock.nsec;
|
||||||
alsa_read_sync(state, current_time);
|
alsa_read_sync(state, current_time);
|
||||||
}
|
}
|
||||||
|
else if (state->resample && state->rate_match) {
|
||||||
|
state->read_size = state->rate_match->size;
|
||||||
|
state->max_read = SPA_MIN(state->buffer_frames, state->read_size);
|
||||||
|
}
|
||||||
return alsa_read_frames(state);
|
return alsa_read_frames(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue