mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-31 22:25:38 -04:00
pulse-server: skip objects being created
Skip iterating over objects that still have pending updates. Make sure we have all info and properties before we process objects. Fixes #376
This commit is contained in:
parent
041d1a142d
commit
22cec7823e
4 changed files with 24 additions and 26 deletions
|
|
@ -129,6 +129,8 @@ static struct pw_manager_object *select_object(struct pw_manager *m,
|
|||
const char *str;
|
||||
|
||||
spa_list_for_each(o, &m->object_list, link) {
|
||||
if (o->creating)
|
||||
continue;
|
||||
if (s->type != NULL && !s->type(o))
|
||||
continue;
|
||||
if (o->id == s->id)
|
||||
|
|
@ -150,6 +152,8 @@ static struct pw_manager_object *find_linked(struct pw_manager *m, uint32_t obj_
|
|||
uint32_t in_node, out_node;
|
||||
|
||||
spa_list_for_each(o, &m->object_list, link) {
|
||||
if (o->creating)
|
||||
continue;
|
||||
if (o->props == NULL || !is_link(o))
|
||||
continue;
|
||||
|
||||
|
|
|
|||
|
|
@ -64,8 +64,6 @@ struct object {
|
|||
|
||||
struct spa_hook proxy_listener;
|
||||
struct spa_hook object_listener;
|
||||
|
||||
unsigned int new:1;
|
||||
};
|
||||
|
||||
static void core_sync(struct manager *m)
|
||||
|
|
@ -116,6 +114,8 @@ static struct object *find_object(struct manager *m, uint32_t id)
|
|||
{
|
||||
struct object *o;
|
||||
spa_list_for_each(o, &m->this.object_list, this.link) {
|
||||
if (o->this.creating)
|
||||
continue;
|
||||
if (o->this.id == id)
|
||||
return o;
|
||||
}
|
||||
|
|
@ -470,7 +470,7 @@ static void registry_event_global(void *data, uint32_t id,
|
|||
o->this.version = version;
|
||||
o->this.props = props ? pw_properties_new_dict(props) : NULL;
|
||||
o->this.proxy = proxy;
|
||||
o->new = true;
|
||||
o->this.creating = true;
|
||||
spa_list_init(&o->this.param_list);
|
||||
|
||||
o->manager = m;
|
||||
|
|
@ -527,8 +527,8 @@ static void on_core_done(void *data, uint32_t id, int seq)
|
|||
manager_emit_sync(m);
|
||||
|
||||
spa_list_for_each(o, &m->this.object_list, this.link) {
|
||||
if (o->new) {
|
||||
o->new = false;
|
||||
if (o->this.creating) {
|
||||
o->this.creating = false;
|
||||
manager_emit_added(m, &o->this);
|
||||
} else if (o->this.changed > 0) {
|
||||
manager_emit_updated(m, &o->this);
|
||||
|
|
@ -620,6 +620,8 @@ int pw_manager_for_each_object(struct pw_manager *manager,
|
|||
int res;
|
||||
|
||||
spa_list_for_each(o, &m->this.object_list, this.link) {
|
||||
if (o->this.creating)
|
||||
continue;
|
||||
if ((res = callback(data, &o->this)) != 0)
|
||||
return res;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -82,6 +82,7 @@ struct pw_manager_object {
|
|||
int changed;
|
||||
void *info;
|
||||
struct spa_list param_list;
|
||||
unsigned int creating:1;
|
||||
};
|
||||
|
||||
struct pw_manager *pw_manager_new(struct pw_core *core);
|
||||
|
|
|
|||
|
|
@ -2339,10 +2339,7 @@ static int do_set_volume(struct client *client, uint32_t command, uint32_t tag,
|
|||
direction = PW_DIRECTION_INPUT;
|
||||
|
||||
o = find_device(client, id, name, direction == PW_DIRECTION_OUTPUT);
|
||||
if (o == NULL || o->info == NULL)
|
||||
return -ENOENT;
|
||||
info = o->info;
|
||||
if (info == NULL)
|
||||
if (o == NULL || (info = o->info) == NULL || info->props == NULL)
|
||||
return -ENOENT;
|
||||
|
||||
dev_info = DEVICE_INFO_INIT(direction);
|
||||
|
|
@ -2401,10 +2398,7 @@ static int do_set_mute(struct client *client, uint32_t command, uint32_t tag, st
|
|||
direction = PW_DIRECTION_INPUT;
|
||||
|
||||
o = find_device(client, id, name, direction == PW_DIRECTION_OUTPUT);
|
||||
if (o == NULL || o->info == NULL)
|
||||
return -ENOENT;
|
||||
info = o->info;
|
||||
if (info == NULL)
|
||||
if (o == NULL || (info = o->info) == NULL || info->props == NULL)
|
||||
return -ENOENT;
|
||||
|
||||
dev_info = DEVICE_INFO_INIT(direction);
|
||||
|
|
@ -2463,10 +2457,7 @@ static int do_set_port(struct client *client, uint32_t command, uint32_t tag, st
|
|||
direction = PW_DIRECTION_INPUT;
|
||||
|
||||
o = find_device(client, id, name, direction == PW_DIRECTION_OUTPUT);
|
||||
if (o == NULL || o->info == NULL)
|
||||
return -ENOENT;
|
||||
info = o->info;
|
||||
if (info == NULL)
|
||||
if (o == NULL || (info = o->info) == NULL || info->props == NULL)
|
||||
return -ENOENT;
|
||||
|
||||
if ((str = spa_dict_lookup(info->props, PW_KEY_DEVICE_ID)) != NULL)
|
||||
|
|
@ -2660,7 +2651,7 @@ static int do_get_server_info(struct client *client, uint32_t command, uint32_t
|
|||
ss = SAMPLE_SPEC_INIT;
|
||||
map = CHANNEL_MAP_INIT;
|
||||
|
||||
if (manager->info != NULL) {
|
||||
if (info != NULL) {
|
||||
if (info->props &&
|
||||
(str = spa_dict_lookup(info->props, "default.clock.rate")) != NULL)
|
||||
ss.rate = atoi(str);
|
||||
|
|
@ -2768,7 +2759,7 @@ static int fill_client_info(struct client *client, struct message *m,
|
|||
const char *str;
|
||||
uint32_t module_id = SPA_ID_INVALID;
|
||||
|
||||
if (o == NULL || !is_client(o))
|
||||
if (info == NULL || info->props == NULL || !is_client(o))
|
||||
return -ENOENT;
|
||||
|
||||
if ((str = spa_dict_lookup(info->props, PW_KEY_MODULE_ID)) != NULL)
|
||||
|
|
@ -2782,7 +2773,7 @@ static int fill_client_info(struct client *client, struct message *m,
|
|||
TAG_INVALID);
|
||||
if (client->version >= 13) {
|
||||
message_put(m,
|
||||
TAG_PROPLIST, info ? info->props : NULL,
|
||||
TAG_PROPLIST, info->props,
|
||||
TAG_INVALID);
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -2793,7 +2784,7 @@ static int fill_module_info(struct client *client, struct message *m,
|
|||
{
|
||||
struct pw_module_info *info = o->info;
|
||||
|
||||
if (o == NULL || info == NULL || !is_module(o))
|
||||
if (info == NULL || info->props == NULL || !is_module(o))
|
||||
return -ENOENT;
|
||||
|
||||
message_put(m,
|
||||
|
|
@ -2825,7 +2816,7 @@ static int fill_card_info(struct client *client, struct message *m,
|
|||
struct card_info card_info = CARD_INFO_INIT;
|
||||
struct profile_info *profile_info;
|
||||
|
||||
if (o == NULL || info == NULL || info->props == NULL || !is_card(o))
|
||||
if (info == NULL || info->props == NULL || !is_card(o))
|
||||
return -ENOENT;
|
||||
|
||||
if ((str = spa_dict_lookup(info->props, PW_KEY_MODULE_ID)) != NULL)
|
||||
|
|
@ -2944,7 +2935,7 @@ static int fill_sink_info(struct client *client, struct message *m,
|
|||
struct card_info card_info = CARD_INFO_INIT;
|
||||
struct device_info dev_info = DEVICE_INFO_INIT(PW_DIRECTION_OUTPUT);
|
||||
|
||||
if (o == NULL || info == NULL || info->props == NULL || !is_sink(o))
|
||||
if (info == NULL || info->props == NULL || !is_sink(o))
|
||||
return -ENOENT;
|
||||
|
||||
if ((name = spa_dict_lookup(info->props, PW_KEY_NODE_NAME)) != NULL) {
|
||||
|
|
@ -3067,7 +3058,7 @@ static int fill_source_info(struct client *client, struct message *m,
|
|||
struct device_info dev_info = DEVICE_INFO_INIT(PW_DIRECTION_INPUT);
|
||||
|
||||
is_monitor = is_sink(o);
|
||||
if (o == NULL || info == NULL || info->props == NULL ||
|
||||
if (info == NULL || info->props == NULL ||
|
||||
(!is_source(o) && !is_monitor))
|
||||
return -ENOENT;
|
||||
|
||||
|
|
@ -3190,7 +3181,7 @@ static int fill_sink_input_info(struct client *client, struct message *m,
|
|||
uint32_t module_id = SPA_ID_INVALID, client_id = SPA_ID_INVALID;
|
||||
struct device_info dev_info = DEVICE_INFO_INIT(PW_DIRECTION_OUTPUT);
|
||||
|
||||
if (o == NULL || info == NULL || info->props == NULL || !is_sink_input(o))
|
||||
if (info == NULL || info->props == NULL || !is_sink_input(o))
|
||||
return -ENOENT;
|
||||
|
||||
if ((str = spa_dict_lookup(info->props, PW_KEY_MODULE_ID)) != NULL)
|
||||
|
|
@ -3255,7 +3246,7 @@ static int fill_source_output_info(struct client *client, struct message *m,
|
|||
uint32_t peer_id;
|
||||
struct device_info dev_info = DEVICE_INFO_INIT(PW_DIRECTION_INPUT);
|
||||
|
||||
if (o == NULL || info == NULL || info->props == NULL || !is_source_output(o))
|
||||
if (info == NULL || info->props == NULL || !is_source_output(o))
|
||||
return -ENOENT;
|
||||
|
||||
if ((str = spa_dict_lookup(info->props, PW_KEY_MODULE_ID)) != NULL)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue