diff --git a/src/modules/module-protocol-pulse/client.c b/src/modules/module-protocol-pulse/client.c index 1a4ef85db..cbcc29af0 100644 --- a/src/modules/module-protocol-pulse/client.c +++ b/src/modules/module-protocol-pulse/client.c @@ -46,7 +46,6 @@ struct client *client_new(struct server *server) spa_list_init(&client->out_messages); spa_list_init(&client->operations); spa_list_init(&client->pending_samples); - spa_list_init(&client->pending_streams); spa_hook_list_init(&client->listener_list); spa_list_append(&server->clients, &client->link); diff --git a/src/modules/module-protocol-pulse/client.h b/src/modules/module-protocol-pulse/client.h index 47b7d7dad..55b6c0b37 100644 --- a/src/modules/module-protocol-pulse/client.h +++ b/src/modules/module-protocol-pulse/client.h @@ -74,8 +74,6 @@ struct client { struct spa_list pending_samples; - struct spa_list pending_streams; - unsigned int disconnect:1; unsigned int new_msg_since_last_flush:1; unsigned int authenticated:1; diff --git a/src/modules/module-protocol-pulse/pulse-server.c b/src/modules/module-protocol-pulse/pulse-server.c index 593f47da5..b279eddc7 100644 --- a/src/modules/module-protocol-pulse/pulse-server.c +++ b/src/modules/module-protocol-pulse/pulse-server.c @@ -832,42 +832,43 @@ static void manager_added(void *data, struct pw_manager_object *o) } if (spa_streq(o->type, PW_TYPE_INTERFACE_Link)) { - struct stream *s, *t; struct pw_manager_object *peer = NULL; union pw_map_item *item; pw_array_for_each(item, &client->streams.items) { struct stream *s = item->data; const char *peer_name; - if (pw_map_item_is_free(item) || s->pending) + if (pw_map_item_is_free(item)) continue; - if (s->peer_index == SPA_ID_INVALID) + + if (!s->pending && s->peer_index == SPA_ID_INVALID) continue; peer = find_peer_for_link(manager, o, s->id, s->direction); - if (peer == NULL || peer->props == NULL || - peer->index == s->peer_index) + if (peer == NULL) continue; - s->peer_index = peer->index; - - peer_name = pw_properties_get(peer->props, PW_KEY_NODE_NAME); - if (peer_name && s->direction == PW_DIRECTION_INPUT && - pw_manager_object_is_monitor(peer)) { - int len = strlen(peer_name) + 10; - char *tmp = alloca(len); - snprintf(tmp, len, "%s.monitor", peer_name); - peer_name = tmp; - } - if (peer_name != NULL) - stream_send_moved(s, peer->index, peer_name); - } - spa_list_for_each_safe(s, t, &client->pending_streams, link) { - peer = find_peer_for_link(manager, o, s->id, s->direction); - if (peer) { + if (s->pending) { reply_create_stream(s, peer); - spa_list_remove(&s->link); s->pending = false; + } else { + if (s->peer_index == peer->index) + continue; + if (peer->props == NULL) + continue; + + s->peer_index = peer->index; + + peer_name = pw_properties_get(peer->props, PW_KEY_NODE_NAME); + if (peer_name && s->direction == PW_DIRECTION_INPUT && + pw_manager_object_is_monitor(peer)) { + int len = strlen(peer_name) + 10; + char *tmp = alloca(len); + snprintf(tmp, len, "%s.monitor", peer_name); + peer_name = tmp; + } + if (peer_name != NULL) + stream_send_moved(s, peer->index, peer_name); } } } @@ -1244,7 +1245,6 @@ static void stream_param_changed(void *data, uint32_t id, const struct spa_pod * if (peer) { reply_create_stream(stream, peer); } else { - spa_list_append(&stream->client->pending_streams, &stream->link); stream->pending = true; } } diff --git a/src/modules/module-protocol-pulse/stream.c b/src/modules/module-protocol-pulse/stream.c index babdeb68b..c216f6ec0 100644 --- a/src/modules/module-protocol-pulse/stream.c +++ b/src/modules/module-protocol-pulse/stream.c @@ -103,9 +103,6 @@ void stream_free(struct stream *stream) pw_log_debug("client %p: stream %p channel:%d", client, stream, stream->channel); - if (stream->pending) - spa_list_remove(&stream->link); - if (stream->drain_tag) reply_error(client, -1, stream->drain_tag, -ENOENT); diff --git a/src/modules/module-protocol-pulse/stream.h b/src/modules/module-protocol-pulse/stream.h index cc5852a2b..570661276 100644 --- a/src/modules/module-protocol-pulse/stream.h +++ b/src/modules/module-protocol-pulse/stream.h @@ -34,7 +34,6 @@ enum stream_type { }; struct stream { - struct spa_list link; uint32_t create_tag; uint32_t channel; /* index in map */ uint32_t id; /* id of global */