mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-06-06 03:02:54 -04:00
alsa: avoid rounding down period_size
Only try to round down the period_size to the lowest power of 2 when we are resampling and scaling the period_size to match. In all other cases, we should honour the requested quantum duration. Fixes #5302
This commit is contained in:
parent
cecdbc034f
commit
d05905f871
1 changed files with 9 additions and 3 deletions
|
|
@ -2441,9 +2441,15 @@ int spa_alsa_set_format(struct state *state, struct spa_audio_info *fmt, uint32_
|
||||||
/* no period size specified. If we are batch or forcing our quantum,
|
/* no period size specified. If we are batch or forcing our quantum,
|
||||||
* use the graph requested quantum scaled by our rate */
|
* use the graph requested quantum scaled by our rate */
|
||||||
if (period_size == 0 && (state->is_batch || state->force_quantum) && state->position) {
|
if (period_size == 0 && (state->is_batch || state->force_quantum) && state->position) {
|
||||||
period_size = SPA_SCALE32_UP(state->position->clock.target_duration,
|
period_size = state->position->clock.target_duration;
|
||||||
state->rate, state->position->clock.target_rate.denom);
|
/* only if we are rate adjusting, scale the period size and round down
|
||||||
period_size = flp2(period_size);
|
* to a power of two. */
|
||||||
|
if (state->position->clock.target_rate.denom != 0 &&
|
||||||
|
state->rate != (int)state->position->clock.target_rate.denom) {
|
||||||
|
period_size = SPA_SCALE32_UP(period_size,
|
||||||
|
state->rate, state->position->clock.target_rate.denom);
|
||||||
|
period_size = flp2(period_size);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (period_size == 0)
|
if (period_size == 0)
|
||||||
period_size = default_period;
|
period_size = default_period;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue