pipewire/pipewire-jack/src/meson.build
Nedko Arnaudov aa55e43275 pipewire-jack: emit foreign port registration callbacks on jack_activate
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.

The change is libjackserver.so only. libjack.so behaviour is left
unmodifed, as carla is showing ports of each client twice.
2026-03-13 09:23:05 +01:00

120 lines
3.3 KiB
Meson

pipewire_jack_sources = [
'export.c',
'pipewire-jack.c',
'ringbuffer.c',
'uuid.c',
]
pipewire_jackserver_sources = pipewire_jack_sources
pipewire_jackserver_sources += [
'control.c',
]
pipewire_net_sources = [
'net.c',
]
pipewire_jack_c_args = [
'-DPIC',
]
libjack_path = get_option('libjack-path')
if libjack_path == ''
libjack_path = modules_install_dir / 'jack'
libjack_path_dlopen = modules_install_dir_dlopen / 'jack'
libjack_path_enable = ''
elif libjack_path == get_option('libdir') or libjack_path == pipewire_libdir
libjack_path = pipewire_libdir
libjack_path_dlopen = libjack_path
libjack_path_enable = '#'
else
libjack_path_dlopen = libjack_path
libjack_path_enable = ''
endif
tools_config = configuration_data()
tools_config.set('LIBJACK_PATH', libjack_path_dlopen)
tools_config.set('LIBJACK_PATH_ENABLE', libjack_path_enable)
configure_file(input : 'pw-jack.in',
output : 'pw-jack',
configuration : tools_config,
install_dir : pipewire_bindir)
pipewire_jack = shared_library('jack',
pipewire_jack_sources,
soversion : soversion,
version : libjackversion,
c_args : pipewire_jack_c_args,
include_directories : [configinc, jack_inc],
dependencies : [pipewire_dep, mathlib],
install : true,
install_dir : libjack_path,
)
pipewire_jackserver = shared_library('jackserver',
pipewire_jackserver_sources,
soversion : soversion,
version : libjackversion,
c_args : pipewire_jack_c_args + '-DLIBJACKSERVER',
include_directories : [configinc, jack_inc],
dependencies : [pipewire_dep, mathlib],
install : true,
install_dir : libjack_path,
)
pipewire_jacknet = shared_library('jacknet',
pipewire_net_sources,
soversion : soversion,
version : libjackversion,
c_args : pipewire_jack_c_args,
include_directories : [configinc, jack_inc],
dependencies : [pipewire_dep, mathlib],
install : true,
install_dir : libjack_path,
)
if get_option('jack-devel') == true
if meson.version().version_compare('<0.59.0')
error(
'''
Before version 0.59.0 Meson creates a wrong jack pkg-config file.
For that reason this is now an error. Please update Meson,
if you want to have JACK development files.
''')
endif
pkgconfig.generate(filebase : 'jack',
libraries : [pipewire_jack],
name : 'jack',
description : 'PipeWire JACK API',
version : jackversion,
extra_cflags : '-D_REENTRANT',
unescaped_variables: ['server_libs=-L${libdir} -ljackserver', 'jack_implementation=pipewire'])
pkgconfig.generate(filebase : 'jackserver',
libraries : [pipewire_jackserver],
name : 'jackserver',
description : 'PipeWire JACK Control API',
version : jackversion,
unescaped_variables: ['jack_implementation=pipewire'])
endif
if sdl_dep.found()
executable('video-dsp-play',
'../examples/video-dsp-play.c',
include_directories : [jack_inc],
install : installed_tests_enabled,
install_dir : installed_tests_execdir / 'examples' / 'jack',
dependencies : [sdl_dep, mathlib],
link_with: pipewire_jack,
)
endif
executable('ump-source',
'../examples/ump-source.c',
include_directories : [jack_inc],
install : installed_tests_enabled,
install_dir : installed_tests_execdir / 'examples' / 'jack',
dependencies : [mathlib],
link_with: pipewire_jack,
)