How to redirect pulse audio through ssh?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I think you're maybe getting a little confused by client and server in
terms of how things work here (perhaps not, as I've not thoroughly read
all the many posts in this thread).

As I know how to do what you want to do, I'll just write the
instructions here:


1. Start of on the machine you want to hear the sound on. This will be
your local terminal. It's the "server" in this case as it's running the
PulseAudio server. You do not need to run a PulseAudio server on the
other machine, just use the PulseAudio client library for audio (either
directly or via alsa-pulse plugin).

2. Open a terminal and type: "xprop -root | grep PULSE_COOKIE" Ensure
this has some output. If it does not then chances are the
"start-pulseaudio-x11" script was not run at login (or you have
restarted your PA server after logging in). Try just running
"start-pulseaudio-x11" and see if that fixes it.

3. Ensure that the tcp native protocol module is loaded. "pacmd
list-modules | grep module-native-protocol-tcp" If it is not loaded,
then simply type: "pactl load-module module-native-protocol-tcp"

4. SSH to your other machine:  ssh -X -R4713:localhost:4713 OTHERMACHINE

If you get a warning:
Warning: remote port forwarding failed for listen port 4713
then chances are there is a PA daemon running there already, or you've
SSH'ed twice. If the former, just change the *first* instance of 4713 to
a random number of your choice (>1024).

5. On this remote machine, check your cookie is available via the xprop
command show in step 2. If X11 forwarding is working properly, it should
show up fine.

6. Set the PULSE_SERVER variable to the forwarded tunnel port.
 export PULSE_SERVER=localhost:4713
(or the port number you picked in step 4 if different)

7. Confirm it's all working: PULSE_LOG=99 pactl stat


Done!!

So in this setup, the cookie used for authentication is forwarded
automatically via piggy backing on to X11 connections but as you cannot
connect directly to the machine we've had to override the PULSE_SERVER
variable to go over the SSH tunnel.

Below is the output from my session where I run these exact commands
(note the host name in the pactl stat at the end).

HTHs

Col


[colin at jimmy ~]$ hostname
jimmy
[colin at jimmy ~]$ xprop -root | grep PULSE_COOKIE
PULSE_COOKIE(STRING) = "71eb0d3d53819c42957ce9......"
[colin at jimmy ~]$ pacmd list-modules | grep module-native-protocol-tcp
	name: <module-native-protocol-tcp>
[colin at jimmy ~]$ ssh -X -R 5555:localhost:4713 mediacentre
Last login: Sat May 21 18:51:40 2011 from jimmy.local
[media@(Media)centre ~]$ xprop -root | grep PULSE_COOKIE
PULSE_COOKIE(STRING) = "71eb0d3d53819c42957ce9......"
[media@(Media)centre ~]$ export PULSE_SERVER=localhost:5555
[media@(Media)centre ~]$ PULSE_LOG=99 pactl stat
Using shared memory pool with 1024 slots of size 64.0 KiB each, total
size is 64.0 MiB, maximum usable slot size is 65496
Trying to connect to localhost:5555...
SHM possible: no
Protocol version: remote 21, local 16
Negotiated SHM: no
Currently in use: 2 blocks containing 149.9 KiB bytes total.
Allocated during whole lifetime: 1220055 blocks containing 1.6 GiB bytes
total.
Sample cache size: 86.0 KiB
User name: colin
Host Name: jimmy
Server Name: pulseaudio
Server Version: 1.0.0-0.354.1.csg1
Default Sample Specification: s16le 2ch 44100Hz
Default Channel Map: front-left,front-right
Default Sink: alsa_output.pci-0000_00_1b.0.analog-stereo
Default Source: alsa_input.pci-0000_00_1b.0.analog-stereo
Cookie: d7756be2
[media@(Media)centre ~]$



-- 

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
  Mageia Contributor [http://www.mageia.org/]
  PulseAudio Hacker [http://www.pulseaudio.org/]
  Trac Hacker [http://trac.edgewall.org/]




[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux