diff options
Diffstat (limited to 'sesman/chansrv/pulse')
-rw-r--r-- | sesman/chansrv/pulse/module-xrdp-sink.c | 28 | ||||
-rw-r--r-- | sesman/chansrv/pulse/module-xrdp-source.c | 22 |
2 files changed, 44 insertions, 6 deletions
diff --git a/sesman/chansrv/pulse/module-xrdp-sink.c b/sesman/chansrv/pulse/module-xrdp-sink.c index d56a4883..8606f412 100644 --- a/sesman/chansrv/pulse/module-xrdp-sink.c +++ b/sesman/chansrv/pulse/module-xrdp-sink.c @@ -58,6 +58,15 @@ #include <pulsecore/thread-mq.h> #include <pulsecore/rtpoll.h> +/* defined in pulse/version.h */ +#if PA_PROTOCOL_VERSION > 28 +/* these used to be defined in pulsecore/macro.h */ +typedef bool pa_bool_t; +#define FALSE ((pa_bool_t) 0) +#define TRUE (!FALSE) +#else +#endif + #include "module-xrdp-sink-symdef.h" PA_MODULE_AUTHOR("Jay Sorg"); @@ -268,6 +277,19 @@ static int get_display_num_from_display(char *display_text) { return display_num; } +static int lsend(int fd, char *data, int bytes) { + int sent = 0; + int error; + while (sent < bytes) { + error = send(fd, data + sent, bytes - sent, 0); + if (error < 1) { + return error; + } + sent += error; + } + return sent; +} + static int data_send(struct userdata *u, pa_memchunk *chunk) { char *data; int bytes; @@ -316,7 +338,7 @@ static int data_send(struct userdata *u, pa_memchunk *chunk) { h.code = 0; h.bytes = bytes + 8; - if (send(u->fd, &h, 8, 0) != 8) { + if (lsend(u->fd, (char*)(&h), 8) != 8) { pa_log("data_send: send failed"); close(u->fd); u->fd = 0; @@ -327,7 +349,7 @@ static int data_send(struct userdata *u, pa_memchunk *chunk) { data = (char*)pa_memblock_acquire(chunk->memblock); data += chunk->index; - sent = send(u->fd, data, bytes, 0); + sent = lsend(u->fd, data, bytes); pa_memblock_release(chunk->memblock); if (sent != bytes) { @@ -349,7 +371,7 @@ static int close_send(struct userdata *u) { } h.code = 1; h.bytes = 8; - if (send(u->fd, &h, 8, 0) != 8) { + if (lsend(u->fd, (char*)(&h), 8) != 8) { pa_log("close_send: send failed"); close(u->fd); u->fd = 0; diff --git a/sesman/chansrv/pulse/module-xrdp-source.c b/sesman/chansrv/pulse/module-xrdp-source.c index 2d7ec4fa..1c03b069 100644 --- a/sesman/chansrv/pulse/module-xrdp-source.c +++ b/sesman/chansrv/pulse/module-xrdp-source.c @@ -45,6 +45,15 @@ #include <pulsecore/thread-mq.h> #include <pulsecore/thread.h> +/* defined in pulse/version.h */ +#if PA_PROTOCOL_VERSION > 28 +/* these used to be defined in pulsecore/macro.h */ +typedef bool pa_bool_t; +#define FALSE ((pa_bool_t) 0) +#define TRUE (!FALSE) +#else +#endif + #include "module-xrdp-source-symdef.h" PA_MODULE_AUTHOR("Laxmikant Rashinkar"); @@ -329,8 +338,7 @@ int pa__init(pa_module *m) { pa_source_new_data_set_name(&data, pa_modargs_get_value(ma, "source_name", DEFAULT_SOURCE_NAME)); pa_source_new_data_set_sample_spec(&data, &ss); pa_source_new_data_set_channel_map(&data, &map); - //pa_proplist_sets(data.proplist, PA_PROP_DEVICE_DESCRIPTION, pa_modargs_get_value(ma, "description", "Null Input")); - pa_proplist_sets(data.proplist, PA_PROP_DEVICE_DESCRIPTION, pa_modargs_get_value(ma, "description", "xrdp Input")); + pa_proplist_sets(data.proplist, PA_PROP_DEVICE_DESCRIPTION, pa_modargs_get_value(ma, "description", "xrdp source")); pa_proplist_sets(data.proplist, PA_PROP_DEVICE_CLASS, "abstract"); u->source = pa_source_new(m->core, &data, PA_SOURCE_LATENCY | PA_SOURCE_DYNAMIC_LATENCY); @@ -361,7 +369,15 @@ int pa__init(pa_module *m) { u->source->thread_info.max_rewind = pa_usec_to_bytes(u->block_usec, &u->source->sample_spec); - if (!(u->thread = pa_thread_new("null-source", thread_func, u))) { + #if defined(PA_CHECK_VERSION) + #if PA_CHECK_VERSION(0, 9, 22) + if (!(u->thread = pa_thread_new("xrdp-source", thread_func, u))) { + #else + if (!(u->thread = pa_thread_new(thread_func, u))) { + #endif + #else + if (!(u->thread = pa_thread_new(thread_func, u))) + #endif pa_log("Failed to create thread."); goto fail; } |