pulse-server: improve latency setup a little

Reorganize the latency setup in one place, return a desired device
latency for use as quantum.

PulseAudio assigns half of the (tlength - minreq) latency to the sink
but we can't do that because our sinks have a max-quantum of latency.
Fix this by clamping our calculated sink latency to the quantum

PulseAudio subtracts the sink latency from the tlength in adjust latency
mode, so we need to do the same.

This makes PULSE_LATENCY_MSEC values bahave more like pulseaudio.

See #1769
This commit is contained in:
Wim Taymans 2021-11-04 18:07:30 +01:00
parent 86ca0f8466
commit b96f15d2fe
2 changed files with 54 additions and 38 deletions

View file

@ -51,6 +51,7 @@ struct defs {
struct spa_fraction min_quantum;
struct sample_spec sample_spec;
struct channel_map channel_map;
uint32_t max_quantum;
};
struct stats {