FS#33425 - [libao] libao-1.1.0 breaks ALSA software mixing

Attached to Project: Arch Linux
Opened by René Herman (rene) - Thursday, 17 January 2013, 13:29 GMT
Last edited by Gaetan Bisson (vesath) - Sunday, 17 February 2013, 23:28 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To Gaetan Bisson (vesath)
Architecture All
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:

libao-1.1.0 doesn't by default use the "default" ALSA PCM device but tries, depending on the number of channels of the source, the devices:

channels : device
=================

7, 8 : surround71
6, 5 : surround51
4, 3 : surround40
2 : front
1 : default

It only falls back to "default" when these fail. Specifically, also for regular stereo sources, it uses "front" rather than "default", but "front" isn't software-mixed by ALSA as is the default device.

Reproduce the problem by starting, say, two ogg123 instances on a machine that has a "front" PCM (any one, basically) -- and for which the default ALSA device is not in fact the pulseaudio device (any sane one, basically). The second instance will bomb out (unless, by the way, the "front" PCM was already busy so that the first ogg123 retreated to "default" automatically).

It's probably debatable if the libao behaviour is nice or not generally, but what's certainly not nice is that even normal stereo sources are by now by default no longer mixed when played through a libao player; ALSA once went to great lengths to make sure that it is.

/etc/libao.conf is an arch-linux addition, and this behaviour can be changed (and restored to its libao-1.0 state) by adding "dev=default" to it. I believe this should be done: libao is used by the most basic players, and their users expect "no thrills" ALSA behaviour...

This task depends upon

Closed by  Gaetan Bisson (vesath)
Sunday, 17 February 2013, 23:28 GMT
Reason for closing:  Fixed
Additional comments about closing:  libao-1.1.0-3 in [extra]
Comment by René Herman (rene) - Thursday, 17 January 2013, 13:41 GMT
Mmm, ignore that bit about the default device not being pulse, I believe. It's "front" that matters, so I don't believe it will in fact matter if you normally use pulse or not.
Comment by Gaetan Bisson (vesath) - Monday, 21 January 2013, 23:38 GMT
I have just pushed libao-1.1.0-3 to [testing]; unless there are any complaints I will move it to [extra] in a few days.
Comment by René Herman (rene) - Tuesday, 22 January 2013, 00:01 GMT
Thanks. This took me by surprise when I was testing basic audio functionality...
Comment by Gaetan Bisson (vesath) - Friday, 25 January 2013, 01:08 GMT
I take no news as good news.
Comment by Tim L. (ledti) - Sunday, 17 February 2013, 19:55 GMT
Bad news, PulseAudio users have to remove the added "dev=default" entry when using "default_driver=pulse". The simple fix is to recommend this in the PulseAudio/libao wiki page, but I'll let you decide.
Comment by René Herman (rene) - Sunday, 17 February 2013, 21:43 GMT
Actually, it is advised (and implemented in the archlinux "pulseaudio-alsa" package) to set the default ALSA device TO the pulse device when using PulseAudio and in that case all should, I assume, be well also after this addition to /etc/libao.conf:

https://projects.archlinux.org/svntogit/packages.git/tree/trunk/asound.conf?h=packages/pulseaudio-alsa

Now, unfortunately, I see that the wiki:

https://wiki.archlinux.org/index.php/PulseAudio

mentions doing this just after commenting that "this section is out of date", but that comment has been mispositioned: setting the default ALSA device to pulse is not out of date, and has nothing whatsoever to do with systemd. Looking over the page, I'm not all that sure where someone once intended that outdated-warning to go, and given that I'm not a pulseaudio user, I guess I'll not edit the page myself but I do believe that it's only that bit of advice about making pulse actually be the default ALSA device which should be made more prominent for Pulse users.

EDIT:

I notice that that PulseAudio wiki page does advice to set default_driver=pulse in /etc/libao.conf a bit below, so I guess my comment would boil down to augmenting that bit of advice with, as you said, mentioning "... and remove dev=default" and additionally (a pointer to) the alternative of setting the default ALSA device to pulse. That last option is a catch-all for more than just libao, so I believe that has some additional value.

EDIT2:

Did a s/driver/device/ above and added the PulseAudio wiki link -- and am now wondering if people actually get an email-alert not only when a new comment is placed but also every time an edit is made. If so, I need to make sure that I do fewer edits... ;-)
Comment by Tim L. (ledti) - Sunday, 17 February 2013, 23:07 GMT
Haha, I only got alerted for the initial reply.

As for the issue, I actually have pulseaudio-alsa installed. I suppose "dev=default" just conflicts with "default_driver=pulse" for whatever reason, as removing the former lets Pianobar access the audio device. If I don't remove "dev=default" after changing the default_driver to 'pulse', I get a "/!\ Cannot open audio device" error from Pianobar.

So I would assume all PulseAudio users have to remove "dev=default" unless there's something unique to my setup.

Edit: I should note that if I simply leave libao.conf alone with the default options (default_driver=alsa+dev=default), then I get this error in Pianobar: "ao_alsa ERROR: Unable to open ALSA device 'default' for playback => Invalid argument
/!\ Cannot open audio device"
Comment by Gaetan Bisson (vesath) - Sunday, 17 February 2013, 23:28 GMT
Thanks for noticing this, Tim.
The default libao.conf just sets sane defaults (and "dev=default" is required for that, as this bug report shows).
As with any configuration file, you cannot change parts of it (such as "default_driver=pulse") and leave the rest as it is: it should be modified as a whole.
In this particular case, I think it is crazy that pulseaudio should have problems with an innocent "dev=default".
Anyway, thanks a lot René for editing the wiki, and if you don't find that's enough, please create a separate bug report against pulseaudio.

Loading...