introspect: improve info updates

The current _info_update() methods will always reset the change_mask in
the new info structure.

This causes problems if multiple updates are applied to the info before
the rescan in the session manager of pulse-server is excuted. The first
update is cleared and this causes the session manager to sometimes miss
the state changes of nodes and fail to suspend them.

Add a new method to merge with optional reset of the various
introspection info structures. We can use this instead and simply
accumulate all changes until the rescan code has processed all changes.
This commit is contained in:
Wim Taymans 2021-09-03 13:26:15 +02:00
parent 63521c1063
commit 91f1b44499
11 changed files with 155 additions and 61 deletions

View file

@ -218,9 +218,9 @@ static void client_event_info(void *object, const struct pw_client_info *info)
struct object *o = object;
int changed = 0;
pw_log_debug("object %p: id:%d change-mask:%08"PRIx64, o, o->this.id, info->change_mask);
pw_log_debug("object %p: id:%d change-mask:%08"PRIx64, o, o->this.id, info->change_mask);
info = o->this.info = pw_client_info_update(o->this.info, info);
info = o->this.info = pw_client_info_merge(o->this.info, info, o->this.changed == 0);
if (info->change_mask & PW_CLIENT_CHANGE_MASK_PROPS)
changed++;
@ -254,12 +254,12 @@ static const struct object_info client_info = {
/* module */
static void module_event_info(void *object, const struct pw_module_info *info)
{
struct object *o = object;
struct object *o = object;
int changed = 0;
pw_log_debug("object %p: id:%d change-mask:%08"PRIx64, o, o->this.id, info->change_mask);
pw_log_debug("object %p: id:%d change-mask:%08"PRIx64, o, o->this.id, info->change_mask);
info = o->this.info = pw_module_info_update(o->this.info, info);
info = o->this.info = pw_module_info_merge(o->this.info, info, o->this.changed == 0);
if (info->change_mask & PW_MODULE_CHANGE_MASK_PROPS)
changed++;
@ -298,7 +298,7 @@ static void device_event_info(void *object, const struct pw_device_info *info)
pw_log_debug("object %p: id:%d change-mask:%08"PRIx64, o, o->this.id, info->change_mask);
info = o->this.info = pw_device_info_update(o->this.info, info);
info = o->this.info = pw_device_info_merge(o->this.info, info, o->this.changed == 0);
if (info->change_mask & PW_DEVICE_CHANGE_MASK_PROPS)
changed++;
@ -418,7 +418,7 @@ static void node_event_info(void *object, const struct pw_node_info *info)
pw_log_debug("object %p: id:%d change-mask:%08"PRIx64, o, o->this.id, info->change_mask);
info = o->this.info = pw_node_info_update(o->this.info, info);
info = o->this.info = pw_node_info_merge(o->this.info, info, o->this.changed == 0);
if (info->change_mask & PW_NODE_CHANGE_MASK_STATE)
changed++;
@ -655,7 +655,7 @@ static const struct pw_registry_events registry_events = {
static void on_core_info(void *data, const struct pw_core_info *info)
{
struct manager *m = data;
m->this.info = pw_core_info_update(m->this.info, info);
m->this.info = pw_core_info_merge(m->this.info, info, true);
}
static void on_core_done(void *data, uint32_t id, int seq)