mirror of
https://gitlab.freedesktop.org/pipewire/wireplumber.git
synced 2026-05-05 07:48:01 +02:00
object-manager: use an idle callback to expose tmp globals instead of pw_core_sync
A core sync is not really necessary here because whatever objects the remote pipewire daemon has to announce have already been sent to us on a message and this message is already being processed at this point. This means, we are not going to be returning to the main loop until all the new objects have been announced and therefore placed into the tmp globals array. So, we can also use an idle callback and achieve the same effect of slightly delaying until all new globals have been announced. With an idle callback, we can be more agile and add those new objects immediately after the message has been processed instead of waiting for a pw_core_sync() reply, which will come in the next message. This fixes an odd failure of the si-standard-link test after applying the fix for #517, which was caused by the fact that the test was previously relying on a delay caused by some unrelated globals being prepared in the object manager that tries to verify the graph state. After those globals were removed from the internal preparation queue, the test would fail to detect the link objects because they were stuck in the tmp_globals array for too long.
This commit is contained in:
parent
5fc7e68d10
commit
23ba01970f
1 changed files with 10 additions and 10 deletions
|
|
@ -1047,18 +1047,15 @@ wp_registry_detach (WpRegistry *self)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
expose_tmp_globals (WpCore *core, GAsyncResult *res, WpRegistry *self)
|
||||
static gboolean
|
||||
expose_tmp_globals (WpCore *core)
|
||||
{
|
||||
g_autoptr (GError) error = NULL;
|
||||
WpRegistry *self = wp_core_get_registry (core);
|
||||
g_autoptr (GPtrArray) tmp_globals = NULL;
|
||||
|
||||
if (!wp_core_sync_finish (core, res, &error))
|
||||
wp_warning_object (core, "core sync error: %s", error->message);
|
||||
|
||||
/* in case the registry was cleared in the meantime... */
|
||||
if (G_UNLIKELY (!self->tmp_globals))
|
||||
return;
|
||||
return G_SOURCE_REMOVE;
|
||||
|
||||
/* steal the tmp_globals list and replace it with an empty one */
|
||||
tmp_globals = self->tmp_globals;
|
||||
|
|
@ -1082,8 +1079,8 @@ expose_tmp_globals (WpCore *core, GAsyncResult *res, WpRegistry *self)
|
|||
wp_global_rm_flag (old_g, WP_GLOBAL_FLAG_OWNED_BY_PROXY);
|
||||
}
|
||||
|
||||
g_return_if_fail (self->globals->len <= g->id ||
|
||||
g_ptr_array_index (self->globals, g->id) == NULL);
|
||||
g_return_val_if_fail (self->globals->len <= g->id ||
|
||||
g_ptr_array_index (self->globals, g->id) == NULL, G_SOURCE_REMOVE);
|
||||
|
||||
/* set the registry, so that wp_global_rm_flag() can work full-scale */
|
||||
g->registry = self;
|
||||
|
|
@ -1109,6 +1106,8 @@ expose_tmp_globals (WpCore *core, GAsyncResult *res, WpRegistry *self)
|
|||
}
|
||||
wp_object_manager_maybe_objects_changed (om);
|
||||
}
|
||||
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -1159,7 +1158,8 @@ wp_registry_prepare_new_global (WpRegistry * self, guint32 id,
|
|||
|
||||
/* schedule exposing when adding the first global */
|
||||
if (self->tmp_globals->len == 1) {
|
||||
wp_core_sync (core, NULL, (GAsyncReadyCallback) expose_tmp_globals, self);
|
||||
wp_core_idle_add_closure (core, NULL,
|
||||
g_cclosure_new_object (G_CALLBACK (expose_tmp_globals), G_OBJECT (core)));
|
||||
}
|
||||
} else {
|
||||
/* store the most permissive permissions */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue