You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This looks related to #237 in the sense that we are not exposing hardware / drivers through WSL. For this, your best bet is to submit a feature request over on our User Voice Page to help us prioritize future releases.
It is possible to run PulseAudio over TCP, and there is a native Windows port of the PulseAudio server. However, it seems to want to use a SOCK_DGRAM, which doesn't seem to be supported yet.
On real-Ubuntu, the equivalent socketpair() call succeeds.
My understanding is that Pulse uses local sockets for some sort of internal communication. I think, though I'm not sure, that it starts a helper process to handle communication with the remote server, and it handles communication with that process using this socket pair.
Adam Seering (@aseering) So I commented on the other thread with some info, and I also found some other stuff: By default, Pulse loads a module called module-native-protocol-unix, and another module called module-native-protocol-tcp can also be enabled. I wonder if you can start pulse with a config that does not enable module-native-protocol-unix at all, then disable all of the non-native modules that listen over datagram-mode unix sockets. It looks like this might be possible, and if it is, Pulse won't try opening that unix socket and should startup fine, I think. As I mentioned in the other thread though, I won't be able to test it this weekend bc hardware problems, but maybe this could help.
Adam Seering (@aseering) Nope, it runs those as well as the sink modules on the linux side. That's why I mentioned "trunking" from one to the other. Basically, there are two modes, a "bridging mode" that basically pipes all of the channels in multiplex to the remote server (Windows), to allow mixing of channels, etc on the remote machine, and a "flattened" version where the mixing and filtering and stuff are done on the "linux side" and then the output of the mix is piped to the Windows "client".
However, both modes of operation do have to use some kind of socket or port. For example, OSS sound (for which pulse has a sink) uses unix ports, so Pulse's OSS sink module will trick all OSS applications into piping their output to a unix socket opened by Pulse. Similarly, you can have a pulse module for Alsa, etc. In addition to those sink modules, pulse has a "pulse sink" for pulse-aware programs. This "pulse sink" module is "pulse-native-protocol-*".
Remember, pulse needs a some kind of socket that the linux programs have to talk to on the linux side. Then Pulse can either bundle them up and pipe a multiplexed stream to another Pulse server for processing or process them and then pipe a single processed stream to the other pulse server.
I believe (and I can't check bc my pc broke) that if you disable linux-side pulse from using any modules that use unix sockets, it should launch fine. Basically, this hypothesized fix should work similar to how the dbus fix works, I think.
Adam Seering (@aseering) Oh, seems like that should work. You are saying that you aren't running pulse on the Linux side, but you also told me that it crashes, which seems like you are running it.
Or are you saying you used a workaround to get it to work?
(Also, fwiw, the benefit of running Pulse as a remote server and connecting it to another instance of pulse on your local machine is that not every Linux application with sound will output audio to pulse over tcp, mostly older programs or games. That's why pulse in Linux has all of those sink modules).
fpqc -- oh, sorry, terminology confusion. Let me define some more-specific terms:
libpulse -- the client library that pulse-based applications link
Linux pulseaudio -- the daemon that run on Linux
pulseaudio.exe -- the daemon that runs on Windows
By editing /etc/pulse/client.conf in WSL, I have configured Linux binary applications that link libpulse (tested with both paplay and mplayer) to connect over TCP to localhost.
I have also configured pulseaudio.exe to listen on TCP localhost.
I have not configured Linux pulseaudio, nor attempted to start it.
I am observing a failure (not a crash, simply an error as well as no audio) coming from libpulse inside WSL, when I run applications that link libpulse. If I modify the IP addresses used in this setup and use libpulse on a real Linux system (but still pulseaudio.exe on Windows), I do not see this failure, and I do hear audio, so the Windows side of the setup seems to be working properly.
When I strace the application that's calling into the relevant libpulse code, I observe that the first syscall that obviously differs between the working Linux execution and the failing WSL execution is socketpair(). socketpair() generates a pair of sockets that's typically used to communicate between a parent and a child process, or two threads within the same process; it has no on-disk nor TCP representation so AFAIK it can't be easily used to emulate any of these protocols.
I was looking around on the Internet and I thought I read somewhere (unfortunately I don't remember the source; it was unofficial) that libpulse actually tries to internally start is own mini Linux pulseaudio subsystem, to handle communication with the actual target pulseaudio. My suspicion, though I didn't read enough code to prove it, was that this socket was for communicating between the client application and that application's own custom pulseaudio instance.
I wonder, if you do run the pulse daemon in unix socket mode, do the applications still start a mini pulse instance and create its socketpair in order to connect to the daemon. How about if you run the pulse daemon in tcp mode? (on a single linux system, no remote machine).
fpqc -- good point re: disabling automatic spawning. Unfortunately, I tried it and it doesn't seem to help...
I tried running a local pulse daemon (which started after I disabled a bunch of plugins for things like bluetooth and hardware autodiscovery); that actually failed differently. In libpulse, as run from paplay:
mplayer segfaults in this configuration. I haven't dug into the root cause, but prior to segfaulting, one of its pids tries a getsockopt(SO_ERROR) and fails in the same ways as above.
I got paplay working with pulseaudio 9.0 on WSL and the win32 server here. Build instructions are here.
Interestingly, I didn't need to patch the source, just judiciously disable some stuff with configure. The SO_ERROR problem that Adam Seering (@aseering) found, which is in pulsecore/socket-client.c, doesn't appear to be in the control flow for paplay, for whatever reason.
You can also edit /etc/pulse/client.conf and set default-server = tcp:localhost. The server is never launched on WSL, so you can ignore default.pa. [Heads up that paplay doesn't support .mp3 files. You can get the list of supported formats with paplay --list-file-formats.]
That's the good news. The bad news is that mplayer and minimodem don't work because:
I got this to work with great thanks to everyone in this thread.
I am now able to use paplay while being ssh-d into a remote machine (CentOS 7) and hear sounds on my local machine (Windows 7). However, I wanted to use padsp and that does not seem to work. I am running my application like so while being ssh-d to my remote machine:
/usr/bin/padsp-32 application_name
And I don't hear any sounds on my local machine. Could this be because the pulseaudio for Windows does not have padsp? I know that padsp forwards sound to the PulseServer which I know to be working fine because of paplay. But, does it attempt to use something like a "padsp.exe" on the local machine and doesn't find it? Or do I need to do something else? Like load a particular module into my pulse audio on the Windows side?
/usr/bin/padsp-32 isn't an application in my supported Ubuntu distro from the store, so I could not run it and take a quick look-see. I have a guess (name screams 32 bit application) but rather not speculate on this one. Best place to ask would be in the discussion forum for wherever it is you got CentOS 7.
Could you take a look with padsp? I just want to get an idea on what I can do.. Getting paplay to work itself was quite the task, really need this one though.
So the pulse audio server on my windows stops after a few seconds of inactivity, this is even though I am running it with the --daemonize flag. Any ideas? therealkenc
Not really. Suggestion would be to not run pulseaudio.exe --daemonize in the first place, and let it run in the foreground. Longer answer on how to go about fixing it: Fork the source, compile it, set a breakpoint at the fail, type on keyboard, compile again, and (optionally) upstream the patch.
Activity
russalex commentedon Jun 8, 2016
This looks related to #237 in the sense that we are not exposing hardware / drivers through WSL. For this, your best bet is to submit a feature request over on our User Voice Page to help us prioritize future releases.
aseering commentedon Jun 9, 2016
It is possible to run PulseAudio over TCP, and there is a native Windows port of the PulseAudio server. However, it seems to want to use a SOCK_DGRAM, which doesn't seem to be supported yet.
aseering commentedon Jul 22, 2016
Specifically, the failure is as follows:
On real-Ubuntu, the equivalent
socketpair()call succeeds.My understanding is that Pulse uses local sockets for some sort of internal communication. I think, though I'm not sure, that it starts a helper process to handle communication with the remote server, and it handles communication with that process using this socket pair.
fpqc commentedon Jul 22, 2016
Adam Seering (@aseering) So I commented on the other thread with some info, and I also found some other stuff: By default, Pulse loads a module called module-native-protocol-unix, and another module called module-native-protocol-tcp can also be enabled. I wonder if you can start pulse with a config that does not enable module-native-protocol-unix at all, then disable all of the non-native modules that listen over datagram-mode unix sockets. It looks like this might be possible, and if it is, Pulse won't try opening that unix socket and should startup fine, I think. As I mentioned in the other thread though, I won't be able to test it this weekend bc hardware problems, but maybe this could help.
Here is a list of the modules that have both TCP and unix variants: https://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/Modules/#index22h3
Maybe if you turn off all of the unix modules and replace them with TCP variants, you can start the pulse server.
aseering commentedon Jul 23, 2016
Aren't those modules loaded by the server? The server in this model runs under Windows. This strace is from the client.
fpqc commentedon Jul 23, 2016
Adam Seering (@aseering) Nope, it runs those as well as the sink modules on the linux side. That's why I mentioned "trunking" from one to the other. Basically, there are two modes, a "bridging mode" that basically pipes all of the channels in multiplex to the remote server (Windows), to allow mixing of channels, etc on the remote machine, and a "flattened" version where the mixing and filtering and stuff are done on the "linux side" and then the output of the mix is piped to the Windows "client".
However, both modes of operation do have to use some kind of socket or port. For example, OSS sound (for which pulse has a sink) uses unix ports, so Pulse's OSS sink module will trick all OSS applications into piping their output to a unix socket opened by Pulse. Similarly, you can have a pulse module for Alsa, etc. In addition to those sink modules, pulse has a "pulse sink" for pulse-aware programs. This "pulse sink" module is "pulse-native-protocol-*".
Remember, pulse needs a some kind of socket that the linux programs have to talk to on the linux side. Then Pulse can either bundle them up and pipe a multiplexed stream to another Pulse server for processing or process them and then pipe a single processed stream to the other pulse server.
I believe (and I can't check bc my pc broke) that if you disable linux-side pulse from using any modules that use unix sockets, it should launch fine. Basically, this hypothesized fix should work similar to how the dbus fix works, I think.
aseering commentedon Jul 23, 2016
That all sounds very complicated... I just have every Pulse application individually opening a TCP socket to the Windows daemon.
fpqc commentedon Jul 23, 2016
Adam Seering (@aseering) Oh, seems like that should work. You are saying that you aren't running pulse on the Linux side, but you also told me that it crashes, which seems like you are running it.
Or are you saying you used a workaround to get it to work?
(Also, fwiw, the benefit of running Pulse as a remote server and connecting it to another instance of pulse on your local machine is that not every Linux application with sound will output audio to pulse over tcp, mostly older programs or games. That's why pulse in Linux has all of those sink modules).
aseering commentedon Jul 23, 2016
fpqc -- oh, sorry, terminology confusion. Let me define some more-specific terms:
By editing /etc/pulse/client.conf in WSL, I have configured Linux binary applications that link libpulse (tested with both
paplayandmplayer) to connect over TCP to localhost.I have also configured pulseaudio.exe to listen on TCP localhost.
I have not configured Linux pulseaudio, nor attempted to start it.
I am observing a failure (not a crash, simply an error as well as no audio) coming from libpulse inside WSL, when I run applications that link libpulse. If I modify the IP addresses used in this setup and use libpulse on a real Linux system (but still pulseaudio.exe on Windows), I do not see this failure, and I do hear audio, so the Windows side of the setup seems to be working properly.
When I strace the application that's calling into the relevant libpulse code, I observe that the first syscall that obviously differs between the working Linux execution and the failing WSL execution is
socketpair().socketpair()generates a pair of sockets that's typically used to communicate between a parent and a child process, or two threads within the same process; it has no on-disk nor TCP representation so AFAIK it can't be easily used to emulate any of these protocols.I was looking around on the Internet and I thought I read somewhere (unfortunately I don't remember the source; it was unofficial) that libpulse actually tries to internally start is own mini Linux pulseaudio subsystem, to handle communication with the actual target pulseaudio. My suspicion, though I didn't read enough code to prove it, was that this socket was for communicating between the client application and that application's own custom pulseaudio instance.
fpqc commentedon Jul 23, 2016
I wonder, if you do run the pulse daemon in unix socket mode, do the applications still start a mini pulse instance and create its socketpair in order to connect to the daemon. How about if you run the pulse daemon in tcp mode? (on a single linux system, no remote machine).
fpqc commentedon Jul 23, 2016
Actually, Adam Seering (@aseering), could it just be something as simple as this https://wiki.archlinux.org/index.php/PulseAudio/Examples#Disabling_automatic_spawning_of_PulseAudio_server
https://wiki.archlinux.org/index.php/PulseAudio/Examples#Disabling_pulseaudio_daemon_altogether
Namely that it's starting the daemon and choking?
aseering commentedon Jul 23, 2016
fpqc -- good point re: disabling automatic spawning. Unfortunately, I tried it and it doesn't seem to help...
I tried running a local pulse daemon (which started after I disabled a bunch of plugins for things like bluetooth and hardware autodiscovery); that actually failed differently. In libpulse, as run from
paplay:mplayersegfaults in this configuration. I haven't dug into the root cause, but prior to segfaulting, one of its pids tries agetsockopt(SO_ERROR)and fails in the same ways as above.therealkenc commentedon Jul 25, 2016
I got
paplayworking with pulseaudio 9.0 on WSL and the win32 server here. Build instructions are here.Interestingly, I didn't need to patch the source, just judiciously disable some stuff with
configure. TheSO_ERRORproblem that Adam Seering (@aseering) found, which is inpulsecore/socket-client.c, doesn't appear to be in the control flow forpaplay, for whatever reason.On the WSL (ie, client) side, all you need is:
You can also edit
/etc/pulse/client.confand setdefault-server = tcp:localhost. The server is never launched on WSL, so you can ignoredefault.pa. [Heads up thatpaplaydoesn't support.mp3files. You can get the list of supported formats withpaplay --list-file-formats.]That's the good news. The bad news is that mplayer and minimodem don't work because:
Firefox and VLC also don't make noise yet, but I haven't tracked why. They do open the socket to the win32 server before choking, though.
aseering commentedon Jul 25, 2016
therealkenc -- ooh, that's really interesting. Good to know.
What ABI-compatibility guarantees does pulseaudio provide? Ubuntu 14.04's packages are all built against pulseaudio 4.0.
49 remaining items
sunilmut commentedon May 18, 2018
Squilliam (@cuprousoxide) - In general, the fixes in 17627 will not make it to April W10.
trzecieu commentedon May 22, 2018
Hi Tara Raj (@tara-raj), is there any other reference ticket/issue where we can see progress of this issue?
Best regards,
P
adikhanna commentedon Jul 18, 2018
Hi,
I got this to work with great thanks to everyone in this thread.
I am now able to use paplay while being ssh-d into a remote machine (CentOS 7) and hear sounds on my local machine (Windows 7). However, I wanted to use padsp and that does not seem to work. I am running my application like so while being ssh-d to my remote machine:
/usr/bin/padsp-32 application_name
And I don't hear any sounds on my local machine. Could this be because the pulseaudio for Windows does not have padsp? I know that padsp forwards sound to the PulseServer which I know to be working fine because of paplay. But, does it attempt to use something like a "padsp.exe" on the local machine and doesn't find it? Or do I need to do something else? Like load a particular module into my pulse audio on the Windows side?
therealkenc, do you have any ideas?
therealkenc commentedon Jul 18, 2018
/usr/bin/padsp-32isn't an application in my supported Ubuntu distro from the store, so I could not run it and take a quick look-see. I have a guess (name screams 32 bit application) but rather not speculate on this one. Best place to ask would be in the discussion forum for wherever it is you got CentOS 7.adikhanna commentedon Jul 18, 2018
Could you take a look with
padsp? I just want to get an idea on what I can do.. Gettingpaplayto work itself was quite the task, really need this one though.therealkenc commentedon Jul 18, 2018
Makes noise here.
adikhanna commentedon Aug 7, 2018
So the pulse audio server on my windows stops after a few seconds of inactivity, this is even though I am running it with the --daemonize flag. Any ideas? therealkenc
adikhanna commentedon Aug 8, 2018
therealkenc I am getting the following error while attempting to start pulseaudio.exe on my Windows:
Daemon already runningpa_pid_file_create() failedAnd I get a
failed to kill daemon, no such file or directoryif I trypulseaudio.exe --killDo you have any idea how to go about fixing this?
therealkenc commentedon Aug 8, 2018
Not really. Suggestion would be to not run
pulseaudio.exe --daemonizein the first place, and let it run in the foreground. Longer answer on how to go about fixing it: Fork the source, compile it, set a breakpoint at the fail, type on keyboard, compile again, and (optionally) upstream the patch.adikhanna commentedon Aug 8, 2018
I fixed it by simply restarting my machine. What's the best way to keep pulseaudio running? It keeps stopping for me. therealkenc
therealkenc commentedon Aug 8, 2018
this
elig0n commentedon Jan 1, 2020
For anyone interested, the above Ubuntu xenial repo is working with WSL Debian testing as well.
I had to import the key for Launchpad PPA manually though with
apt-key addusing this file https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x715bfae95321fdc8ef2146fda5a09224e1919fad