1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
|
The latest version of this document can be found at wiki.
* https://github.com/neutrinolabs/xrdp/wiki/How-to-set-up-audio-redirection
# Overview
xrdp supports audio redirection using PulseAudio, which is a sound system for
POSIX operating systems. Server to client redirection is compliant to Remote
Desktop Procol standard [[MS-RDPEA]](https://msdn.microsoft.com/en-us/library/cc240933.aspx)
but client to server redirection implementation is proprietary. Accordingly,
server to client redirection is available with many of RDP clients including
Microsoft client but client to server redirection requires NeutrinoRDP client,
not available with other clients.
Here is how to build pulseaudio modules for your distro, so you can have audio
support through xrdp.
# Prerequisites
Prepare xrdp source in your home directory. Of course, you can choose another
directory.
cd ~
git clone https://github.com/neutrinolabs/xrdp.git
In this instruction, pulseaudio version is **10.0**. 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
# How to build
## Debian 9 / Ubuntu
This instruction also should be applicable to Ubuntu family.
### Prerequisites
Some build tools and package development tools are required. Make sure install
the tools.
apt install build-essential dpkg-dev
### Prepare & build
Install pulseaudio and requisite packages to build pulseaudio.
apt install pulseaudio
apt build-dep pulseaudio
Fetch the pulseaudio source . You'll see `pulseaudio-10.0` directory in your
current directory.
apt source pulseaudio
Enter into the directory and build the pulseaudio package.
cd pulseaudio-10.0
dpkg-buildpackage -rfakeroot -uc -b
Enter into pulse directory in xrdp source.
cd ~/xrdp/sesman/chansrv/pulse
nano Makefile
Edit the `Makefile`. Replace `/tmp/pulseaudio-10.0` with your pulseaudio source
directory.
```diff
diff --git a/sesman/chansrv/pulse/Makefile b/sesman/chansrv/pulse/Makefile
index 74977221..395ef0a0 100644
--- a/sesman/chansrv/pulse/Makefile
+++ b/sesman/chansrv/pulse/Makefile
@@ -3,7 +3,7 @@
#
# change this to your pulseaudio source directory
-PULSE_DIR = /tmp/pulseaudio-10.0
+PULSE_DIR = /home/debian/pulseaudio-10.0
CFLAGS = -Wall -O2 -I$(PULSE_DIR) -I$(PULSE_DIR)/src -DHAVE_CONFIG_H -fPIC
all: module-xrdp-sink.so module-xrdp-source.so
```
Finally, let's make. You'll have two .so files `module-xrdp-sink.so` and
`module-xrdp-source.so`.
make
## Other distro
First off, find out your pulseaudio version using `pulseaudio --version`
command. Download the tarball of the pulseaudio version that you have.
* https://freedesktop.org/software/pulseaudio/releases/
After downloading the tarball, extact the tarball and `cd` into the source
directory, then run `./configure`.
wget https://freedesktop.org/software/pulseaudio/releases/pulseaudio-10.0.tar.xz
tar xf pulseaudio-10.0.tar.gz
cd pulseaudio-10.0
./configure
If additional packages are required to run `./configure`, install requisite
packages depending on your environment.
Next, enter into pulse directory in xrdp source and replace `/tmp/pulseaudio-10.0`
in `Makefile` with your pulseaudio source directory.
cd ~/xrdp/sesman/chansrv/pulse
nano Makefile
Finally, let's make. You'll have two .so files `module-xrdp-sink.so` and
`module-xrdp-source.so`.
make
# Install
Install process is not distro specific except for install destination. Install
built two .so files into the pulseaudio modules directory. Typically,
`/usr/lib/pulse-10.0/modules` for Debian, `/usr/lib64/pulse-10.0/modules` for
CentOS 7. Other distro might have different path. Find out the right path for
your distro.
Look into the directory with `ls` command. You'll see lots of `module-*.so`
files. There's the place!
cd ~/xrdp/sesman/chansrv/pulse
for f in *.so; do install -s -m 644 $f /usr/lib/pulse-10.0/modules; done
This command is equivalent to following:
install -s -m 644 module-xrdp-sink.so /usr/lib/pulse-10.0/modules
install -s -m 644 module-xrdp-source.so /usr/lib/pulse-10.0/modules
Well done! Pulseaudio modules should be properly built and installed.
# 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.
|