mirror of
https://gitlab.freedesktop.org/pipewire/wireplumber.git
synced 2026-04-21 18:20:38 +02:00
m-default-nodes: clear all previous configured nodes if metadata changes to NULL
This will completely clear all the default nodes (current and previous ones) if the configured metadata value has been set to NULL. This is needed so that the 'wpctl clear-default' command completely clears all the default nodes state.
This commit is contained in:
parent
a6d30c6f77
commit
98f622f718
1 changed files with 12 additions and 3 deletions
|
|
@ -64,6 +64,13 @@ wp_default_nodes_init (WpDefaultNodes * self)
|
|||
{
|
||||
}
|
||||
|
||||
static void
|
||||
clear_prev_config_values (WpDefaultNode *def)
|
||||
{
|
||||
for (gint i = 0; i < N_PREV_CONFIGS; i++)
|
||||
g_clear_pointer (&def->prev_config_value[i], g_free);
|
||||
}
|
||||
|
||||
static void
|
||||
update_prev_config_values (WpDefaultNode *def)
|
||||
{
|
||||
|
|
@ -460,12 +467,14 @@ on_metadata_changed (WpMetadata *m, guint32 subject,
|
|||
if (value && !g_strcmp0 (type, "Spa:String:JSON")) {
|
||||
g_autoptr (WpSpaJson) json = wp_spa_json_new_from_string (value);
|
||||
g_autofree gchar *name = NULL;
|
||||
if (wp_spa_json_object_get (json, "name", "s", &name, NULL))
|
||||
if (wp_spa_json_object_get (json, "name", "s", &name, NULL)) {
|
||||
self->defaults[node_t].config_value = g_strdup (name);
|
||||
update_prev_config_values (&self->defaults[node_t]);
|
||||
}
|
||||
} else if (!value) {
|
||||
clear_prev_config_values (&self->defaults[node_t]);
|
||||
}
|
||||
|
||||
update_prev_config_values (&self->defaults[node_t]);
|
||||
|
||||
wp_debug_object (m, "changed '%s' -> '%s'", key,
|
||||
self->defaults[node_t].config_value);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue