mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
alsa: add api.alsa.headroom setting
Can be used to tweak the extra distance kept between the hardware and software pointers when reading and writing. See #289
This commit is contained in:
parent
abe73c9146
commit
7347b5ef05
5 changed files with 13 additions and 1 deletions
|
|
@ -795,6 +795,8 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
}
|
||||
} else if (!strcmp(info->items[i].key, "api.alsa.period-size")) {
|
||||
this->default_period_size = atoi(info->items[i].value);
|
||||
} else if (!strcmp(info->items[i].key, "api.alsa.headroom")) {
|
||||
this->default_headroom = atoi(info->items[i].value);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -816,6 +816,8 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
}
|
||||
} else if (!strcmp(info->items[i].key, "api.alsa.period-size")) {
|
||||
this->default_period_size = atoi(info->items[i].value);
|
||||
} else if (!strcmp(info->items[i].key, "api.alsa.headroom")) {
|
||||
this->default_headroom = atoi(info->items[i].value);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -605,8 +605,12 @@ int spa_alsa_set_format(struct state *state, struct spa_audio_info *fmt, uint32_
|
|||
CHECK(snd_pcm_hw_params_get_buffer_size_max(params, &state->buffer_frames), "get_buffer_size_max");
|
||||
CHECK(snd_pcm_hw_params_set_buffer_size_near(hndl, params, &state->buffer_frames), "set_buffer_size_near");
|
||||
|
||||
if (state->default_headroom == 0)
|
||||
state->headroom = is_batch ? period_size : 0;
|
||||
else
|
||||
state->headroom = state->default_headroom;
|
||||
|
||||
state->period_frames = period_size;
|
||||
state->headroom = is_batch ? period_size : 0;
|
||||
periods = state->buffer_frames / state->period_frames;
|
||||
|
||||
spa_log_info(state->log, NAME" %s (%s): format:%s access:%s-%s rate:%d channels:%d "
|
||||
|
|
|
|||
|
|
@ -111,6 +111,7 @@ struct state {
|
|||
struct spa_audio_info current_format;
|
||||
|
||||
uint32_t default_period_size;
|
||||
uint32_t default_headroom;
|
||||
uint32_t default_format;
|
||||
unsigned int default_channels;
|
||||
unsigned int default_rate;
|
||||
|
|
|
|||
|
|
@ -50,9 +50,12 @@ rules = [
|
|||
#resample.quality = 4
|
||||
#channelmix.normalize = false
|
||||
#channelmix.mix-lfe = false
|
||||
#audio.channels = 2
|
||||
#audio.format = "S16LE"
|
||||
#audio.rate = 44100
|
||||
#audio.position = "FL,FR"
|
||||
#api.alsa.period-size = 1024
|
||||
#api.alsa.headroom = 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue