FS#39186 - [pulseaudio] certain applications using alsa don't work with pulseaudio 5.0 / alsa
Attached to Project:
Arch Linux
Opened by Daniel Jenssen (Daerandin) - Wednesday, 05 March 2014, 16:26 GMT
Last edited by Doug Newgard (Scimmia) - Friday, 20 October 2017, 15:01 GMT
Opened by Daniel Jenssen (Daerandin) - Wednesday, 05 March 2014, 16:26 GMT
Last edited by Doug Newgard (Scimmia) - Friday, 20 October 2017, 15:01 GMT
|
Details
Description:
After the update to Pulseaudio 5.0, PlayOnLinux can no longer launch installed applications. In terminal is the output: ALSA lib dlmisc.c:252:(snd1_dlobj_cache_get) Cannot open shared library /usr/lib32/alsa-lib/libasound_module_pcm_pulse.so Other applications that are also affected, but don't give any indication of problems in terminal output, are Timidity++ and Munt from AUR. Timidity just give some very choppy sounds, and mt32emu-qt (from the Munt package) simply fail to start the sound mixing when Alsa is set at the output device. Additional info: Downgrading pulseaudio, along with libpulse and lib32-libpulse, to version 4.0-6 make everything work as intended. If PlayOnLinux is set to using the System wine version, then it works. But other specific wine versions in PlayOnLinux crash on start. Steps to reproduce: Start PlayOnLinux, and start an application that does not use System wine setting. |
This task depends upon
Please find a way to reproduce this without involving packages from the AUR.
The issues with PlayOnLinux are noted by several people in the forum. As for Timidity, I run it with:
timidity -iA -Os
so it handles midi sound for DosBox games.
Forum topic:
https://bbs.archlinux.org/viewtopic.php?id=177979
Edit: Timidity work properly if I set my laptop's internal speakers as default, instead of the headset I normally have set as default. I can then change the output for Timidity to the headset after it has started, and it works. I attempted the same with PlayOnLinux, but it did not help.
I tried switching the output to the onboard soundcard and the problem went away!.. I think it's something related to resampling as my USB Headset seems to only support 48000Hz output while the onboard soundcard supports multiple rates.
Also tried uncommenting: default-sample-rate = 48000 in /etc/pulse/daemon.conf, but the issue remains... :\
ALSA lib pcm.c:7843:(snd_pcm_recover) underrun occurred
If I set speakers to default output, then sound works properly and I can even switch the output over to headset after starting applications from PlayOnLinux.
Editing /etc/pulse/daemon.conf adding the line:
default-fragment-size-msec = 5
Solves the problems I had with Timidity and Munt. However, PlayOnLinux still don't work unless either downgrade or use .asoundrc to prevent Pulseaudio from handling all sound output so that Alsa applications can output to my audio devices without going through Pulse.
ALSA lib pcm.c:7843:(snd_pcm_recover) underrun occurred
error when running Star Craft II in Wine (which worked flawlessly before) together with the garbled sound mentioned by Daerandin. Downgrading bluez* to 5.15-1 seems to fix the issue with Wine (I did not have any problems with other programs). Since the problem seems to be the bluez* tools in my case, I am not sure whether this is the same issue or not.
Just tell me if you want me to open another issue or if I should provide more debugging output.
*EDIT*: After the issue popped up again once I rebooted, I did some testing and it seems that the underrun error occurs when using pulseaudio 5.0-1 regardless of which bluez* packages you have installed. As far as I can tell the issue seems to be indeed with pulseaudio 5.0-1. pulseaudio 4.0-6 works fine with wine and Star Craft II.
1. Mocp plays really fast, 1 minute only takes about 5 seconds (unchanged pitch, as if only chunks of the sound played). During this, when running pulseaudio in terminal, I get this:
E: [alsa-sink-USB Audio] alsa-sink.c: ALSA woke us up to write new data to the device, but there was actually nothing to write!
E: [alsa-sink-USB Audio] alsa-sink.c: Most likely this is a bug in the ALSA driver 'snd_usb_audio'. Please report this issue to the ALSA developers.
E: [alsa-sink-USB Audio] alsa-sink.c: We were woken up with POLLOUT set -- however a subsequent snd_pcm_avail() returned 0 or another value < min_avail.
When running with debug verbosity, it loops in a series of underruns and resets. I'm attaching the log for your eyes, it is rather long.
2. Youtube client in HTML5 mode plays in short bursts, followed by short bursts of silence, periodically (about 3-6 times per second).
3. Many programs play sound okay - Flash player for Youtube is okay, google play music plays well, games play well as far as I tested.
4. mocp, and other programs start to behave as they should after this env var is set: PULSE_LATENCY_MSEC=30
- unfortunately this breaks other things, and doing this on per-application basis is rather tedious
dmesg contains these (in great ammount):
[ 1331.444905] retire_capture_urb: 1873 callbacks suppressed
I also saw some overrun messages from kernel, something in lines of "that usb device cant process the buffer of the given size", but can't find that now.
Edit:
Some other things I found so far:
* on a different PC, the bug acts differently, for example no problem with youtube. I think this is due to a different USB controller
* downgrading to pulseaudio 4.0 resolves this
* my soundcard is ODAC+O2 combo, if that matters (that means Tenor TE7022 USB interface chip and ES9023 DAC)
ERROR:network_change_notifier_win.cc(126)] WSALookupServiceBegin failed with: 8
ALSA lib dlmisc.c:252:(snd1_dlobj_cache_get) Cannot open shared library /usr/lib32/alsa-lib/libasound_module_pcm_pulse.so
$ ldd /usr/lib32/alsa-lib/libasound_module_pcm_pulse.so shows http://sprunge.us/jCgV
EDIT:
I emptied the /usr/lib32/alsa-lib/ folder completely, because of another issue. Not sure if this helped for this one. Yet someone else might test it.
commit 826c8f69d34ef49e86fe0ab6c93c1ffba8916131
Author: Lars-Peter Clausen <lars@metafoo.de>
Date: Sat Nov 30 18:07:24 2013 +0100
alsa: Disable timer-scheduling for PCMs with the BATCH flag
PCM Devices which have the BATCH flag set update the PCM pointer only with
period size granularity. Using timer based scheduling does not have any
advantage in this mode. For one devices which have that flag set usually update
the position pointer in software after getting the period interrupt. So
disabling the period interrupt is not possible for this kind of devices.
Furthermore writing to or reading from the buffer slice for the current period
is not possible since the position inside the buffer is not known. On the other
hand the tsched algorithm seems to get easily confused for this kind of
hardware, which results in garbled audio output. This typically means that timer
based scheduling needs to be manually disabled on systems with such devices.
Auto disabling tsched in this case allows these systems to run with the default
configuration.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
diff --git a/src/modules/alsa/alsa-util.c b/src/modules/alsa/alsa-util.c
index 75f5858..4b24e47 100644
--- a/src/modules/alsa/alsa-util.c
+++ b/src/modules/alsa/alsa-util.c
@@ -245,6 +245,10 @@ int pa_alsa_set_hw_params(
if (!pa_alsa_pcm_is_hw(pcm_handle))
_use_tsched = false;
+ /* The PCM pointer is only updated with period granularity */
+ if (snd_pcm_hw_params_is_batch(hwparams))
+ _use_tsched = false;
+
#if (SND_LIB_VERSION >= ((1<<16)|(0<<8)|24)) /* API additions in 1.0.24 */
if (_use_tsched) {
Which apparently was made to prevent garbled audio output with some hardware configurations, oh the irony...
Anyway, reverting it fix the problem in my case.
N.B.: I'm using an USB DAC (Epiphany Acoustics EHP-O2).