Browse Source

work on pulse sink, added close message

pull/1/head
Jay Sorg 11 years ago
parent
commit
6b31f0908c
1 changed files with 25 additions and 0 deletions
  1. +25
    -0
      module-xrdp-sink.c

+ 25
- 0
module-xrdp-sink.c View File

@ -108,6 +108,8 @@ static const char* const valid_modargs[] = {
NULL NULL
}; };
static int close_send(struct userdata *u);
static int sink_process_msg(pa_msgobject *o, int code, void *data, static int sink_process_msg(pa_msgobject *o, int code, void *data,
int64_t offset, pa_memchunk *chunk) { int64_t offset, pa_memchunk *chunk) {
@ -141,6 +143,7 @@ static int sink_process_msg(pa_msgobject *o, int code, void *data,
u->timestamp = pa_rtclock_now(); u->timestamp = pa_rtclock_now();
} else { } else {
pa_log("sink_process_msg: not running"); pa_log("sink_process_msg: not running");
close_send(u);
} }
break; break;
@ -330,6 +333,28 @@ static int data_send(struct userdata *u, pa_memchunk *chunk) {
return sent; return sent;
} }
static int close_send(struct userdata *u) {
struct header h;
pa_log("close_send:");
if (u->fd == 0) {
return 0;
}
h.code = 1;
h.bytes = 8;
if (send(u->fd, &h, 8, 0) != 8) {
pa_log("close_send: send failed");
close(u->fd);
u->fd = 0;
return 0;
} else {
//pa_log("close_send: sent header ok");
}
return 8;
}
static void process_render(struct userdata *u, pa_usec_t now) { static void process_render(struct userdata *u, pa_usec_t now) {
pa_memchunk chunk; pa_memchunk chunk;
int request_bytes; int request_bytes;


Loading…
Cancel
Save