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);