From b0065bfe9a8d34020e2ea6f4272f3a2b28601689 Mon Sep 17 00:00:00 2001 From: Nedko Arnaudov Date: Wed, 11 Mar 2026 17:57:15 +0200 Subject: [PATCH] pipewire-jack: emit foreign port registration callbacks on jack_activate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The jack_activate loop was only queuing NOTIFY_TYPE_PORTREGISTRATION for the activating client's own ports. Ports belonging to other clients — including all WirePlumber-managed ports and MIDI ports — were silently skipped due to the o->port.port->client != c condition. This caused two observable bugs for clients using libjackserver (e.g. jackdbus): - JackPortRegistrationCallback was not fired for any pre-existing foreign ports at activate time, leaving the patchbay empty unless the session manager happened to start after the client. - JACK MIDI ports were never announced via callback, even though they are correctly returned by jack_get_ports(). The graph_order_callback fallback (used by jackdbus for initial port enumeration) is also ineffective here because pipewire-jack only fires it on connection events, not on activate. Fix by iterating all non-removed foreign ports in the object list and queuing registration callbacks for those whose node is active, matching the semantics already implemented in node_info() for ports of nodes that transition to running state after activate. --- pipewire-jack/src/pipewire-jack.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pipewire-jack/src/pipewire-jack.c b/pipewire-jack/src/pipewire-jack.c index 906fc96f1..56191b93c 100644 --- a/pipewire-jack/src/pipewire-jack.c +++ b/pipewire-jack/src/pipewire-jack.c @@ -4886,9 +4886,15 @@ int jack_activate (jack_client_t *client) c->activation->pending_new_pos = true; c->activation->pending_sync = true; + /* emits all foreign active ports, skips own (already announced via jack_port_register) */ spa_list_for_each(o, &c->context.objects, link) { - if (o->type != INTERFACE_Port || o->port.port == NULL || - o->port.port->client != c || !o->port.port->valid) + if (o->type != INTERFACE_Port || o->removed) + continue; + /* own ports are handled by jack_port_register */ + if (o->port.port != NULL && o->port.port->client == c) + continue; + /* only announce ports whose node is active */ + if (o->port.node != NULL && !node_is_active(c, o->port.node)) continue; o->registered = 0; queue_notify(c, NOTIFY_TYPE_PORTREGISTRATION, o, 1, NULL);