Skip to content

Audio Output Virtual Channel support in xrdp

Idan Freiberg edited this page Jun 27, 2016 · 8 revisions

Audio Output Virtual Channel support in xrdp

xrdp support audio output (= server to client) redirection using PulseAudio, which is a sound system for Linux systems.

Here is how to build an xrdp sink module for your distro Pulse Audio, so you can have audio support through xrdp.

Building xrdp sink module for PulseAudio

First we need to build xrdp pulse sink for your distro.

You need to build this using the pulseaudio source code. (We don't need to install pulse from source, we just need the source code for the structures and header)

To get the source code for your distro, first make sure you have pulse installed:
Check by runing pulseaudio –version at the command prompt.

browse http://freedesktop.org/software/pulseaudio/releases/ and grab the closes version to what you have.

Examples

Debian 6
jay@system76-x86:~$ pulseaudio --version
pulseaudio 0.9.21-rebootstrapped-dirty

From this I know to download pulseaudio-0.9.21.tar.gz

Debian 7
jay@system76-x86:~$ pulseaudio --version
pulseaudio 2.0

From this I know to download pulseaudio-2.0.tar.gz

CentOS 6.4
[speidy@centos ~]$ pulseaudio --version
pulseaudio 0.9.21

From this I know to download pulseaudio-0.9.21.tar.gz

extract and cd into pulseaudio source dir, then run

./configure

Note: to get ./configure on pulse source to run, you might need to install:

for Debian system
apt-get install libjson0-dev
apt-get install libsndfile1-dev
apt-get install libspeex-dev
apt-get install libspeexdsp-dev
for RHEL/CentOS system
yum install libtool-ltdl-devel intltool libsndfile-devel speex-devel

Once you get ./configure to run, you are done with this part. You don't need to actually build the downloaded pulse audio.

Now, cd into xrdp/sesman/chansrv/pulse
You need to edit the Makefile in order to build the pulse sink.
Edit PULSE_DIR at the top of the file to point to pulseaudio source directory you extracted to above.
Then run make.
Then copy the file to pulseaudio system modules directory on your system:
for example: /usr/lib/pulse-2.0/modules/
or whatever your version is.

Configure pulseaudio to use xrdp sink

  • This part is handled automatically when you build xrdp from source now, but i'll explain how it works so people can better understand the whole picture.

When pulseaudio runs it looks for a config file called default.pa (placed in /etc/pulse/default.pa by default).
default.pa instructs PulesAudio which sinks/sources to load for the sound session.

when youre conncected to an xrdp session, you want xrdp sink to be loaded, otherwise you might want to use your system sinks (speakers, etc.)

So in order to acheive that, xrdp-sesman sets an pulseaudio environment variable when xrdp session starts, which called PULSE_SCRIPT.

PULSE_SCRIPT points to xrdp's default.pa file (placed in /etc/xrdp/pulse/default.pa).

Clone this wiki locally