xRDP – Sound Redirection Support for Pipewire Module

Hello World, 

In this post, we are revisiting our previous post (see xRDP – Testing Initial Pipewire Sound Rediretion Support in Ubuntu 22.10 (Early Stage)) about xRDP Sound redirection feature with the new Pipewire Sound Server.  Until recently, xRDP Sound redirection feature was only supported when PulseAudio Sound server was installed and present.  PulseAudio Server was the de facto sound server in most of the Linux Distributions. However,  Pipewire is becoming the new kid in town and more and more Linux Operating Systems are slowly moving away from Pulseaudio to Pipewire. 

The team behind the xRDP software has published  “recently” a new repository that host the necessary files and instructions to build the sound module compatible with Pipewire….

So, let’s quickly describe the new build process….  

Overview

In our previous posts (see xRDP – Testing Initial Pipewire Sound Rediretion Support in Ubuntu 22.10 (Early Stage)), we have wrote about a way to implement sound redirection when Pipewire was used.  Hiero, one of our  readers, has been working on this specific topic and has developed a solution to build up a specific Pipewire module for xRDP.     Hiero has published and shared all its findings with the xRDP team.  You can find out all the explanation and code by visiting this link.

We have discovered recently that the xRDP Team has created a specific repository to host the binaries and instructions to build Pipewire xrdp sound modules.  The xRDP team has taken and reviewed Hiero’s code, reworked it and is now available for use.  You can find more information and browse for the code at https://github.com/neutrinolabs/pipewire-module-xrdp

In this post, we will explain how to compile this new module and test sound redirection against Pipewire 

Disclaimer

These instructions are provided AS IS.  Use it at your own risk !!! 

Prerequisites and assumptions  

Since this module is still quite new, we have performed the compilation in our lab environment.  In order for you to get similar result, we assume the following 

  • We assume that your machine is connected to internet while performing the installation.  This is needed as additional packages and software needs to be downloaded and installed on your Ubuntu machine
  • This post applies only for Ubuntu 22.10 and later
  • Pipewire Sound server is installed (Ubuntu 22.10 and later ship with Pipewire by default !!!)
  • Pipewire versions 0.3.58 and later are supported.
  • You have already xRDP Software installed on your machine
  • We are using a Virtual machine to perform our test. The VM is running on top of Hyper-V server
  • All the files will be Downloaded in the ~/Downloads Folder

Step 1 – Download & Install Pre-requisites

In order to compile and download the sources files, you will first need to ensure that your Ubuntu machine (running Pipewire Sound Server) has all the necessary software and dependencies installed.  To ensure that you have all the necessary tools to perform this installation, you will first need to download and install the following packages.  

# Install build environment
sudo apt install git pkg-config autotools-dev libtool make gcc

Click on Picture for better Resolution

# Install dependencies 
sudo apt install libpipewire-0.3-dev libspa-0.2-dev

Click on Picture for better Resolution

You might get a prompt to confirm your choice.  Press Y to continue…

Step 2 – Download the source files 

To obtain the sources files to build your new Pipewire-xrdp module,  you will use the git client to clone the repo locally on your machine.  

cd ~/Downloads
git clone https://github.com/neutrinolabs/pipewire-module-xrdp.git --recursive

Click on Picture for better Resolution

Step 3 – Build and install the pipewire-xrdp module

To build & compile the module, you will simply open a terminal console and execute the following commands 

cd ~/Downloads/pipewire-module-xrdp
./bootstrap

Click on Picture for better Resolution

./configure

Click on Picture for better Resolution

make

Click on Picture for better Resolution

 sudo make install

Click on Picture for better Resolution

Monitor your screen to ensure that no fatal errors are thrown.   

Step 4 – Reboot your machine  & Test

To ensure that the module load properly,  we would recommend you to reboot your computer. However, usually a simple logoff/login process should allows the module to load in your session. 

Step 5 – Test & Validate your Installation 

You first need to ensure that nobody is logged on locally on the Ubuntu machine.  Then, you can perform your remote desktop connection against your Ubuntu machine. You will see the xRDP login screen.  Provide your credentials and you should see your Ubuntu Desktop.  To check if sound redirection is enabled, you will open the Settings App and go to sound Node.  If you see xrdp-sink and xrdp-source, this means that sound redirection has been successfully configured against your system  

Click on Picture for better Resolution

 

The ultimate test is to test the sound by using the built-in tools or better by browsing the internet and play a video or a music and play it on your remote session.   If everything works as expected, you will get sound redirection working.  In our test, we have to say that the in the beginning the sound is a little bit choppy but then sound quality is quite good (over LAN). No delays and no chopping sound… 

Final Notes

Voila ! Voila ! This is it for this post.   

We have shown here how to enable sound redirection when using Pipewire sound server while using the xRDP Software.  Compared to our previous post, we can see that the installation process has been streamlined and has been simplified.    Indeed,  The xRDP Team has made available in their GitHub a dedicated repository (see https://github.com/neutrinolabs/pipewire-module-xrdp) and they have published the necessary sources files and procedures that can be used to compile the pipewire-xrdp-module. 

We are really pleased to see that xRDP team took into account all the work and effort provided by Hiero and that his code has been integrated in their xRDP software solution… 🙂 

We are also happy to see that xRDP team has made this effort and that an “official” pipewire-xrdp-module is now available.  Indeed, more and more modern linux distribution are shipping Pipewire by default. So, this new pipewire module was really highly expected and requested and now it’s available. 

In the near future (based on our workload), we will try to include this code into our xrdp-installer script. This means that the script will be able to detect PulseAudio or Pipewire Sound server and compile the correct xrdp module… 

Stay Tuned 

Till next time 

See ya

5 thoughts on “xRDP – Sound Redirection Support for Pipewire Module

  1. Hi
    It seems doesn’t works in KDE kubuntu 22.04. Could you fix it?
    I have xrdp installed, next I installed pipewire_0.3.65, and then this module. But when I connected from windows mstsc there is now sound devices.

  2. @Chart41,

    Thank you for visiting our blog and providing feedback. Sorry for the late answer… So, first of all, we have written this post specifically for Ubuntu 22.10 which ships by default with Pipewire sound server…
    Kubuntu 22.04 is shipping Pulseaudio by default… So, since you have done a custom installation, not sure what could be the problem for you…. Things to check
    are you sure that your default sound server is set to pipewire and not pulseaudio ? have you uninstalled pulseaudio ?
    Have you checked that sound redirection and settings are set properly on your mstsc client ?
    We are guessing here that the pulseaudio is probably still present….

    Hope this help
    Till next time
    See ya

  3. @Griffon,

    Hi. I installed pipewire in 22.04
    I didn’t any other settings. How can I set it by default in 22.04?

  4. @Chart41,

    So ok. First we might want to confirm that you are still running pulseaudio and sound server… Run the pactl info from a terminal session, if you see server name : Pulseaudio or pulseaudio –version, yes, you are still running PulseAudio
    For your information, it’s possible to have sound redirection with xRDP and PulseAudio. You could give a try to our xrdp-installer script that automate the installation process.
    If you really want to use Pipewire, you will need to remove pulseaudio server. You can follow these nstructions (see https://ubuntuhandbook.org/index.php/2022/04/pipewire-replace-pulseaudio-ubuntu-2204/). You will need to reboot the server after removing pulseaudio. Fnally, login again to your machine and check that pipewire is the sound server…. Check using pactl info… You should see something like Server Name : PulseAudio (on Pipewire)

    Hope this help
    Till next time
    See ya

Leave a Reply