Audio Output Virtual Channel support in xrdp

metalefty edited this page Dec 25, 2017 · 8 revisions

NOTE: This document has been merged into the following document: https://github.com/neutrinolabs/xrdp/wiki/How-to-set-up-audio-redirection

This document is kept only for the record. Please refer the above document from now on.

Audio Output Virtual Channel support in xrdp

xrdp supports 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.

Note: We don't need to actually install pulseaudio 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 pulseaudio installed:

To find out what version of Pulseaudio your system's running execute the following comamnd:

$ pulseaudio –version

After you identify what version of Pulseaudio you have then browse to:

http://freedesktop.org/software/pulseaudio/releases/

Download the .tar.gz file of the Pulseaudio version that 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

After downloading the correct Pulseaudio source file for your system then extract the .tar.gz file 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.

Note: You don't need to actually build the downloaded pulse audio.

Next, cd into xrdp/sesman/chansrv/pulse

You need to edit the Makefile in that directory in order to build the pulse sink.

Edit PULSE_DIR at the top of the file to point to pulseaudio source directory that you extracted the above source code into above.

Then run make.

After 'make' is completed successfully you'll find an library called module-xrdp-sink.so in the directory where you ran make.

Copy that file to pulseaudio system modules directory on your system:

For example if you found your system is using Pulseaudio v8.0 then the directory you would copy the module-xrdp-sink.so to would be: /usr/lib/pulse-8.0/modules/

-or- whatever your system's Pulseaudio installed 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 PulseAudio which sinks/sources to load for the sound session.

When you are connected to an xrdp session, you want the xrdp sink to be loaded.

If you are not using xrdp then you would normally want to be using your default system sinks (speakers, etc.)

So when using xrdp, xrdp-sesman sets a pulseaudio environment variable when xrdp session starts.

That environment variable is called PULSE_SCRIPT.

The PULSE_SCRIPT environment variable will point to xrdp's own "default.pa" file.

PULSE_SCRIPT=/etc/xrdp/pulse/default.pa

You can find that default.pa file in /etc/xrdp/pulse/default.pa.

Note: the xrdp default.pa is separate/distinct from your linux system's /etc/pulse/default.pa configuration file.

You can’t perform that action at this time.
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.
Press h to open a hovercard with more details.