Open ShutdownRepo opened 1 year ago
I had already poc this subject a long time ago, it is possible to share the socket pulse of the host and also the simplest it allows to delegate the configuration to the host and bonus it will be also supported on windows with WSLg.
I tried to get some inspiration from the following sources to make it work through a mac, to no avail...
It basically comes back to running this:
# from the host
brew install pulseaudio
sed -i '' 's/#load-module module-esound-protocol-tcp/load-module module-esound-protocol-tcp/' /opt/homebrew/Cellar/pulseaudio/14.2_1/etc/pulse/default.pa
sed -i '' 's/#load-module module-native-protocol-tcp/load-module module-native-protocol-tcp/' /opt/homebrew/Cellar/pulseaudio/14.2_1/etc/pulse/default.pa
pulseaudio --load=module-native-protocol-tcp --exit-idle-time=-1 --daemon --verbose
exegol start soundtest nightly --env "PULSE_SERVER=host.docker.internal" --volume "~/.config/pulse:/root/.config/pulse"
# from the container
apt-get update && apt-get install -y alsa-utils libasound2 libasound2-plugins pulseaudio pulseaudio-utils --no-install-recommends
usermod -aG audio,pulse,pulse-access root
wget https://raw.githubusercontent.com/jessfraz/dockerfiles/master/pulseaudio/client.conf -O /etc/pulse/client.conf
wget https://raw.githubusercontent.com/jessfraz/dockerfiles/master/pulseaudio/daemon.conf -O /etc/pulse/daemon.conf
wget https://raw.githubusercontent.com/jessfraz/dockerfiles/master/pulseaudio/default.pa -O /etc/pulse/default.pa
## add the host.docker.internal address subnet to /etc/pulse/default.pa auth-ip-acl
wget https://www.cjoint.com/doc/21_07/KGzngdVKbrk_Rick-Astley---Never-Gonna-Give-You-Up.wav -O rick.wav
paplay /workspace/rick.wav --verbose
But sadly I got no sound output on my mac. Here are a few things I checked
host.docker.internal
points to my host, which can be pinged from the containerlsof -Pi TCP -s TCP:LISTEN | grep 4713
)PULSE_SERVER
addr and port (host.docker.internal:4713
)paplay
smoothlypaplay rick.wav
directly from the mac but got no sound output.I've probably missed something more or less obvious 🤷
If we manage to make what I've described above work, I think it could apply to Linux and Windows as well
More generally we would need to have:
PULSE_SERVER
, probably need to adapt value to network mode?), share the PulseAudio cookie file at ~/.config/pulse/cookie
, probably edit the container's /etc/pulse/default.pa
(to add the right subnet in the auth-ip-acl
)Sound support is important as it would allow to
Two different choices :
I tried both approaches without success. Will look into it a bit more this week