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.
Xrdp needs to have been installed.
Some build tools and package development tools are required. Make sure you install the tools.
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.
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
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:
rpm --install you might see:
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.
rpmbuild -bb --noclean ~/rpmbuild/SPECS/pulseaudio.spec
Finally, let's build Xrdp source / sink modules. You'll have two .so files
git clone https://github.com/neutrinolabs/pulseaudio-module-xrdp.git cd pulseaudio-module-xrdp ./bootstrap && ./configure PULSE_DIR=~/rpmbuild/BUILD/pulseaudio-[YOUR VERSION] make
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-xrdp-source.so, PulseAudio modules should be properly built and installed.
module-xrdp-source.so may be installed to the target directory, these files are not necessary and you can remove them safely.
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.
Audio pitch is lower than it should be
/etc/pulse/daemon.conf, uncomment or add
default-sample-rate = 44100
No actual solution set, unfortunately. YouTube playback is choppy, but straight audio playback is fine.