mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-07 13:30:09 -05:00
pulse-server: remove pending_streams list
We can simply use the pending flag and merge the handling of the new stream with the stream move logic.
This commit is contained in:
parent
35cca08d2b
commit
846e732458
5 changed files with 23 additions and 30 deletions
|
|
@ -46,7 +46,6 @@ struct client *client_new(struct server *server)
|
||||||
spa_list_init(&client->out_messages);
|
spa_list_init(&client->out_messages);
|
||||||
spa_list_init(&client->operations);
|
spa_list_init(&client->operations);
|
||||||
spa_list_init(&client->pending_samples);
|
spa_list_init(&client->pending_samples);
|
||||||
spa_list_init(&client->pending_streams);
|
|
||||||
spa_hook_list_init(&client->listener_list);
|
spa_hook_list_init(&client->listener_list);
|
||||||
|
|
||||||
spa_list_append(&server->clients, &client->link);
|
spa_list_append(&server->clients, &client->link);
|
||||||
|
|
|
||||||
|
|
@ -74,8 +74,6 @@ struct client {
|
||||||
|
|
||||||
struct spa_list pending_samples;
|
struct spa_list pending_samples;
|
||||||
|
|
||||||
struct spa_list pending_streams;
|
|
||||||
|
|
||||||
unsigned int disconnect:1;
|
unsigned int disconnect:1;
|
||||||
unsigned int new_msg_since_last_flush:1;
|
unsigned int new_msg_since_last_flush:1;
|
||||||
unsigned int authenticated:1;
|
unsigned int authenticated:1;
|
||||||
|
|
|
||||||
|
|
@ -832,21 +832,29 @@ static void manager_added(void *data, struct pw_manager_object *o)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (spa_streq(o->type, PW_TYPE_INTERFACE_Link)) {
|
if (spa_streq(o->type, PW_TYPE_INTERFACE_Link)) {
|
||||||
struct stream *s, *t;
|
|
||||||
struct pw_manager_object *peer = NULL;
|
struct pw_manager_object *peer = NULL;
|
||||||
union pw_map_item *item;
|
union pw_map_item *item;
|
||||||
pw_array_for_each(item, &client->streams.items) {
|
pw_array_for_each(item, &client->streams.items) {
|
||||||
struct stream *s = item->data;
|
struct stream *s = item->data;
|
||||||
const char *peer_name;
|
const char *peer_name;
|
||||||
|
|
||||||
if (pw_map_item_is_free(item) || s->pending)
|
if (pw_map_item_is_free(item))
|
||||||
continue;
|
continue;
|
||||||
if (s->peer_index == SPA_ID_INVALID)
|
|
||||||
|
if (!s->pending && s->peer_index == SPA_ID_INVALID)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
peer = find_peer_for_link(manager, o, s->id, s->direction);
|
peer = find_peer_for_link(manager, o, s->id, s->direction);
|
||||||
if (peer == NULL || peer->props == NULL ||
|
if (peer == NULL)
|
||||||
peer->index == s->peer_index)
|
continue;
|
||||||
|
|
||||||
|
if (s->pending) {
|
||||||
|
reply_create_stream(s, peer);
|
||||||
|
s->pending = false;
|
||||||
|
} else {
|
||||||
|
if (s->peer_index == peer->index)
|
||||||
|
continue;
|
||||||
|
if (peer->props == NULL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
s->peer_index = peer->index;
|
s->peer_index = peer->index;
|
||||||
|
|
@ -862,13 +870,6 @@ static void manager_added(void *data, struct pw_manager_object *o)
|
||||||
if (peer_name != NULL)
|
if (peer_name != NULL)
|
||||||
stream_send_moved(s, peer->index, peer_name);
|
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) {
|
|
||||||
reply_create_stream(s, peer);
|
|
||||||
spa_list_remove(&s->link);
|
|
||||||
s->pending = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1244,7 +1245,6 @@ static void stream_param_changed(void *data, uint32_t id, const struct spa_pod *
|
||||||
if (peer) {
|
if (peer) {
|
||||||
reply_create_stream(stream, peer);
|
reply_create_stream(stream, peer);
|
||||||
} else {
|
} else {
|
||||||
spa_list_append(&stream->client->pending_streams, &stream->link);
|
|
||||||
stream->pending = true;
|
stream->pending = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -103,9 +103,6 @@ void stream_free(struct stream *stream)
|
||||||
|
|
||||||
pw_log_debug("client %p: stream %p channel:%d", client, stream, stream->channel);
|
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)
|
if (stream->drain_tag)
|
||||||
reply_error(client, -1, stream->drain_tag, -ENOENT);
|
reply_error(client, -1, stream->drain_tag, -ENOENT);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,6 @@ enum stream_type {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct stream {
|
struct stream {
|
||||||
struct spa_list link;
|
|
||||||
uint32_t create_tag;
|
uint32_t create_tag;
|
||||||
uint32_t channel; /* index in map */
|
uint32_t channel; /* index in map */
|
||||||
uint32_t id; /* id of global */
|
uint32_t id; /* id of global */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue