alsa: increase buffers when using small buffer

We can increase the MAX_LATENCY again if we increase the amount of
buffers when we are using a small buffer.

Normally we ask for 4 * quantum-limit as the buffer. This should be good
to use 1 buffer and quantum-limit as the quantum with enough headroom
to not run out of buffers.

If we are however using less buffer-frames we need to be careful and
allocate an extra buffer. Imagine using a buffer of 4096 frames, we can
support a quantum of up to 2048 frames if we use 2 buffers.

See #3744
This commit is contained in:
Wim Taymans 2024-01-22 12:10:51 +01:00
parent c5b845bc90
commit 846f994ac8
2 changed files with 8 additions and 2 deletions

View file

@ -3536,7 +3536,7 @@ void spa_alsa_emit_node_info(struct state *state, bool full)
if (state->have_format)
snprintf(latency, sizeof(latency), "%lu/%d",
state->buffer_frames / (4 * state->frame_scale), state->rate);
state->buffer_frames / (2 * state->frame_scale), state->rate);
items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_NODE_MAX_LATENCY, latency[0] ? latency : NULL);
if (state->have_format)