Sometimes the PA server needs a restart.
Submitted by Jörg Höhle
Assigned to pul..@..op.org
Description
Hi,
The Wine bugzilla contains several mentions from people managing to restore sound or to get rid of crackling by restarting the PulseAudio server. The need to restart is an indicator of a bug on the PA or alsa_plugin side. A user app must not manage to cause harm to a server, much like a kernel panic is undeniably a bug in the kernel, not in the app perhaps feeding bad data.
-
http://bugs.winehq.org/show_bug.cgi?id=28856#c17 Vítor Ferreira: "I restarted pulseaudio" running Fedora 16 with pulseaudio 1.1 and alsa stack 1.0.25
-
http://bugs.winehq.org/show_bug.cgi?id=28723#c106 Michael Cronenworth: "I have to quit the application and restart PA", Fedora 16 x86_64
I myself have ran into the need to restart PA, using old Ubuntu Intrepid 2008.10 and Lucid 2010.04 however (nothing newer here). I managed to achieve this by sending a straightforward selection of snd_pcm_* commands from the safe ALSA subset using an interactive Lisp Read Eval Print Loop (REPL).
The server's broken state can be persistent, i.e. you can quit the client app and PA is still in trouble. My systems are outdated, which is the reason I did not write a bug report earlier, but the above users are running the latest PA and alsa_plugins AFAIK.
Hence I believe this is a long-standing bug. Alas, I don't have something reproducible. My sequence of commands is similar to what Wine calls in dlls/winealsa.drv/mmdevdrv.c these days. During the last months, Wine's ALSA driver was largely simplified. I don't see anything wrong with it, the only noteworthy issue is that MS' mmdevapi design quasi mandates that we feed data every 10ms instead of writing much larger chunks.
Later I'll attach my Lisp code, already sent to David Henningsson. There's no magic with this Lisp code. It's just repeating loops of a few snd_pcm_write, followed by printing snd_pcm_avail & delay and some sleep(5ms).
Regards, Jörg Höhle