You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

145 lines
4.4 KiB

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