diff options
-rw-r--r-- | configure.ac | 2 | ||||
-rwxr-xr-x | src/daemon/default.pa.in | 4 | ||||
-rw-r--r-- | src/modules/module-x11-publish.c | 8 | ||||
-rw-r--r-- | src/pulsecore/parseaddr.c | 10 | ||||
-rw-r--r-- | src/pulsecore/protocol-native.c | 20 | ||||
-rw-r--r-- | src/pulsecore/sink-input.c | 10 | ||||
-rw-r--r-- | src/pulsecore/sink-input.h | 10 | ||||
-rw-r--r-- | src/pulsecore/socket-server.c | 22 | ||||
-rw-r--r-- | src/pulsecore/source-output.c | 10 | ||||
-rw-r--r-- | src/pulsecore/source-output.h | 10 |
10 files changed, 60 insertions, 46 deletions
diff --git a/configure.ac b/configure.ac index 029899c4..097f0a27 100644 --- a/configure.ac +++ b/configure.ac @@ -26,7 +26,7 @@ m4_define(pa_major, [0]) m4_define(pa_minor, [9]) m4_define(pa_micro, [15]) -AC_INIT([pulseaudio],[pa_major.pa_minor.pa_micro-test5],[mzchyfrnhqvb (at) 0pointer (dot) net]) +AC_INIT([pulseaudio],[pa_major.pa_minor.pa_micro-test7],[mzchyfrnhqvb (at) 0pointer (dot) net]) AC_CONFIG_SRCDIR([src/daemon/main.c]) AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_HEADERS([config.h]) diff --git a/src/daemon/default.pa.in b/src/daemon/default.pa.in index 57ccd9f4..fa0683e1 100755 --- a/src/daemon/default.pa.in +++ b/src/daemon/default.pa.in @@ -58,9 +58,9 @@ load-module module-detect .endif ### Automatically load driver modules for Bluetooth hardware -#.ifexists module-bluetooth-discover@PA_SOEXT@ +.ifexists module-bluetooth-discover@PA_SOEXT@ load-module module-bluetooth-discover -#.endif +.endif ### Load several protocols .ifexists module-esound-protocol-unix@PA_SOEXT@ diff --git a/src/modules/module-x11-publish.c b/src/modules/module-x11-publish.c index 7d71067b..83e69d1b 100644 --- a/src/modules/module-x11-publish.c +++ b/src/modules/module-x11-publish.c @@ -136,7 +136,7 @@ static void x11_kill_cb(pa_x11_wrapper *w, void *userdata) { int pa__init(pa_module*m) { struct userdata *u; pa_modargs *ma = NULL; - char hn[256], un[128]; + char *mid; char hx[PA_NATIVE_COOKIE_LENGTH*2+1]; const char *t; @@ -164,10 +164,10 @@ int pa__init(pa_module*m) { if (!(u->x11_wrapper = pa_x11_wrapper_get(m->core, pa_modargs_get_value(ma, "display", NULL)))) goto fail; - if (!pa_get_fqdn(hn, sizeof(hn)) || !pa_get_user_name(un, sizeof(un))) - goto fail; + mid = pa_machine_id(); + u->id = pa_sprintf_malloc("%lu@%s/%lu", (unsigned long) getuid(), mid, (unsigned long) getpid()); + pa_xfree(mid); - u->id = pa_sprintf_malloc("%s@%s/%u", un, hn, (unsigned) getpid()); pa_x11_set_prop(pa_x11_wrapper_get_display(u->x11_wrapper), "PULSE_ID", u->id); publish_servers(u, pa_native_protocol_servers(u->protocol)); diff --git a/src/pulsecore/parseaddr.c b/src/pulsecore/parseaddr.c index c5cd7fe7..5b531220 100644 --- a/src/pulsecore/parseaddr.c +++ b/src/pulsecore/parseaddr.c @@ -87,13 +87,15 @@ int pa_parse_address(const char *name, pa_parsed_address *ret_p) { ret_p->type = PA_PARSED_ADDRESS_TCP_AUTO; if (*name == '{') { - char hn[256], *pfx; - /* The URL starts with a host specification for detecting local connections */ + char *id, *pfx; - if (!pa_get_host_name(hn, sizeof(hn))) + /* The URL starts with a host id for detecting local connections */ + if (!(id = pa_machine_id())) return -1; - pfx = pa_sprintf_malloc("{%s}", hn); + pfx = pa_sprintf_malloc("{%s}", id); + pa_xfree(id); + if (!pa_startswith(name, pfx)) { pa_xfree(pfx); /* Not local */ diff --git a/src/pulsecore/protocol-native.c b/src/pulsecore/protocol-native.c index 4f1d9b4b..e11d7a6c 100644 --- a/src/pulsecore/protocol-native.c +++ b/src/pulsecore/protocol-native.c @@ -213,7 +213,7 @@ enum { static int sink_input_pop_cb(pa_sink_input *i, size_t length, pa_memchunk *chunk); static void sink_input_kill_cb(pa_sink_input *i); static void sink_input_suspend_cb(pa_sink_input *i, pa_bool_t suspend); -static void sink_input_moving_cb(pa_sink_input *i); +static void sink_input_moving_cb(pa_sink_input *i, pa_sink *dest); static void sink_input_process_rewind_cb(pa_sink_input *i, size_t nbytes); static void sink_input_update_max_rewind_cb(pa_sink_input *i, size_t nbytes); static void sink_input_update_max_request_cb(pa_sink_input *i, size_t nbytes); @@ -225,7 +225,7 @@ static void playback_stream_request_bytes(struct playback_stream*s); static void source_output_kill_cb(pa_source_output *o); static void source_output_push_cb(pa_source_output *o, const pa_memchunk *chunk); static void source_output_suspend_cb(pa_source_output *o, pa_bool_t suspend); -static void source_output_moving_cb(pa_source_output *o); +static void source_output_moving_cb(pa_source_output *o, pa_source *dest); static pa_usec_t source_output_get_latency_cb(pa_source_output *o); static void source_output_send_event_cb(pa_source_output *o, const char *event, pa_proplist *pl); @@ -1572,7 +1572,7 @@ static void sink_input_suspend_cb(pa_sink_input *i, pa_bool_t suspend) { } /* Called from main context */ -static void sink_input_moving_cb(pa_sink_input *i) { +static void sink_input_moving_cb(pa_sink_input *i, pa_sink *dest) { playback_stream *s; pa_tagstruct *t; @@ -1591,9 +1591,9 @@ static void sink_input_moving_cb(pa_sink_input *i) { pa_tagstruct_putu32(t, PA_COMMAND_PLAYBACK_STREAM_MOVED); pa_tagstruct_putu32(t, (uint32_t) -1); /* tag */ pa_tagstruct_putu32(t, s->index); - pa_tagstruct_putu32(t, i->sink->index); - pa_tagstruct_puts(t, i->sink->name); - pa_tagstruct_put_boolean(t, pa_sink_get_state(i->sink) == PA_SINK_SUSPENDED); + pa_tagstruct_putu32(t, dest->index); + pa_tagstruct_puts(t, dest->name); + pa_tagstruct_put_boolean(t, pa_sink_get_state(dest) == PA_SINK_SUSPENDED); if (s->connection->version >= 13) { pa_tagstruct_putu32(t, s->buffer_attr.maxlength); @@ -1685,7 +1685,7 @@ static void source_output_suspend_cb(pa_source_output *o, pa_bool_t suspend) { } /* Called from main context */ -static void source_output_moving_cb(pa_source_output *o) { +static void source_output_moving_cb(pa_source_output *o, pa_source *dest) { record_stream *s; pa_tagstruct *t; @@ -1705,9 +1705,9 @@ static void source_output_moving_cb(pa_source_output *o) { pa_tagstruct_putu32(t, PA_COMMAND_RECORD_STREAM_MOVED); pa_tagstruct_putu32(t, (uint32_t) -1); /* tag */ pa_tagstruct_putu32(t, s->index); - pa_tagstruct_putu32(t, o->source->index); - pa_tagstruct_puts(t, o->source->name); - pa_tagstruct_put_boolean(t, pa_source_get_state(o->source) == PA_SOURCE_SUSPENDED); + pa_tagstruct_putu32(t, dest->index); + pa_tagstruct_puts(t, dest->name); + pa_tagstruct_put_boolean(t, pa_source_get_state(dest) == PA_SOURCE_SUSPENDED); if (s->connection->version >= 13) { pa_tagstruct_putu32(t, s->buffer_attr.maxlength); diff --git a/src/pulsecore/sink-input.c b/src/pulsecore/sink-input.c index da422428..0ed16dd8 100644 --- a/src/pulsecore/sink-input.c +++ b/src/pulsecore/sink-input.c @@ -845,10 +845,12 @@ pa_usec_t pa_sink_input_set_requested_latency(pa_sink_input *i, pa_usec_t usec) /* If this sink input is not realized yet or we are being moved, * we have to touch the thread info data directly */ - pa_sink_get_latency_range(i->sink, &min_latency, &max_latency); + if (i->sink) { + pa_sink_get_latency_range(i->sink, &min_latency, &max_latency); - if (usec != (pa_usec_t) -1) - usec = PA_CLAMP(usec, min_latency, max_latency); + if (usec != (pa_usec_t) -1) + usec = PA_CLAMP(usec, min_latency, max_latency); + } i->thread_info.requested_sink_latency = usec; @@ -1165,7 +1167,7 @@ int pa_sink_input_finish_move(pa_sink_input *i, pa_sink *dest, pa_bool_t save) { new_resampler = NULL; if (i->moving) - i->moving(i); + i->moving(i, dest); i->sink = dest; i->save_sink = save; diff --git a/src/pulsecore/sink-input.h b/src/pulsecore/sink-input.h index 4e29be67..e7a555df 100644 --- a/src/pulsecore/sink-input.h +++ b/src/pulsecore/sink-input.h @@ -144,13 +144,15 @@ struct pa_sink_input { * disconnected from its sink. Called from IO thread context */ void (*detach) (pa_sink_input *i); /* may be NULL */ - /* If non-NULL called whenever the the sink this input is attached + /* If non-NULL called whenever the sink this input is attached * to suspends or resumes. Called from main context */ void (*suspend) (pa_sink_input *i, pa_bool_t b); /* may be NULL */ - /* If non-NULL called whenever the the sink this input is attached - * to changes. Called from main context */ - void (*moving) (pa_sink_input *i); /* may be NULL */ + /* If non-NULL called whenever the sink input is moved to a new + * sink. Called from main context after the sink input has been + * detached from the old sink and before it has been attached to + * the new sink. */ + void (*moving) (pa_sink_input *i, pa_sink *dest); /* may be NULL */ /* Supposed to unlink and destroy this stream. Called from main * context. */ diff --git a/src/pulsecore/socket-server.c b/src/pulsecore/socket-server.c index 6a4405e3..8147b27f 100644 --- a/src/pulsecore/socket-server.c +++ b/src/pulsecore/socket-server.c @@ -467,11 +467,13 @@ char *pa_socket_server_get_address(pa_socket_server *s, char *c, size_t l) { pa_snprintf(c, l, "tcp6:%s:%u", fqdn, (unsigned) ntohs(sa.sin6_port)); } else if (memcmp(&in6addr_loopback, &sa.sin6_addr, sizeof(in6addr_loopback)) == 0) { - char hn[256]; - if (!pa_get_host_name(hn, sizeof(hn))) + char *id; + + if (!(id = pa_machine_id())) return NULL; - pa_snprintf(c, l, "{%s}tcp6:localhost:%u", hn, (unsigned) ntohs(sa.sin6_port)); + pa_snprintf(c, l, "{%s}tcp6:localhost:%u", id, (unsigned) ntohs(sa.sin6_port)); + pa_xfree(id); } else { char ip[INET6_ADDRSTRLEN]; @@ -503,11 +505,13 @@ char *pa_socket_server_get_address(pa_socket_server *s, char *c, size_t l) { pa_snprintf(c, l, "tcp:%s:%u", fqdn, (unsigned) ntohs(sa.sin_port)); } else if (sa.sin_addr.s_addr == INADDR_LOOPBACK) { - char hn[256]; - if (!pa_get_host_name(hn, sizeof(hn))) + char *id; + + if (!(id = pa_machine_id())) return NULL; - pa_snprintf(c, l, "{%s}tcp:localhost:%u", hn, (unsigned) ntohs(sa.sin_port)); + pa_snprintf(c, l, "{%s}tcp:localhost:%u", id, (unsigned) ntohs(sa.sin_port)); + pa_xfree(id); } else { char ip[INET_ADDRSTRLEN]; @@ -523,15 +527,15 @@ char *pa_socket_server_get_address(pa_socket_server *s, char *c, size_t l) { } case SOCKET_SERVER_UNIX: { - char hn[256]; + char *id; if (!s->filename) return NULL; - if (!pa_get_host_name(hn, sizeof(hn))) + if (!(id = pa_machine_id())) return NULL; - pa_snprintf(c, l, "{%s}unix:%s", hn, s->filename); + pa_snprintf(c, l, "{%s}unix:%s", id, s->filename); return c; } diff --git a/src/pulsecore/source-output.c b/src/pulsecore/source-output.c index 550b6571..27f24cd1 100644 --- a/src/pulsecore/source-output.c +++ b/src/pulsecore/source-output.c @@ -542,10 +542,12 @@ pa_usec_t pa_source_output_set_requested_latency(pa_source_output *o, pa_usec_t /* If this source output is not realized yet or is being moved, we * have to touch the thread info data directly */ - pa_source_get_latency_range(o->source, &min_latency, &max_latency); + if (o->source) { + pa_source_get_latency_range(o->source, &min_latency, &max_latency); - if (usec != (pa_usec_t) -1) - usec = PA_CLAMP(usec, min_latency, max_latency); + if (usec != (pa_usec_t) -1) + usec = PA_CLAMP(usec, min_latency, max_latency); + } o->thread_info.requested_source_latency = usec; @@ -745,7 +747,7 @@ int pa_source_output_finish_move(pa_source_output *o, pa_source *dest, pa_bool_t new_resampler = NULL; if (o->moving) - o->moving(o); + o->moving(o, dest); o->source = dest; o->save_source = save; diff --git a/src/pulsecore/source-output.h b/src/pulsecore/source-output.h index 8d57ded4..9f5f7744 100644 --- a/src/pulsecore/source-output.h +++ b/src/pulsecore/source-output.h @@ -116,13 +116,15 @@ struct pa_source_output { * disconnected from its source. Called from IO thread context */ void (*detach) (pa_source_output *o); /* may be NULL */ - /* If non-NULL called whenever the the source this output is attached + /* If non-NULL called whenever the source this output is attached * to suspends or resumes. Called from main context */ void (*suspend) (pa_source_output *o, pa_bool_t b); /* may be NULL */ - /* If non-NULL called whenever the the source this output is attached - * to changes. Called from main context */ - void (*moving) (pa_source_output *o); /* may be NULL */ + /* If non-NULL called whenever the source output is moved to a new + * source. Called from main context after the stream was detached + * from the old source and before it is attached to the new + * source. */ + void (*moving) (pa_source_output *o, pa_source *dest); /* may be NULL */ /* Supposed to unlink and destroy this stream. Called from main * context. */ |