Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port::set_name doesn't work under PipeWire #218

Open
teodly opened this issue Feb 28, 2025 · 2 comments
Open

Port::set_name doesn't work under PipeWire #218

teodly opened this issue Feb 28, 2025 · 2 comments

Comments

@teodly
Copy link

teodly commented Feb 28, 2025

Port::set_name doesn't work under PipeWire because https://gitlab.freedesktop.org/pipewire/pipewire-jack/-/blob/5965eda73356efa85c46a9119473a910860cbca4/src/pipewire-jack.c?page=4#L3126

SPA_EXPORT
int jack_port_set_name (jack_port_t *port, const char *port_name)
{
	pw_log_warn("deprecated");
	return 0;
}

Migrating to jack_port_rename would help, however, according to JACK documentation:

May NOT be called from a callback handling a server event.

@wmedrano
Copy link
Member

wmedrano commented Mar 5, 2025

New function! jack_port_rename

jack_port_rename isn't the in the bindings for jack_sys, so its probably relatively new. I probably need to make a cookbook for updated the bindings in a way that supports both dynamic_loading true/false and doesn't break any users.

If you want to load it dynamically at runtime:

  • This is what happens when dynamic_loading feature is enabled, which is by default.
  • https://docs.rs/jack-sys/latest/jack_sys/fn.library.html
    • The underlying jack_sys package is re-exported as jack::jack_sys.
    • The type here is unsafe extern "C" fn(*mut jack_port_t, *const ::libc::c_char) -> ::libc::c_int;

Calling Requirements

  • I'm not sure if Rust has a way to guarantee this, will ask around, but best hacky ideas I have at the moment are either:
    • Add Port::rename as unsafe.
    • Create an object that marks the scope as being outside of callback handling.
      • Mark its creation as unsafe.

@teodly
Copy link
Author

teodly commented Mar 19, 2025

I have locally changed Port::set_name implementation to use jack_port_rename and... the port was successfully renamed in pw-dump, but jack_lsp, qpwgraph and Carla were still showing the old name. So it looks like renaming ports in PipeWire doesn't work no matter which method is used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants