mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-12-22 08:56:59 -05:00
alsa: fix impossible timeouts
Use the avail and read_size to calculate the next timeout, not delay and target, which could give a negative value and impossible timeout.
This commit is contained in:
parent
61ce16b19f
commit
90e2f4a139
1 changed files with 1 additions and 1 deletions
|
|
@ -2509,7 +2509,7 @@ static int handle_capture(struct state *state, uint64_t current_time, snd_pcm_uf
|
||||||
if (SPA_UNLIKELY(avail < state->read_size)) {
|
if (SPA_UNLIKELY(avail < state->read_size)) {
|
||||||
spa_log_trace(state->log, "%p: early wakeup %ld %ld %ld %d", state,
|
spa_log_trace(state->log, "%p: early wakeup %ld %ld %ld %d", state,
|
||||||
delay, avail, target, state->read_size);
|
delay, avail, target, state->read_size);
|
||||||
state->next_time = current_time + (target - delay) * SPA_NSEC_PER_SEC /
|
state->next_time = current_time + (state->read_size - avail) * SPA_NSEC_PER_SEC /
|
||||||
state->rate;
|
state->rate;
|
||||||
return -EAGAIN;
|
return -EAGAIN;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue