From 9cb234dda98fc7e1205c2cc21af2c70e488b00f7 Mon Sep 17 00:00:00 2001 From: Dimitrios Katsaros Date: Wed, 7 Feb 2024 14:37:56 +0100 Subject: [PATCH] Jack: Fix jack_remove_property(ies) to use proxy id These functions were using the object serial as the object id --- pipewire-jack/src/metadata.c | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/pipewire-jack/src/metadata.c b/pipewire-jack/src/metadata.c index d29deed2b..c8bf03af1 100644 --- a/pipewire-jack/src/metadata.c +++ b/pipewire-jack/src/metadata.c @@ -324,7 +324,8 @@ SPA_EXPORT int jack_remove_property (jack_client_t* client, jack_uuid_t subject, const char* key) { struct client *c = (struct client *) client; - uint32_t id; + struct object *o; + uint32_t serial; int res = -1; spa_return_val_if_fail(c != NULL, -EINVAL); @@ -335,11 +336,16 @@ int jack_remove_property (jack_client_t* client, jack_uuid_t subject, const char if (c->metadata == NULL) goto done; - id = jack_uuid_to_index(subject); + if (subject & (1<<30)) + goto done; - pw_log_info("remove id:%u (%"PRIu64") '%s'", id, subject, key); + serial = jack_uuid_to_index(subject); + if ((o = find_by_serial(c, serial)) == NULL) + goto done; + + pw_log_info("remove id:%u (%"PRIu64") '%s'", o->id, subject, key); pw_metadata_set_property(c->metadata->proxy, - id, key, NULL, NULL); + o->id, key, NULL, NULL); res = do_sync(c); done: pw_thread_loop_unlock(c->context.loop); @@ -351,7 +357,8 @@ SPA_EXPORT int jack_remove_properties (jack_client_t* client, jack_uuid_t subject) { struct client *c = (struct client *) client; - uint32_t id; + struct object *o; + uint32_t serial; int res = -1; spa_return_val_if_fail(c != NULL, -EINVAL); @@ -360,11 +367,16 @@ int jack_remove_properties (jack_client_t* client, jack_uuid_t subject) if (c->metadata == NULL) goto done; - id = jack_uuid_to_index(subject); + if (subject & (1<<30)) + goto done; - pw_log_info("remove id:%u (%"PRIu64")", id, subject); + serial = jack_uuid_to_index(subject); + if ((o = find_by_serial(c, serial)) == NULL) + goto done; + + pw_log_info("remove id:%u (%"PRIu64")", o->id, subject); pw_metadata_set_property(c->metadata->proxy, - id, NULL, NULL, NULL); + o->id, NULL, NULL, NULL); res = do_sync(c); done: pw_thread_loop_unlock(c->context.loop);