]> git.ipfire.org Git - thirdparty/qemu.git/commit
alsaaudio: Set try-poll to false by default
authorBALATON Zoltan <balaton@eik.bme.hu>
Sun, 16 Mar 2025 00:20:46 +0000 (01:20 +0100)
committerMarc-André Lureau <marcandre.lureau@redhat.com>
Sun, 25 May 2025 13:24:43 +0000 (15:24 +0200)
commitf6ccfd5d166acf495f5d6d320da503fae8dc14a4
tree1e4cd8d1211f837e8998e71ecf806d1341a195b7
parent5d978c5da7f7d85d3a74b7d4dbe9ba5c5584d560
alsaaudio: Set try-poll to false by default

Quoting Volker Rümelin: "try-poll=on tells the ALSA backend to try to
use an event loop instead of the audio timer. This works most of the
time. But the poll event handler in the ALSA backend has a bug. For
example, if the guest can't provide enough audio frames in time, the
ALSA buffer is only partly full and the event handler will be called
again and again on every iteration of the main loop. This increases
the processor load and the guest has less processor time to provide
new audio frames in time. I have two examples where a guest can't
recover from this situation and the guest seems to hang."

One reproducer I've found is booting MorphOS demo iso on
qemu-system-ppc -machine pegasos2 -audio alsa which should play a
startup sound but instead it freezes. Even when it does not hang it
plays choppy sound. Volker suggested using command line to set
try-poll=off saying: "The try-poll=off arguments are typically
necessary, because the alsa backend has a design issue with
try-poll=on. If the guest can't provide enough audio frames, it's
really unhelpful to ask for new audio frames on every main loop
iteration until the guest can provide enough audio frames. Timer based
playback doesn't have that problem."

But users cannot easily find this option and having a non-working
default is really unhelpful so to make life easier just set it to
false by default which works until the issue with the alsa backend can
be fixed.

Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
Acked-by: Marc-André Lureau <marcandre.lureau@redhat.com>
[ Marc-André - Updated QAPI and CLI doc ]
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20250316002046.D066A4E6004@zero.eik.bme.hu>
audio/alsaaudio.c
qapi/audio.json
qemu-options.hx