Configure audio over Xrdp on CentOS

These are the steps I took to configure Xrdp on CentOS to allow me to hear audio over Microsoft Remote Desktop on OSX. YMMV.

Install the pulseaudio-module-xrdp module using the instructions based on those provided by neutrinolabs with modifications that I needed to make it work on my install.

CentOS 8

Prerequisites

Xrdp needs to have been installed.

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

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

Prepare & build

Install pulseaudio and requisite packages to build pulseaudio.

Note: The powertools and okay repos needed to be added for yum-builddep. The okay repo was current at time of writing, you may need to update this.

Loading...
yum install pulseaudio pulseaudio-libs pulseaudio-libs-devel yum config-manager --set-enabled powertools rpm -ivh http://repo.okay.com.mx/centos/8/x86_64/release/okay-release-1-3.el8.noarch.rpm? yum-builddep pulseaudio

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

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

If the source download fails due to being unavailable, manually download the source rpm. Use the name that it says it failed to find and have a dig around for the source. I found the version I needed here, but you can dig further up the tree to see if you can find yours:

https://vault.centos.org/8.3.2011/AppStream/Source/SPackages/pulseaudio-13.99.1-1.el8.src.rpm

When executing rpm --install you might see:

Loading...
warning: user mockbuild does not exist - using root warning: group mockbuild does not exist - using root

It's okay, these are just warnings, it probably worked. You'll find out shortly.

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.

Loading...
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.

Loading...
git clone https://github.com/neutrinolabs/pulseaudio-module-xrdp.git cd pulseaudio-module-xrdp ./bootstrap && ./configure PULSE_DIR=~/rpmbuild/BUILD/pulseaudio-[YOUR VERSION] make

Install

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

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

Loading...
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.

Troubleshooting

  • Audio pitch is lower than it should be

    Modify /etc/pulse/daemon.conf, uncomment or add default-sample-rate = 44100

  • Choppy audio

    No actual solution set, unfortunately. YouTube playback is choppy, but straight audio playback is fine.

Additional Sources

Published December 23, 2020