Message ID | 20191105224645.12269-1-robertsmith@posteo.net |
---|---|
State | Accepted |
Headers | show |
Series | [bug#38075] services: mpd: add pulseaudio support | expand |
Hi, (Cc’ing Leo and Tobias who have been taking care of the mpd package and service.) Robert Smith <robertsmith@posteo.net> skribis: > Set the XDG_RUNTIME_PATH environment variable in the mpd service so > that it can detect pulseaudio when run under a user account. > --- > gnu/services/audio.scm | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/gnu/services/audio.scm b/gnu/services/audio.scm > index 471c5fd95f..424ccc7c8f 100644 > --- a/gnu/services/audio.scm > +++ b/gnu/services/audio.scm > @@ -140,6 +140,12 @@ audio_output { > "--no-daemon" > #$(mpd-config->file config)) > #:pid-file #$(mpd-file-name config "pid") > + #:environment-variables > + '(#$(string-append > + "XDG_RUNTIME_DIR=/run/user/" > + (number->string > + (passwd:uid > + (getpwnam (mpd-configuration-user config)))))) > #:log-file #$(mpd-file-name config "log"))) I suppose this is meant for the libpulse client library, right? (I’m surprised it’s not the default, but apparently that’s the way it is.) Note that this also has an effect on mpd itself from what I can see in the source: mpd will listen to $XDG_RUNTIME_DIR/mpd/socket instead of (in addition to?) listening on TCP. I don’t use mpd myself; could you ensure that the socket change is also fine and doesn’t cause any troubles for mpd clients? Thanks, Ludo’.
On 06.11.2019 12:22, Ludovic Courtès wrote: > > Note that this also has an effect on mpd itself from what I can see in > the source: mpd will listen to $XDG_RUNTIME_DIR/mpd/socket instead of > (in addition to?) listening on TCP. > > I don’t use mpd myself; could you ensure that the socket change is also > fine and doesn’t cause any troubles for mpd clients? I've been using the ncmpcpp client, and the functionality is unchanged. I can confirm that the mpd still listens to TCP port 6600, the only difference being that the output is sent to pulseaudio. -Robert
On Wed, Nov 06, 2019 at 12:22:29PM +0100, Ludovic Courtès wrote: > (Cc’ing Leo and Tobias who have been taking care of the mpd package and > service.) I haven't been using the MPD service so I don't really have an opinion on this patch. Starting it "by hand", the pulse output works for me already. But it would be great if our service worked "out of the box" with Pulseaudio.
On 06.11.2019 19:27, Leo Famulari wrote: > I haven't been using the MPD service so I don't really have an opinion > on this patch. Starting it "by hand", the pulse output works for me > already. But it would be great if our service worked "out of the box" > with Pulseaudio. I'm not sure how common my use case is (running mpd locally under my own user account) but since we are supporting the pulse output mode in the service configuration, I think we need to make sure that it works. Currently when the mpd service is started under my account with the pulse output, it fails to connect to pulse because of the missing environment variable, and defaults to alsa. This is unfortunate because the whole point of using pulse for me is to make sure different apps "play nicely" with each other when playing audio. Thankfully this is a relatively simple fix. I also installed the sonata client to make sure that other clients weren't acting funny, and everything seems normal!
Peter [CC'd], I see that you added the Guix MPD service in 2017, and wrote then that it ‘uses pulseaudio for output’[0]. Do you have an opinion on this patch[1]? Did something change? Kind regards, T G-R [0]: http://guix.gnu.org/manual/en/html_node/Audio-Services.html [1]: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=38075 Ludovic Courtès 写道: > Robert Smith <robertsmith@posteo.net> skribis: > >> Set the XDG_RUNTIME_PATH environment variable in the mpd >> service so >> that it can detect pulseaudio when run under a user account. >> --- >> gnu/services/audio.scm | 6 ++++++ >> 1 file changed, 6 insertions(+) >> >> diff --git a/gnu/services/audio.scm b/gnu/services/audio.scm >> index 471c5fd95f..424ccc7c8f 100644 >> --- a/gnu/services/audio.scm >> +++ b/gnu/services/audio.scm >> @@ -140,6 +140,12 @@ audio_output { >> "--no-daemon" >> #$(mpd-config->file config)) >> #:pid-file #$(mpd-file-name config "pid") >> + #:environment-variables >> + '(#$(string-append >> + "XDG_RUNTIME_DIR=/run/user/" >> + (number->string >> + (passwd:uid >> + (getpwnam (mpd-configuration-user >> config)))))) >> #:log-file #$(mpd-file-name config "log"))) > > I suppose this is meant for the libpulse client library, right? > (I’m > surprised it’s not the default, but apparently that’s the way it > is.) > > Note that this also has an effect on mpd itself from what I can > see in > the source: mpd will listen to $XDG_RUNTIME_DIR/mpd/socket > instead of > (in addition to?) listening on TCP. > > I don’t use mpd myself; could you ensure that the socket change > is also > fine and doesn’t cause any troubles for mpd clients?
Hi Tobias, Unfortunately I don't use mpd anymore and I don't have a good understanding of how it works anymore. Cheers, Peter Mikkelsen fre. 8. nov. 2019 20.53 skrev Tobias Geerinckx-Rice <me@tobias.gr>: > Peter [CC'd], > > I see that you added the Guix MPD service in 2017, and wrote then > that it ‘uses pulseaudio for output’[0]. Do you have an opinion > on this patch[1]? Did something change? > > Kind regards, > > T G-R > > [0]: http://guix.gnu.org/manual/en/html_node/Audio-Services.html > [1]: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=38075 > > Ludovic Courtès 写道: > > Robert Smith <robertsmith@posteo.net> skribis: > > > >> Set the XDG_RUNTIME_PATH environment variable in the mpd > >> service so > >> that it can detect pulseaudio when run under a user account. > >> --- > >> gnu/services/audio.scm | 6 ++++++ > >> 1 file changed, 6 insertions(+) > >> > >> diff --git a/gnu/services/audio.scm b/gnu/services/audio.scm > >> index 471c5fd95f..424ccc7c8f 100644 > >> --- a/gnu/services/audio.scm > >> +++ b/gnu/services/audio.scm > >> @@ -140,6 +140,12 @@ audio_output { > >> "--no-daemon" > >> #$(mpd-config->file config)) > >> #:pid-file #$(mpd-file-name config "pid") > >> + #:environment-variables > >> + '(#$(string-append > >> + "XDG_RUNTIME_DIR=/run/user/" > >> + (number->string > >> + (passwd:uid > >> + (getpwnam (mpd-configuration-user > >> config)))))) > >> #:log-file #$(mpd-file-name config "log"))) > > > > I suppose this is meant for the libpulse client library, right? > > (I’m > > surprised it’s not the default, but apparently that’s the way it > > is.) > > > > Note that this also has an effect on mpd itself from what I can > > see in > > the source: mpd will listen to $XDG_RUNTIME_DIR/mpd/socket > > instead of > > (in addition to?) listening on TCP. > > > > I don’t use mpd myself; could you ensure that the socket change > > is also > > fine and doesn’t cause any troubles for mpd clients? >
Robert, Thanks for the patch! Robert Smith 写道: > + #:environment-variables > + '(#$(string-append > + "XDG_RUNTIME_DIR=/run/user/" > + (number->string > + (passwd:uid > + (getpwnam (mpd-configuration-user > config)))))) Like Ludo', I'm surprised this isn't the default. My XDG-foo is weak, though. Your patch failed to break my set-up (better luck next time) so I've pushed it as 970cb5ceceaa85765230a9f896a43783cdcb4e6c with the following tweaks: - Adjusted the commit message to follow the GNU change log standards & Guix's conventions - Promoted your commenty commit message to first-class comment - Removed a trailing space after ‘passwd:uid’ (git diff/show/… should highlight this) Kind regards, T G-R
diff --git a/gnu/services/audio.scm b/gnu/services/audio.scm index 471c5fd95f..424ccc7c8f 100644 --- a/gnu/services/audio.scm +++ b/gnu/services/audio.scm @@ -140,6 +140,12 @@ audio_output { "--no-daemon" #$(mpd-config->file config)) #:pid-file #$(mpd-file-name config "pid") + #:environment-variables + '(#$(string-append + "XDG_RUNTIME_DIR=/run/user/" + (number->string + (passwd:uid + (getpwnam (mpd-configuration-user config)))))) #:log-file #$(mpd-file-name config "log"))) (stop #~(make-kill-destructor))))