]> code.delx.au - pulseaudio/blob - polyp/module-tunnel.c
some updates for pa_hashmap
[pulseaudio] / polyp / module-tunnel.c
1 /* $Id$ */
2
3 /***
4 This file is part of polypaudio.
5
6 polypaudio is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published
8 by the Free Software Foundation; either version 2 of the License,
9 or (at your option) any later version.
10
11 polypaudio is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with polypaudio; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19 USA.
20 ***/
21
22 #ifdef HAVE_CONFIG_H
23 #include <config.h>
24 #endif
25
26 #include <unistd.h>
27 #include <assert.h>
28 #include <string.h>
29 #include <errno.h>
30 #include <sys/types.h>
31 #include <regex.h>
32 #include <stdio.h>
33 #include <stdlib.h>
34
35 #include "module.h"
36 #include "util.h"
37 #include "modargs.h"
38 #include "log.h"
39 #include "subscribe.h"
40 #include "xmalloc.h"
41 #include "sink-input.h"
42 #include "pdispatch.h"
43 #include "pstream.h"
44 #include "pstream-util.h"
45 #include "authkey.h"
46 #include "socket-client.h"
47 #include "socket-util.h"
48
49 #ifdef TUNNEL_SINK
50 #include "module-tunnel-sink-symdef.h"
51 PA_MODULE_DESCRIPTION("Tunnel module for sinks")
52 PA_MODULE_USAGE("server=<filename> sink=<remote sink name> cookie=<filename> format=<sample format> channels=<number of channels> rate=<sample rate> sink_name=<name for the local sink>")
53 #else
54 #include "module-tunnel-source-symdef.h"
55 PA_MODULE_DESCRIPTION("Tunnel module for sources")
56 PA_MODULE_USAGE("server=<filename> source=<remote source name> cookie=<filename> format=<sample format> channels=<number of channels> rate=<sample rate> source_name=<name for the local source>")
57 #endif
58
59 PA_MODULE_AUTHOR("Lennart Poettering")
60 PA_MODULE_VERSION(PACKAGE_VERSION)
61
62 #define DEFAULT_SINK_NAME "tunnel"
63 #define DEFAULT_SOURCE_NAME "tunnel"
64
65 #define DEFAULT_TLENGTH (44100*2*2/10) //(10240*8)
66 #define DEFAULT_MAXLENGTH ((DEFAULT_TLENGTH*3)/2)
67 #define DEFAULT_MINREQ 512
68 #define DEFAULT_PREBUF (DEFAULT_TLENGTH-DEFAULT_MINREQ)
69 #define DEFAULT_FRAGSIZE 1024
70
71 #define DEFAULT_TIMEOUT 5
72
73 #define LATENCY_INTERVAL 10
74
75 static const char* const valid_modargs[] = {
76 "server",
77 "cookie",
78 "format",
79 "channels",
80 "rate",
81 #ifdef TUNNEL_SINK
82 "sink_name",
83 "sink",
84 #else
85 "source_name",
86 "source",
87 #endif
88 NULL,
89 };
90
91 static void command_stream_killed(struct pa_pdispatch *pd, uint32_t command, uint32_t tag, struct pa_tagstruct *t, void *userdata);
92
93 #ifdef TUNNEL_SINK
94 static void command_request(struct pa_pdispatch *pd, uint32_t command, uint32_t tag, struct pa_tagstruct *t, void *userdata);
95 #endif
96
97 static const struct pa_pdispatch_command command_table[PA_COMMAND_MAX] = {
98 #ifdef TUNNEL_SINK
99 [PA_COMMAND_REQUEST] = { command_request },
100 #endif
101 [PA_COMMAND_PLAYBACK_STREAM_KILLED] = { command_stream_killed },
102 [PA_COMMAND_RECORD_STREAM_KILLED] = { command_stream_killed },
103 };
104
105 struct userdata {
106 struct pa_socket_client *client;
107 struct pa_pstream *pstream;
108 struct pa_pdispatch *pdispatch;
109
110 char *server_name;
111 #ifdef TUNNEL_SINK
112 char *sink_name;
113 struct pa_sink *sink;
114 uint32_t requested_bytes;
115 #else
116 char *source_name;
117 struct pa_source *source;
118 #endif
119
120 struct pa_module *module;
121 struct pa_core *core;
122
123 uint8_t auth_cookie[PA_NATIVE_COOKIE_LENGTH];
124
125 uint32_t ctag;
126 uint32_t device_index;
127 uint32_t channel;
128
129 pa_usec_t host_latency;
130
131 struct pa_time_event *time_event;
132 };
133
134
135 static void close_stuff(struct userdata *u) {
136 if (u->pstream) {
137 pa_pstream_close(u->pstream);
138 pa_pstream_unref(u->pstream);
139 u->pstream = NULL;
140 }
141
142 if (u->pdispatch) {
143 pa_pdispatch_unref(u->pdispatch);
144 u->pdispatch = NULL;
145 }
146
147 if (u->client) {
148 pa_socket_client_unref(u->client);
149 u->client = NULL;
150 }
151
152 #ifdef TUNNEL_SINK
153 if (u->sink) {
154 pa_sink_disconnect(u->sink);
155 pa_sink_unref(u->sink);
156 u->sink = NULL;
157 }
158 #else
159 if (u->source) {
160 pa_source_disconnect(u->source);
161 pa_source_unref(u->source);
162 u->source = NULL;
163 }
164 #endif
165
166 if (u->time_event) {
167 u->core->mainloop->time_free(u->time_event);
168 u->time_event = NULL;
169 }
170 }
171
172 static void die(struct userdata *u) {
173 assert(u);
174 close_stuff(u);
175 pa_module_unload_request(u->module);
176 }
177
178 static void command_stream_killed(struct pa_pdispatch *pd, uint32_t command, uint32_t tag, struct pa_tagstruct *t, void *userdata) {
179 struct userdata *u = userdata;
180 assert(pd && t && u && u->pdispatch == pd);
181
182 pa_log(__FILE__": stream killed\n");
183 die(u);
184 }
185
186 #ifdef TUNNEL_SINK
187 static void send_prebuf_request(struct userdata *u) {
188 struct pa_tagstruct *t;
189
190 t = pa_tagstruct_new(NULL, 0);
191 pa_tagstruct_putu32(t, PA_COMMAND_PREBUF_PLAYBACK_STREAM);
192 pa_tagstruct_putu32(t, u->ctag++);
193 pa_tagstruct_putu32(t, u->channel);
194 pa_pstream_send_tagstruct(u->pstream, t);
195 }
196
197 static void send_bytes(struct userdata *u) {
198 assert(u);
199
200 if (!u->pstream)
201 return;
202
203 while (u->requested_bytes > 0) {
204 struct pa_memchunk chunk;
205 if (pa_sink_render(u->sink, u->requested_bytes, &chunk) < 0) {
206
207
208 if (u->requested_bytes >= DEFAULT_TLENGTH-DEFAULT_PREBUF)
209 send_prebuf_request(u);
210
211 return;
212 }
213
214 pa_pstream_send_memblock(u->pstream, u->channel, 0, &chunk);
215 pa_memblock_unref(chunk.memblock);
216
217 if (chunk.length > u->requested_bytes)
218 u->requested_bytes = 0;
219 else
220 u->requested_bytes -= chunk.length;
221 }
222 }
223
224 static void command_request(struct pa_pdispatch *pd, uint32_t command, uint32_t tag, struct pa_tagstruct *t, void *userdata) {
225 struct userdata *u = userdata;
226 uint32_t bytes, channel;
227 assert(pd && command == PA_COMMAND_REQUEST && t && u && u->pdispatch == pd);
228
229 if (pa_tagstruct_getu32(t, &channel) < 0 ||
230 pa_tagstruct_getu32(t, &bytes) < 0 ||
231 !pa_tagstruct_eof(t)) {
232 pa_log(__FILE__": invalid protocol reply\n");
233 die(u);
234 return;
235 }
236
237 if (channel != u->channel) {
238 pa_log(__FILE__": recieved data for invalid channel\n");
239 die(u);
240 return;
241 }
242
243 u->requested_bytes += bytes;
244 send_bytes(u);
245 }
246
247 #endif
248
249 static void stream_get_latency_callback(struct pa_pdispatch *pd, uint32_t command, uint32_t tag, struct pa_tagstruct *t, void *userdata) {
250 struct userdata *u = userdata;
251 pa_usec_t buffer_usec, sink_usec, source_usec, transport_usec;
252 int playing;
253 uint32_t queue_length;
254 struct timeval local, remote, now;
255 assert(pd && u && t);
256
257 if (command != PA_COMMAND_REPLY) {
258 if (command == PA_COMMAND_ERROR)
259 pa_log(__FILE__": failed to get latency.\n");
260 else
261 pa_log(__FILE__": protocol error.\n");
262 die(u);
263 return;
264 }
265
266 if (pa_tagstruct_get_usec(t, &buffer_usec) < 0 ||
267 pa_tagstruct_get_usec(t, &sink_usec) < 0 ||
268 pa_tagstruct_get_usec(t, &source_usec) < 0 ||
269 pa_tagstruct_get_boolean(t, &playing) < 0 ||
270 pa_tagstruct_getu32(t, &queue_length) < 0 ||
271 pa_tagstruct_get_timeval(t, &local) < 0 ||
272 pa_tagstruct_get_timeval(t, &remote) < 0 ||
273 !pa_tagstruct_eof(t)) {
274 pa_log(__FILE__": invalid reply.\n");
275 die(u);
276 return;
277 }
278
279 gettimeofday(&now, NULL);
280
281 if (pa_timeval_cmp(&local, &remote) < 0 && pa_timeval_cmp(&remote, &now)) {
282 /* local and remote seem to have synchronized clocks */
283 #ifdef TUNNEL_SINK
284 transport_usec = pa_timeval_diff(&remote, &local);
285 #else
286 transport_usec = pa_timeval_diff(&now, &remote);
287 #endif
288 } else
289 transport_usec = pa_timeval_diff(&now, &local)/2;
290
291 #ifdef TUNNEL_SINK
292 u->host_latency = sink_usec + transport_usec;
293 #else
294 u->host_latency = source_usec + transport_usec;
295 if (u->host_latency > sink_usec)
296 u->host_latency -= sink_usec;
297 else
298 u->host_latency = 0;
299 #endif
300
301 /* pa_log(__FILE__": estimated host latency: %0.0f usec\n", (double) u->host_latency); */
302 }
303
304 static void request_latency(struct userdata *u) {
305 struct pa_tagstruct *t;
306 struct timeval now;
307 uint32_t tag;
308 assert(u);
309
310 t = pa_tagstruct_new(NULL, 0);
311 #ifdef TUNNEL_SINK
312 pa_tagstruct_putu32(t, PA_COMMAND_GET_PLAYBACK_LATENCY);
313 #else
314 pa_tagstruct_putu32(t, PA_COMMAND_GET_RECORD_LATENCY);
315 #endif
316 pa_tagstruct_putu32(t, tag = u->ctag++);
317 pa_tagstruct_putu32(t, u->channel);
318
319 gettimeofday(&now, NULL);
320 pa_tagstruct_put_timeval(t, &now);
321
322 pa_pstream_send_tagstruct(u->pstream, t);
323 pa_pdispatch_register_reply(u->pdispatch, tag, DEFAULT_TIMEOUT, stream_get_latency_callback, u);
324 }
325
326 static void create_stream_callback(struct pa_pdispatch *pd, uint32_t command, uint32_t tag, struct pa_tagstruct *t, void *userdata) {
327 struct userdata *u = userdata;
328 assert(pd && u && u->pdispatch == pd);
329
330 if (command != PA_COMMAND_REPLY) {
331 if (command == PA_COMMAND_ERROR)
332 pa_log(__FILE__": failed to create stream.\n");
333 else
334 pa_log(__FILE__": protocol error.\n");
335 die(u);
336 return;
337 }
338
339 if (pa_tagstruct_getu32(t, &u->channel) < 0 ||
340 pa_tagstruct_getu32(t, &u->device_index) < 0 ||
341 #ifdef TUNNEL_SINK
342 pa_tagstruct_getu32(t, &u->requested_bytes) < 0 ||
343 #endif
344 !pa_tagstruct_eof(t)) {
345 pa_log(__FILE__": invalid reply.\n");
346 die(u);
347 return;
348 }
349
350 request_latency(u);
351 #ifdef TUNNEL_SINK
352 send_bytes(u);
353 #endif
354 }
355
356 static void setup_complete_callback(struct pa_pdispatch *pd, uint32_t command, uint32_t tag, struct pa_tagstruct *t, void *userdata) {
357 struct userdata *u = userdata;
358 struct pa_tagstruct *reply;
359 char name[256], un[128], hn[128];
360 assert(pd && u && u->pdispatch == pd);
361
362 if (command != PA_COMMAND_REPLY || !pa_tagstruct_eof(t)) {
363 if (command == PA_COMMAND_ERROR)
364 pa_log(__FILE__": failed to authenticate\n");
365 else
366 pa_log(__FILE__": protocol error.\n");
367 die(u);
368 return;
369 }
370 #ifdef TUNNEL_SINK
371 snprintf(name, sizeof(name), "Tunnel from host '%s', user '%s', sink '%s'",
372 pa_get_host_name(hn, sizeof(hn)),
373 pa_get_user_name(un, sizeof(un)),
374 u->sink->name);
375 #else
376 snprintf(name, sizeof(name), "Tunnel from host '%s', user '%s', source '%s'",
377 pa_get_host_name(hn, sizeof(hn)),
378 pa_get_user_name(un, sizeof(un)),
379 u->source->name);
380 #endif
381
382 reply = pa_tagstruct_new(NULL, 0);
383 pa_tagstruct_putu32(reply, PA_COMMAND_SET_CLIENT_NAME);
384 pa_tagstruct_putu32(reply, tag = u->ctag++);
385 pa_tagstruct_puts(reply, name);
386 pa_pstream_send_tagstruct(u->pstream, reply);
387 /* We ignore the server's reply here */
388
389 reply = pa_tagstruct_new(NULL, 0);
390 #ifdef TUNNEL_SINK
391 pa_tagstruct_putu32(reply, PA_COMMAND_CREATE_PLAYBACK_STREAM);
392 pa_tagstruct_putu32(reply, tag = u->ctag++);
393 pa_tagstruct_puts(reply, name);
394 pa_tagstruct_put_sample_spec(reply, &u->sink->sample_spec);
395 pa_tagstruct_putu32(reply, PA_INVALID_INDEX);
396 pa_tagstruct_puts(reply, u->sink_name);
397 pa_tagstruct_putu32(reply, DEFAULT_MAXLENGTH);
398 pa_tagstruct_put_boolean(reply, 0);
399 pa_tagstruct_putu32(reply, DEFAULT_TLENGTH);
400 pa_tagstruct_putu32(reply, DEFAULT_PREBUF);
401 pa_tagstruct_putu32(reply, DEFAULT_MINREQ);
402 pa_tagstruct_putu32(reply, PA_VOLUME_NORM);
403 #else
404 pa_tagstruct_putu32(reply, PA_COMMAND_CREATE_RECORD_STREAM);
405 pa_tagstruct_putu32(reply, tag = u->ctag++);
406 pa_tagstruct_puts(reply, name);
407 pa_tagstruct_put_sample_spec(reply, &u->source->sample_spec);
408 pa_tagstruct_putu32(reply, PA_INVALID_INDEX);
409 pa_tagstruct_puts(reply, u->source_name);
410 pa_tagstruct_putu32(reply, DEFAULT_MAXLENGTH);
411 pa_tagstruct_put_boolean(reply, 0);
412 pa_tagstruct_putu32(reply, DEFAULT_FRAGSIZE);
413 #endif
414
415 pa_pstream_send_tagstruct(u->pstream, reply);
416 pa_pdispatch_register_reply(u->pdispatch, tag, DEFAULT_TIMEOUT, create_stream_callback, u);
417 }
418
419 static void pstream_die_callback(struct pa_pstream *p, void *userdata) {
420 struct userdata *u = userdata;
421 assert(p && u);
422
423 pa_log(__FILE__": stream died.\n");
424 die(u);
425 }
426
427
428 static void pstream_packet_callback(struct pa_pstream *p, struct pa_packet *packet, void *userdata) {
429 struct userdata *u = userdata;
430 assert(p && packet && u);
431
432 if (pa_pdispatch_run(u->pdispatch, packet, u) < 0) {
433 pa_log(__FILE__": invalid packet\n");
434 die(u);
435 }
436 }
437
438 #ifndef TUNNEL_SINK
439 static void pstream_memblock_callback(struct pa_pstream *p, uint32_t channel, uint32_t delta, const struct pa_memchunk *chunk, void *userdata) {
440 struct userdata *u = userdata;
441 assert(p && chunk && u);
442
443 if (channel != u->channel) {
444 pa_log(__FILE__": recieved memory block on bad channel.\n");
445 die(u);
446 return;
447 }
448
449 pa_source_post(u->source, chunk);
450 }
451 #endif
452
453 static void on_connection(struct pa_socket_client *sc, struct pa_iochannel *io, void *userdata) {
454 struct userdata *u = userdata;
455 struct pa_tagstruct *t;
456 uint32_t tag;
457 assert(sc && u && u->client == sc);
458
459 pa_socket_client_unref(u->client);
460 u->client = NULL;
461
462 if (!io) {
463 pa_log(__FILE__": connection failed.\n");
464 pa_module_unload_request(u->module);
465 return;
466 }
467
468 u->pstream = pa_pstream_new(u->core->mainloop, io, u->core->memblock_stat);
469 u->pdispatch = pa_pdispatch_new(u->core->mainloop, command_table, PA_COMMAND_MAX);
470
471 pa_pstream_set_die_callback(u->pstream, pstream_die_callback, u);
472 pa_pstream_set_recieve_packet_callback(u->pstream, pstream_packet_callback, u);
473 #ifndef TUNNEL_SINK
474 pa_pstream_set_recieve_memblock_callback(u->pstream, pstream_memblock_callback, u);
475 #endif
476
477 t = pa_tagstruct_new(NULL, 0);
478 pa_tagstruct_putu32(t, PA_COMMAND_AUTH);
479 pa_tagstruct_putu32(t, tag = u->ctag++);
480 pa_tagstruct_put_arbitrary(t, u->auth_cookie, sizeof(u->auth_cookie));
481 pa_pstream_send_tagstruct(u->pstream, t);
482 pa_pdispatch_register_reply(u->pdispatch, tag, DEFAULT_TIMEOUT, setup_complete_callback, u);
483
484 }
485
486 #ifdef TUNNEL_SINK
487 static void sink_notify(struct pa_sink*sink) {
488 struct userdata *u;
489 assert(sink && sink->userdata);
490 u = sink->userdata;
491
492 send_bytes(u);
493 }
494
495 static pa_usec_t sink_get_latency(struct pa_sink *sink) {
496 struct userdata *u;
497 uint32_t l;
498 pa_usec_t usec = 0;
499 assert(sink && sink->userdata);
500 u = sink->userdata;
501
502 l = DEFAULT_TLENGTH;
503
504 if (l > u->requested_bytes) {
505 l -= u->requested_bytes;
506 usec += pa_bytes_to_usec(l, &u->sink->sample_spec);
507 }
508
509 usec += u->host_latency;
510
511 return usec;
512 }
513 #else
514 static pa_usec_t source_get_latency(struct pa_source *source) {
515 struct userdata *u;
516 assert(source && source->userdata);
517 u = source->userdata;
518
519 return u->host_latency;
520 }
521 #endif
522
523 static void timeout_callback(struct pa_mainloop_api *m, struct pa_time_event*e, const struct timeval *tv, void *userdata) {
524 struct userdata *u = userdata;
525 struct timeval ntv;
526 assert(m && e && u);
527
528 request_latency(u);
529
530 gettimeofday(&ntv, NULL);
531 ntv.tv_sec += LATENCY_INTERVAL;
532 m->time_restart(e, &ntv);
533 }
534
535 int pa__init(struct pa_core *c, struct pa_module*m) {
536 struct pa_modargs *ma = NULL;
537 struct userdata *u = NULL;
538 struct pa_sample_spec ss;
539 struct timeval ntv;
540 assert(c && m);
541
542 if (!(ma = pa_modargs_new(m->argument, valid_modargs))) {
543 pa_log(__FILE__": failed to parse module arguments\n");
544 goto fail;
545 }
546
547 u = pa_xmalloc(sizeof(struct userdata));
548 m->userdata = u;
549 u->module = m;
550 u->core = c;
551 u->client = NULL;
552 u->pdispatch = NULL;
553 u->pstream = NULL;
554 u->server_name = NULL;
555 #ifdef TUNNEL_SINK
556 u->sink_name = pa_xstrdup(pa_modargs_get_value(ma, "sink", NULL));;
557 u->sink = NULL;
558 u->requested_bytes = 0;
559 #else
560 u->source_name = pa_xstrdup(pa_modargs_get_value(ma, "source", NULL));;
561 u->source = NULL;
562 #endif
563 u->ctag = 1;
564 u->device_index = u->channel = PA_INVALID_INDEX;
565 u->host_latency = 0;
566
567 if (pa_authkey_load_from_home(pa_modargs_get_value(ma, "cookie", PA_NATIVE_COOKIE_FILE), u->auth_cookie, sizeof(u->auth_cookie)) < 0) {
568 pa_log(__FILE__": failed to load cookie.\n");
569 goto fail;
570 }
571
572 if (!(u->server_name = pa_xstrdup(pa_modargs_get_value(ma, "server", NULL)))) {
573 pa_log(__FILE__": no server specified.\n");
574 goto fail;
575 }
576
577 ss = c->default_sample_spec;
578 if (pa_modargs_get_sample_spec(ma, &ss) < 0) {
579 pa_log(__FILE__": invalid sample format specification\n");
580 goto fail;
581 }
582
583 if (u->server_name[0] == '/')
584 u->client = pa_socket_client_new_unix(c->mainloop, u->server_name);
585 else {
586 size_t len;
587 struct sockaddr *sa;
588
589 if (!(sa = pa_resolve_server(u->server_name, &len, PA_NATIVE_DEFAULT_PORT))) {
590 pa_log(__FILE__": failed to resolve server '%s'\n", u->server_name);
591 goto fail;
592 }
593
594 u->client = pa_socket_client_new_sockaddr(c->mainloop, sa, len);
595 pa_xfree(sa);
596 }
597
598 if (!u->client)
599 goto fail;
600
601 pa_socket_client_set_callback(u->client, on_connection, u);
602
603 #ifdef TUNNEL_SINK
604 if (!(u->sink = pa_sink_new(c, pa_modargs_get_value(ma, "sink_name", DEFAULT_SINK_NAME), 0, &ss))) {
605 pa_log(__FILE__": failed to create sink.\n");
606 goto fail;
607 }
608
609 u->sink->notify = sink_notify;
610 u->sink->get_latency = sink_get_latency;
611 u->sink->userdata = u;
612 u->sink->description = pa_sprintf_malloc("Tunnel to '%s%s%s'", u->sink_name ? u->sink_name : "", u->sink_name ? "@" : "", u->server_name);
613
614 pa_sink_set_owner(u->sink, m);
615 #else
616 if (!(u->source = pa_source_new(c, pa_modargs_get_value(ma, "source_name", DEFAULT_SOURCE_NAME), 0, &ss))) {
617 pa_log(__FILE__": failed to create source.\n");
618 goto fail;
619 }
620
621 u->source->get_latency = source_get_latency;
622 u->source->userdata = u;
623 u->source->description = pa_sprintf_malloc("Tunnel to '%s%s%s'", u->source_name ? u->source_name : "", u->source_name ? "@" : "", u->server_name);
624
625 pa_source_set_owner(u->source, m);
626 #endif
627
628 gettimeofday(&ntv, NULL);
629 ntv.tv_sec += LATENCY_INTERVAL;
630 u->time_event = c->mainloop->time_new(c->mainloop, &ntv, timeout_callback, u);
631
632 pa_modargs_free(ma);
633
634 return 0;
635
636 fail:
637 pa__done(c, m);
638
639 if (ma)
640 pa_modargs_free(ma);
641 return -1;
642 }
643
644 void pa__done(struct pa_core *c, struct pa_module*m) {
645 struct userdata* u;
646 assert(c && m);
647
648 if (!(u = m->userdata))
649 return;
650
651 close_stuff(u);
652
653 #ifdef TUNNEL_SINK
654 pa_xfree(u->sink_name);
655 #else
656 pa_xfree(u->source_name);
657 #endif
658 pa_xfree(u->server_name);
659
660 pa_xfree(u);
661 }
662
663