alsa: report extra latency for FireWire drivers

Based on testing, ALSA FireWire drivers introduce additional latency
determined by the buffer size.

Report that latency.

Pass device.bus to the node, so it can recognize firewire.
This commit is contained in:
Pauli Virtanen 2025-09-06 19:14:22 +03:00 committed by Wim Taymans
parent 916896c1cc
commit bf783ab08f
3 changed files with 14 additions and 2 deletions

View file

@ -1012,6 +1012,8 @@ int spa_alsa_init(struct state *state, const struct spa_dict *info)
state->num_bind_ctls = i;
/* We'll do the actual binding after checking the card exists */
} else if (spa_streq(k, SPA_KEY_DEVICE_BUS)) {
state->is_firewire = spa_streq(s, "firewire");
} else {
alsa_set_param(state, k, s);
}
@ -2054,6 +2056,13 @@ static void recalc_headroom(struct state *state)
if (rate != 0 && state->rate != 0)
latency = SPA_SCALE32_UP(latency, rate, state->rate);
if (state->is_firewire) {
/* XXX: For ALSA FireWire drivers, unlike for other ALSA drivers, buffer size
* XXX: contributes extra latency (as of kernel 6.16).
*/
latency += state->buffer_frames;
}
state->latency[state->port_direction].min_rate =
state->latency[state->port_direction].max_rate = latency;
}