Comment 17 for bug 192735

Revision history for this message
intuited (intuited) wrote :

I initially got this working by using the paprefs applet. pulse-related changes to my mpd.conf file are the same as the de facto solution. this solution is noted as an alternate solution in http://mpd.wikia.com/wiki/PulseAudio#For_Distros_where_PulseAudio_output_is_broken
This solution works & is necessary (unless you use the loadmodule fix) because
a) the mpd daemon is run by the user mpd and is unable to connect to that user's instance of pulseaudio because it doesn't exist
b) I have told the instance of pulseaudio that's running under my username to allow connections via tcp from unauthenticated users
c) mpd is able to make connections via tcp, and will do so to the localhost by default.

the problem, as I understand it, with this workaround, is that it leaves my instance of pulseaudio open to other users on either my local machine or anywhere on the LAN. so there's the possibility of unexpected bursts of sound emitting from the machine when I'm at, say, the library. yeah yeah hosts.allow.

with help from the section http://mpd.wikia.com/wiki/PulseAudio#On_Windows i gathered that copying ~/.pulse-cookie to the mpd user's home directory (and chowning it to that user) will let mpd get authorization to the pulseaudio server for that user, even if the paprefs option to allow unauthenticated users is unchecked and the loadmodule command is not specified. this is working fine under hardy. i also did # usermod -d /home/mpd mpd; not sure if that was necessary. again you do have to check the box in paprefs to enable network access to local sound devices.

but since this will only let mpd connect to one user's instance of pulseaudio, it's not a very good solution for a music server. more appropriate for, for example, a system that supplies audio to a stereo system and has various users logging into it, is to invoke a system-wide instance of pulse as per http://pulseaudio.org/wiki/SystemWideInstance, and copy /var/run/pulse/.pulse-cookie to /home/mpd instead of the user's cookie. there are some security & other issues associated with using a system-wide pulse instance; read all about it at the pulseaudio wiki link.