mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
alsa: use 2 (or 3 for batch) periods in IRQ mode
Some drivers (Firewire) have a latency depending on the ALSA buffer size instead of the period size. In IRQ mode, we can safely use 2 (or 3 for batch devices) periods because we always need to reconfigure the hardware when we want to change the period and so we don't need to keep some headroom like we do for timer based scheduling. See #4785
This commit is contained in:
parent
0d42f11b87
commit
0095d79ef8
1 changed files with 7 additions and 2 deletions
|
|
@ -2337,8 +2337,13 @@ int spa_alsa_set_format(struct state *state, struct spa_audio_info *fmt, uint32_
|
|||
|
||||
state->period_frames = period_size;
|
||||
|
||||
if (state->default_period_num != 0) {
|
||||
periods = state->default_period_num;
|
||||
if (state->default_period_num != 0 || state->disable_tsched) {
|
||||
if (state->default_period_num != 0)
|
||||
/* period number given use that */
|
||||
periods = state->default_period_num;
|
||||
else
|
||||
/* IRQ mode, use 2 periods or 3 for batch */
|
||||
periods = state->is_batch ? 3 : 2;
|
||||
CHECK(snd_pcm_hw_params_set_periods_near(hndl, params, &periods, &dir), "set_periods");
|
||||
state->buffer_frames = period_size * periods;
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue