Skip to content

Commit

Permalink
Merge pull request neutrinolabs#15 from metalefty/remove-xrdp-dependency
Browse files Browse the repository at this point in the history
Remove xrdp dependency
  • Loading branch information
metalefty committed Sep 4, 2018
2 parents 7bf2c41 + 389667c commit ce110ea
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .travis.centos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ SRC_DIR=${PWD}

cd /tmp
yum install -y epel-release
yum install -y xrdp xrdp-devel xrdp-selinux wget sudo
yum install -y wget sudo
yum install -y pulseaudio pulseaudio-libs pulseaudio-libs-devel
yum install -y rpmdevtools yum-utils
yum-builddep -y pulseaudio
Expand Down
2 changes: 1 addition & 1 deletion .travis.ubuntu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ cd /tmp
sed -i.bak -e 's|^# deb-src|deb-src|' /etc/apt/sources.list

apt update
apt install -y build-essential dpkg-dev libpulse-dev pulseaudio pkg-config xrdp
apt install -y build-essential dpkg-dev libpulse-dev pulseaudio pkg-config
apt install -y g++ clang

apt install -y pulseaudio
Expand Down
2 changes: 0 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ AC_PROG_LN_S
AC_PROG_MAKE_SET

# Checks for libraries.
PKG_CHECK_MODULES([XRDP], [xrdp >= 0.9.0])
AC_SUBST(XRDP_CFLAGS)
PKG_CHECK_MODULES([LIBPULSE], [libpulse])

m4_define([PULSE_MSG], [PULSE_DIR not specified. Follow the instructions in README.md.])
Expand Down
20 changes: 15 additions & 5 deletions src/module-xrdp-sink.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,6 @@
#include <pulsecore/thread-mq.h>
#include <pulsecore/rtpoll.h>

#include <xrdp_sockets.h>


/* defined in pulse/version.h */
#if PA_PROTOCOL_VERSION > 28
/* these used to be defined in pulsecore/macro.h */
Expand Down Expand Up @@ -297,6 +294,7 @@ static int lsend(int fd, char *data, int bytes) {
static int data_send(struct userdata *u, pa_memchunk *chunk) {
char *data;
char *socket_dir;
char *sink_socket;
int bytes;
int sent;
int fd;
Expand All @@ -318,9 +316,21 @@ static int data_send(struct userdata *u, pa_memchunk *chunk) {
{
socket_dir = "/tmp/.xrdp";
}
snprintf(s.sun_path, bytes, "%s/" CHANSRV_PORT_OUT_BASE_STR,
socket_dir, u->display_num);
sink_socket = getenv("XRDP_PULSE_SINK_SOCKET");
if (sink_socket == NULL || sink_socket[0] == '\0')
{
pa_log_debug("Could not obtain sink_socket from environment.");
/* usually it doesn't reach here. if the socket name is not given
via environment variable, use hardcoded name as fallback */
snprintf(sink_socket, bytes, "xrdp_chansrv_audio_out_socket_%d", u->display_num);
}
else
{
pa_log_debug("Obtained sink_socket from environment.");
}
snprintf(s.sun_path, bytes, "%s/%s", socket_dir, sink_socket);
pa_log_debug("trying to connect to %s", s.sun_path);

if (connect(fd, (struct sockaddr *)&s,
sizeof(struct sockaddr_un)) != 0) {
u->failed_connect_time = pa_rtclock_now();
Expand Down
20 changes: 15 additions & 5 deletions src/module-xrdp-source.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,6 @@
#include <pulsecore/thread-mq.h>
#include <pulsecore/thread.h>

#include <xrdp_sockets.h>


/* defined in pulse/version.h */
#if PA_PROTOCOL_VERSION > 28
/* these used to be defined in pulsecore/macro.h */
Expand Down Expand Up @@ -181,6 +178,7 @@ static int data_get(struct userdata *u, pa_memchunk *chunk) {
struct sockaddr_un s;
char *data;
char *socket_dir;
char *source_socket;
char buf[11];
unsigned char ubuf[10];

Expand All @@ -195,8 +193,20 @@ static int data_get(struct userdata *u, pa_memchunk *chunk) {
{
socket_dir = "/tmp/.xrdp";
}
snprintf(s.sun_path, bytes, "%s/" CHANSRV_PORT_IN_BASE_STR,
socket_dir, u->display_num);
source_socket = getenv("XRDP_PULSE_SINK_SOCKET");
if (source_socket == NULL || source_socket[0] == '\0')
{

pa_log("Could not obtain source_socket from environment.");
/* usually it doesn't reach here. if the socket name is not given
via environment variable, use hardcoded name as fallback */
snprintf(source_socket, bytes, "xrdp_chansrv_audio_in_socket_%d", u->display_num);
}
else
{
pa_log("Obtained sink_socket from environment.");
}
snprintf(s.sun_path, bytes, "%s/%s", socket_dir, source_socket);
pa_log_debug("Trying to connect to %s", s.sun_path);

if (connect(fd, (struct sockaddr *) &s, sizeof(struct sockaddr_un)) != 0) {
Expand Down

0 comments on commit ce110ea

Please sign in to comment.