LADI
/
spa
1
Fork 0
Commit Graph

504 Commits

Author SHA1 Message Date
Wim Taymans a14483ed61 jack: also allow signaling ourselves.
If we are a driver we can also ignal ourselves.
2023-05-22 12:15:01 +02:00
Wim Taymans ce71b37b58 jack: update bufsize and samplerate when skipping notify
When we skip the notify because we are not active or we don't have a
callback, still update the buffer_size and sample_rate fields or else
we will keep on trying forever.

Fixes #3226
2023-05-18 09:59:26 +02:00
Wim Taymans 4206f6bbdb jack: align sample rate callbacks with buffersize callbacks
Don't emit when no value has been queried before.
2023-05-18 09:46:40 +02:00
Wim Taymans a25c021074 jack: don't fill aliases by default
JACK does not automatically generate aliases, so don't do that either.

The problem is that no new ports can be created if one already exists
with the same name or any of the aliases. This causes problems when a
port is renamed and a new port is created with the old name because the
alias might still be the old name and port creation fails.

Add a jack.fill-aliases for this purpose.

Fixes #3154
2023-05-12 17:58:07 +02:00
Wim Taymans b3eb4518cb jack: only emit register notify in pairs
Only emit Off when On was sent.
2023-05-12 15:30:44 +02:00
Wim Taymans 8b18cbdce1 jack: restore previous global thread_utils
When a jack client is opened, the thread_utils from the context are
stored globaly. Replace this with a generic thread_utils when we close
the client again to avoid referencing freed memory.
2023-05-12 13:30:32 +02:00
Wim Taymans 41ec84185f jack: make a real notify queue
Use a ringbuffer to store notify events. Emit them when no method is
running.

See #3183
2023-05-11 18:28:03 +02:00
Wim Taymans 36fdceef71 jack: don't emit portregistration when inactive
Remove the port complete when the client is inactive. Otherwise we might
get a portregistration Off the next time the client is activated.
2023-05-10 17:22:43 +02:00
Wim Taymans 742039ff3f jack: destroy port only after emitting the portregistration
In jack_port_unregister(), don't free the port completely but mark it
as removing. This will then do the portregistration callback before
freeing the port.

Add some more debug.
2023-05-10 16:49:41 +02:00
Wim Taymans 981428a9fc jack: only emit graph order changes for new links 2023-05-10 16:48:57 +02:00
Wim Taymans 844ab48db8 jack: use refcount for freezing callbacks
In case the callbacks are called recursively, use a refcount for
blocking the callback emission.

See #3183
2023-05-10 16:46:42 +02:00
Wim Taymans ccece8316b jack: Don't call callbacks from blocking function
It is possible that the callback notify event is dispatched in do_wait()
while we are blocking for a method reply. In that case, don't perform
the callbacks, they will be rescheduled before the function exits.

Try to only dispatch the notify event when there are callbacks pending.

Fixes #3183
2023-05-10 12:10:03 +02:00
Wim Taymans 045cb95a27 jack: only emit callbacks when active
Most callbacks can only be emited when the client is active.

Fixes #3183
2023-05-09 15:34:51 +02:00
Wim Taymans 5485db09dc jack: Assign unique name to client_name
First try to make a unique node name and then assign this as the
client_name. This ensures we can detect a client name change because of
a name conflict and we properly handle the JackNameNotUnique and
JackUseExactName client open options.

Also emit a new client event when the client name existed but was from
another client and we made a unique name.

Fixes #2833
2023-05-09 11:34:12 +02:00
Wim Taymans 39bba88544 jack: emit a warning when disabled 2023-05-05 15:41:18 +02:00
Wim Taymans be59d2b5d0 jack: don't emit callbacks from do_wait()
Some functions need to wait for the reply of the server before they can
complete but the JACK API does not allow us to emit notifications while
blocking a function.

Delay emiting notifications when we are in selected methods and send a
notify to an eventfd to call the queued notifications.

Fixes #3183
2023-05-02 14:41:46 +02:00
Wim Taymans 7c5b61295d JACK: update to newer headers
Fixes #3181
2023-04-28 17:32:04 +02:00
Wim Taymans 472a948974 loop: keep loop and system around
So that we don't have to go through the context all the time.
2023-04-28 11:12:02 +02:00
Wim Taymans 0ac465854b jack: improve error reporting 2023-04-27 09:52:35 +02:00
Wim Taymans 78e54b1b2a jack: make spa_return macros log a warning
.. instead of using fprintf to stderr.
2023-04-24 13:23:40 +02:00
Wim Taymans 5a65d67f3a jack: we don't need a completed link in jack_port_connected
Return true from jack_port_connected() right after jack_connect(), there
is no reason to wait for the completed state of the link.

See #2638
2023-04-24 12:59:32 +02:00
Wim Taymans b87f7251d8 jack: activate/deactivate should trigger port register
Port added before activate should trigger a port_register callback when
the client is activated.

When calling jack_deactivate, the port_register callback should be
called.

See #2638
2023-04-24 12:55:56 +02:00
Wim Taymans 0f0d56e783 jack: avoid registering same port names twice
Don't register port names that are too long or that already exist.

See #2638
2023-04-24 12:53:56 +02:00
Wim Taymans 84a6f38ea6 jack: on do shutdown on EPIPE
There are core errors that should not trigger a shutdown, like invalid
or destroyed proxy replies. Only do shutdown when we get EPIPE, which is
when the server is stopped.

See #3070
2023-04-21 16:28:01 +02:00
Wim Taymans 76c793128b jack: Add jack.max-client-ports config option
Limit the amount of ports per client to 768 and add a
jack.max-client-ports option to configure this.
2023-04-21 15:42:57 +02:00
Wim Taymans e75fc459b3 jack: add jack.show-midi option
Add an option to show of hide MIDI ports, true by default.

Add jack.show-midi to config
2023-04-21 15:07:26 +02:00
Wim Taymans a643ac7d7a jack: fix some jack test errors
See #2638
2023-04-21 11:43:22 +02:00
Wim Taymans 4b6e0df411 jack: refactor get_time_ns function 2023-04-10 14:45:27 +02:00
Wim Taymans 495a227e5e jack: don't call callbacks when deactivating
Set the active state to false right when we start deactivate to make
sure that we don't call any callbacks anymore during shutdown.

One of the callbacks that might be called is the bufsize of samplerate
change callbacks when the node is moved to the dummy driver and this
might deadlock any app that doesn't expect this.

Fixes #2781
2023-03-29 16:18:26 +02:00
Wim Taymans fb8709716c core: add bound_props event
this event extends the bound_id event and sends the global properties as
well.

This can be used to get the object.serial, for example.

It can also be used in the future to let the server generate unique
property values, like the node.name, and let the client know about the
new property value.
2023-03-21 17:22:27 +01:00
Wim Taymans 1276c946fd fix compilation 2023-03-09 17:27:57 +01:00
Wim Taymans 45c7709bf6 jack: avoid division by 0 2023-03-09 17:14:05 +01:00
Wim Taymans b2ba946625 jack: don't abuse the node.passive property
PIPEWIRE_LINK_PASSIVE is to let this client make passive links, this
doesn't mean that the client wants passive links to its own node in all
cases so don't use the node.passive for that.

Instead use a new jack.passive-links. This can then also be set per
client to make it make passive links.
2023-03-08 16:51:40 +01:00
Barnabás Pőcze 7aae9a3e8b pipewire-jack: indent with tabs to avoid clang-tidy warnings 2023-02-25 20:48:45 +01:00
Barnabás Pőcze 0e0a2627aa treewide: print `pthread_t` as a pointer
On glibc, `pthread_t` is `unsigned long int` while on musl
it has a pointer type. To avoid format string warnings,
cast it to `void *` and use the `%p` format specifier.
2023-02-25 20:45:28 +01:00
Barnabás Pőcze 934ab3036e treewide: use SPDX tags to specify copyright information
SPDX tags make the licensing information easy to understand and clear,
and they are machine parseable.

See https://spdx.dev for more information.
2023-02-16 10:54:48 +00:00
Wim Taymans 0511970537 jack: use 32 bits for frame times
JACK uses 32 bits for frame times so truncate our 64 bits position
to get the wraparounds right.
2023-02-16 10:16:36 +01:00
Wim Taymans 274b63e972 jack: improve frame to and from time functions
Also support times and frames before the current one by doing a signed
diff.
Also take into account the rate adjusted period time.
2023-02-09 16:44:47 +01:00
Wim Taymans 03cb7f3549 jack: make jack.merge-monitor default true
Make jack.merge-monitor true by default because this is what JACK also
does.

Add an exception for Mixxx because that makes it easier to select the
capture/monitor ports.

Fixes #1760
2023-01-25 09:48:28 +01:00
Wim Taymans 95f87301c7 clarify PIPEWIRE_NODE
PIPEWIRE_NODE is mapped to TARGET_OBJECT so it contains the serial or
the node name.
Make sure pw-stream maps this to TARGET_OBJECT.
Make JACK use the PIPEWIRE_NODE for serial or node.name.
2023-01-10 17:11:43 +01:00
Wim Taymans 97aafe2234 fix use_buffers checks
We can set 0 buffers even if there is no format.
Return -ENOSPC when too many buffers are set.
2023-01-10 12:30:25 +01:00
Wim Taymans 50dad68eb4 midi: fix midi event sorting
The high bit is always 1 so we can use only the lower 3 bits for the
priority.
2022-12-13 16:41:20 +01:00
Wim Taymans 480902eb3a jack: sort midi events better
Use the same sorting as ardour for midi events with the same timestamp
so that the order is:

Controller messages > Program Change > Note Off > Note On >
    Note Pressure > Channel Pressure > Pitch Bend

Fixes #1868
2022-12-13 13:01:26 +01:00
Wim Taymans 0c50ccac87 jack: only process valid ports
In the data-loop we can check the valid flag safely to check if ports
are valid for processing.

See #2863
2022-12-02 09:46:05 +01:00
Wim Taymans 8e9b136b10 jack: use node.passive to make passive links
Let the node.passive property make passive links. PIPEWIRE_LINK_PASSIVE
overrides the node property.

Add some nice tweaks for qsynth so that it suspends and fades out
nicely by default.
2022-11-21 16:02:30 +01:00
Wim Taymans 0918899bf8 client-node: send the mix_info before Buffer IO
We don't always need to send buffers to a remote port, when the port
is an output port, all the mix ports use the same buffers. This means
that when we add another link to a port, we don't get the mix_info
anymore and then we don't know the peer_id and we don't complete the
link and we don't call the connection_callback.

Instead, send the mix_info right before sending the Buffer Io area. We
always do this for all mix io and after we have sent the buffers so this
is a better place.

Fixes #2841
2022-11-20 19:24:01 +01:00
Wim Taymans 518ccdf624 jack: add jack.filter-char to specify the filter character 2022-11-10 17:40:25 +01:00
Wim Taymans 643d95f515 jack: set port valid state safely
When unregistering a port, set the port to invalid first and sync the
data loop so that it will not be used anymore from the data loop.

See #2652
2022-10-20 21:34:01 +02:00
Wim Taymans 1aef910dcc jack: make jack_bufsize adjust the global quantum
Bind to the settings metadata.
Add a property to control if a client will set a temporary or global
quantum whith jack_bufsize.
Make a match rule for jack_bufsize and force a global quantum change.

Fixes #1273
2022-10-20 16:34:47 +02:00
Wim Taymans f0753ffdf9 jack: improve acquire/drop_rt methods
Instead of calling the default implementation that does not implement
these methods, keep the last thread-utils around in a global and use
that instead.
2022-10-13 12:09:36 +02:00