High latency due to "BATCH flag" being set
Summary
I've been using a USB-C to 3.5mm adapter with PulseAudio for a long time (which worked perfectly) but after it stopped working I started using the sound card on my motherboard. When using the sound card timer-based audio scheduling is disabled which means PulseAudio uses the latency configured in /etc/pulse/daemon.conf. In my case, using Arch Linux defaults of 4 fragments and 25 ms each, this means sound ALWAYS had a latency of at least 100 ms which is really bad compared to other operating systems like Windows.
The issue seems to be in this file: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/blob/master/src/modules/alsa/alsa-util.c#L280
I've been using a custom build of PulseAudio with that piece of code removed for a few months now and I haven't encountered any issues at all. Checking with pacmd list-sinks | grep latency
gives me latencies of around 8 ms and timer-based audio scheduling being enabled so clearly the card can support it and can go much lower than what's set as default.
Environment
pa-info.txt (running with my custom build)
Steps to reproduce
- Buy a Realtek ALC887
- Run
pacmd list-sinks | grep latency
, current latency stays at exactly100,00 ms
What is the current bug behavior?
Latency stays at 100 ms (4 fragments, 25 ms) by default when the sound card can go much lower.
What is the expected correct behavior?
Timer-based audio scheduling being used.