From 82b7ccae96b08d54e81d62c2f31525c9d7773f24 Mon Sep 17 00:00:00 2001 From: Laxmikant Rashinkar Date: Sun, 12 Jan 2014 12:09:15 -0800 Subject: [PATCH] we now load module-xrdp-sink/source automatically so user's dont have to mess around with configuring /etc/pulse/default.pa config file --- configure.ac | 15 ++ sesman/chansrv/Makefile.am | 5 + sesman/chansrv/pulse/module-xrdp-sink.c | 2 +- sesman/chansrv/pulse/module-xrdp-source.c | 2 +- sesman/chansrv/pulse/pulse-notes.ubuntu.txt | 31 ++-- sesman/chansrv/sound.c | 170 ++++++++++++++++++++ sesman/chansrv/sound.h | 1 + 7 files changed, 203 insertions(+), 23 deletions(-) diff --git a/configure.ac b/configure.ac index 6c0134e6..07d61cd2 100644 --- a/configure.ac +++ b/configure.ac @@ -43,14 +43,22 @@ AC_ARG_ENABLE(tjpeg, AS_HELP_STRING([--enable-tjpeg], [Build turbo jpeg module(assumes /opt/libjpeg-turbo) (default: no)]), [tjpeg=true], [tjpeg=false]) AM_CONDITIONAL(XRDP_TJPEG, [test x$tjpeg = xtrue]) + AC_ARG_ENABLE(simplesound, AS_HELP_STRING([--enable-simplesound], [Build simple pulse audio interface (default: no)]), [simplesound=true], [simplesound=false]) AM_CONDITIONAL(XRDP_SIMPLESOUND, [test x$simplesound = xtrue]) + AC_ARG_ENABLE(fuse, AS_HELP_STRING([--enable-fuse], [Build fuse(clipboard file / drive redir) (default: no)]), [fuse=true], [fuse=false]) AM_CONDITIONAL(XRDP_FUSE, [test x$fuse = xtrue]) + +AC_ARG_ENABLE(load_pulse_modules, AS_HELP_STRING([--enable-load_pulse_modules], + [Build code to load pulse audio modules (default: no)]), + [load_pulse_modules=true], [load_pulse_modules=false]) +AM_CONDITIONAL(XRDP_LOAD_PULSE_MODULES, [test x$load_pulse_modules = xtrue]) + AC_ARG_ENABLE(xrdpvr, AS_HELP_STRING([--enable-xrdpvr], [Build xrdpvr module (default: no)]), [xrdpvr=true], [xrdpvr=false]) @@ -105,6 +113,13 @@ then [#define _FILE_OFFSET_BITS 64]) fi +# checking for libpulse +if ! test -z "$enable_load_pulse_modules" +then + AC_CHECK_HEADER([pulse/util.h], [], + [AC_MSG_ERROR([please install libpulse-dev or libpulse-devel])]) +fi + # checking for libpulse libpulse-simple if ! test -z "$enable_simplesound" then diff --git a/sesman/chansrv/Makefile.am b/sesman/chansrv/Makefile.am index 2d73f05c..9aa3ebe7 100644 --- a/sesman/chansrv/Makefile.am +++ b/sesman/chansrv/Makefile.am @@ -26,6 +26,11 @@ EXTRA_DEFINES += -DXRDP_FUSE EXTRA_LIBS += -lfuse endif +if XRDP_LOAD_PULSE_MODULES +EXTRA_DEFINES += -DXRDP_LOAD_PULSE_MODULES +EXTRA_LIBS += -lpulse +endif + AM_CFLAGS = \ -DXRDP_CFG_PATH=\"${sysconfdir}/xrdp\" \ -DXRDP_SBIN_PATH=\"${sbindir}\" \ diff --git a/sesman/chansrv/pulse/module-xrdp-sink.c b/sesman/chansrv/pulse/module-xrdp-sink.c index eb7211a0..d56a4883 100644 --- a/sesman/chansrv/pulse/module-xrdp-sink.c +++ b/sesman/chansrv/pulse/module-xrdp-sink.c @@ -72,7 +72,7 @@ PA_MODULE_USAGE( "channels= " "channel_map="); -#define DEFAULT_SINK_NAME "xrdp" +#define DEFAULT_SINK_NAME "xrdp-sink" #define BLOCK_USEC 30000 //#define BLOCK_USEC (PA_USEC_PER_SEC * 2) #define CHANSRV_PORT_STR "/tmp/.xrdp/xrdp_chansrv_audio_out_socket_%d" diff --git a/sesman/chansrv/pulse/module-xrdp-source.c b/sesman/chansrv/pulse/module-xrdp-source.c index 2d85ad44..2d7ec4fa 100644 --- a/sesman/chansrv/pulse/module-xrdp-source.c +++ b/sesman/chansrv/pulse/module-xrdp-source.c @@ -60,7 +60,7 @@ PA_MODULE_USAGE( "description= " "latency_time="); -#define DEFAULT_SOURCE_NAME "xrdp" +#define DEFAULT_SOURCE_NAME "xrdp-source" #define DEFAULT_LATENCY_TIME 10 #define MAX_LATENCY_USEC (PA_USEC_PER_SEC * 2) #define CHANSRV_PORT_STR "/tmp/.xrdp/xrdp_chansrv_audio_in_socket_%d" diff --git a/sesman/chansrv/pulse/pulse-notes.ubuntu.txt b/sesman/chansrv/pulse/pulse-notes.ubuntu.txt index 51fc5060..053a0022 100644 --- a/sesman/chansrv/pulse/pulse-notes.ubuntu.txt +++ b/sesman/chansrv/pulse/pulse-notes.ubuntu.txt @@ -1,4 +1,8 @@ +-------------------------------------- + Building pulseaudio modules for xrdp +-------------------------------------- + o append the following line to /etc/apt/sources.list deb-src http://archive.ubuntu.com/ubuntu/ precise-updates main restricted universe multiverse @@ -45,31 +49,16 @@ o sudo cp module-xrdp-sink.so /usr/lib/pulse-/modules sudo cp module-xrdp-source.so /usr/lib/pulse-/modules note: on a 64bit machine use lib64 instead of lib -o cd /etc/pulse +-------------------------------------- + To test sound/microphone redirection +-------------------------------------- -o sudo mv default.pa default.pa.orig - -o sudo vi default.pa and add the following lines to it - -.nofail -.fail -load-module module-augment-properties -#load-module module-alsa-sink device=hw:0 -#load-module module-alsa-source device=hw:0 -#load-module module-pipe-sink -#load-module module-pipe-source -#load-module module-null-sink -load-module module-xrdp-sink -load-module module-xrdp-source -load-module module-native-protocol-unix -#load-module module-udev-detect tsched=0 - -o sudo apt-get install pavucontrol - -o pulseaudio --kill +o install gnome sound recorder or your favorite sound recorder o mplayer -ao pulse