mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
alsa: limit the buffer-size to quantum-limit * 4
We don't actually need to allocate the largest possible buffer. A buffer that is near 4 times the quantum-limit is more than enough. See #1995
This commit is contained in:
parent
0c97008291
commit
1547e5fd2b
1 changed files with 4 additions and 0 deletions
|
|
@ -1476,6 +1476,10 @@ int spa_alsa_set_format(struct state *state, struct spa_audio_info *fmt, uint32_
|
|||
state->buffer_frames = period_size * periods;
|
||||
} else {
|
||||
CHECK(snd_pcm_hw_params_get_buffer_size_max(params, &state->buffer_frames), "get_buffer_size_max");
|
||||
|
||||
state->buffer_frames = SPA_MIN(state->buffer_frames, state->quantum_limit * 4);
|
||||
|
||||
CHECK(snd_pcm_hw_params_set_buffer_size_min(hndl, params, &state->buffer_frames), "set_buffer_size_min");
|
||||
CHECK(snd_pcm_hw_params_set_buffer_size_near(hndl, params, &state->buffer_frames), "set_buffer_size_near");
|
||||
periods = state->buffer_frames / period_size;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue