Skip to content
matt335672 edited this page Oct 16, 2020 · 5 revisions

Build Status

The latest version of this document can be found at wiki.

Overview

xrdp implements Audio Output redirection using PulseAudio, which is a sound system used on POSIX operating systems.

The server to client audio redirection is implemented as per Remote Desktop Protocol: Audio Output Virtual Channel Extension [MS-RDPEA] specs, which means it is interoperable with any RDP client which implements it (most of them including: MS RDP clients, FreeRDP).

However, our Microphone redirection (client to server) implementation is proprietary and doesn't implement the [MS-RDPEAI] specs. Its only supported by the following clients so far: NeutrinoRDP client and rdesktop.

Here is how to build pulseaudio modules for your distro, so you can have audio support through xrdp.

In this instruction, pulseaudio version is 11.1. You need to replace the version number in this instruction if your environment has different versions. You can find out your pulseaudio version executing the following command:

pulseaudio --version

or

pkg-config --modversion libpulse

How to build

Debian 9 / Ubuntu

This instruction also should be applicable to the Ubuntu family.

It is assumed the user you are using has sudo access to install packages where required.

Prerequisites

Source repositories

You will need to install some source packages.

Edit /etc/apt/sources.list and make sure these two lines are uncommented:-

deb-src http://<path-to-mirror>/ <distro> main restricted
deb-src http://<path-to-mirror> <distro>-updates main restricted

Depending on your location and your exact operating system, <path-to-mirror> and <distro> will have different values.

After doing the above enter sudo apt update to load the contents of the new repositories.

Build and development tools

Some build tools and package development tools are required. Make sure these are installed:-

sudo apt install -y build-essential dpkg-dev libpulse-dev git

Prepare & build

Install pulseaudio and requisite packages to build pulseaudio.

sudo apt install pulseaudio
sudo apt build-dep pulseaudio

Create a fresh working directory, and fetch the pulseaudio source into it. The source will be created in a directory under the working directory:-

mkdir ~/src
cd ~/src
apt source pulseaudio

Enter into the new directory, save its name for later, and configure the pulseaudio package. Then move back to the working directory.

cd pulseaudio-*
PULSE_DIR=`pwd`
./configure
cd ..

Finally, let's fetch the source and build xrdp source / sink modules

git clone https://github.com/neutrinolabs/pulseaudio-module-xrdp.git
cd pulseaudio-module-xrdp
./bootstrap && ./configure PULSE_DIR=$PULSE_DIR
make

You'll have two .so files module-xrdp-sink.so and module-xrdp-source.so.

Notes

Ubuntu 18.04 with xrdp 0.9.5 will not have xrdp-sink device appear unless /etc/xrdp/pulse/default.pa is replaced with the following content:

.nofail
.fail
load-module module-augment-properties
load-module module-always-sink
.ifexists /usr/lib/pulse-11.1/modules/module-xrdp-sink.so
load-module /usr/lib/pulse-11.1/modules/module-xrdp-sink.so
.endif
.ifexists /usr/lib/pulse-11.1/modules/module-xrdp-source.so
load-module /usr/lib/pulse-11.1/modules/module-xrdp-source.so
.endif
load-module module-native-protocol-unix

Check your xrdp version sudo stdbuf -o0 xrdp -v | grep Version More information here - xrdp issue 1013.

CentOS 7.x (7.5 or later requires this build procedure)

Prerequisites

Some build tools and package development tools are required. Make sure install the tools.

yum groupinstall "Development Tools"
yum install rpmdevtools yum-utils
rpmdev-setuptree

Prepare & build

Install pulseaudio and requisite packages to build pulseaudio.

yum install pulseaudio pulseaudio-libs pulseaudio-libs-devel
yum-builddep pulseaudio

Fetch the pulseaudio source and extract. You'll see `~/rpmbuild/BUILD/

yumdownloader --source pulseaudio
rpm --install pulseaudio*.src.rpm

Build the pulseaudio source. In this phase, pulseaudio is not necessarily needed to be built but configured however there's no way to do only configure.

rpmbuild -bb --noclean ~/rpmbuild/SPECS/pulseaudio.spec

Finally, let's build xrdp source / sink modules. You'll have two .so files module-xrdp-sink.so and module-xrdp-source.so.

git clone https://github.com/neutrinolabs/pulseaudio-module-xrdp.git
cd pulseaudio-module-xrdp
./bootstrap && ./configure PULSE_DIR=~/rpmbuild/BUILD/pulseaudio-10.0
make

Other distro

First off, find out your pulseaudio version using pulseaudio --version command. Download the tarball of the pulseaudio version that you have.

After downloading the tarball, extract the tarball and cd into the source directory, then run ./configure.

wget https://freedesktop.org/software/pulseaudio/releases/pulseaudio-11.1.tar.xz
tar xf pulseaudio-11.1.tar.xz
cd pulseaudio-11.1
./configure

If additional packages are required to run ./configure, install requisite packages depending on your environment.

Finally, let's build xrdp source / sink modules. You'll have two .so files module-xrdp-sink.so and module-xrdp-source.so.

git clone https://github.com/neutrinolabs/pulseaudio-module-xrdp.git
cd pulseaudio-module-xrdp
./bootstrap && ./configure PULSE_DIR=/path/to/pulseaudio-11.1
make

Install

Just make install should install built modules to the correct directory.

You can confirm if the modules properly installed by following command:

ls $(pkg-config --variable=modlibexecdir libpulse)

If you can see lots of module-*.so and module-xrdp-sink.so, module-xrdp-source.so, PulseAudio modules should be properly built and installed.

module-xrdp-sink.la and module-xrdp-source.so may be installed to the target directory, these files are not necessary and you can remove them safely.

Enjoy!

See if it works

To see if it works, run pavumeter in the xrdp session. Playback any YouTube video in Firefox. You'll see "Showing signal levels of xrdp sink" and volume meter moving.