mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
alsa: fix timeout adjustment
Only adjust the timeout when the quantum increases so that we end u with exactly the number of samples of the new quantum. Suppose we are handling a quantum of 1024, we wake up with 1024 samples in the device, we now notice a quantum of 8192 and will pull in the 8192 samples, we then have 1024 + 8192 samples in the buffer. Schedule a timeout for 1024 samples so that we end up in the timout with 8192 samples in the device.
This commit is contained in:
parent
052bc85dad
commit
3bcc59120a
1 changed files with 2 additions and 1 deletions
|
|
@ -874,7 +874,8 @@ static int update_time(struct state *state, uint64_t nsec, snd_pcm_sframes_t del
|
|||
int32_t diff = (int32_t) (state->last_threshold - state->threshold);
|
||||
spa_log_trace(state->log, NAME" %p: follower:%d quantum change %d -> %d (%d)",
|
||||
state, follower, state->last_threshold, state->threshold, diff);
|
||||
state->next_time += diff / corr * 1e9 / state->rate;
|
||||
if (diff < 0)
|
||||
state->next_time += diff / corr * 1e9 / state->rate;
|
||||
state->last_threshold = state->threshold;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue