Commit graph

10782 commits

Author SHA1 Message Date
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
4c48c7e7b9 module-roc-source: make sure we don't overflow target_latency
See #2641
2023-05-12 16:51:49 +02:00
Wim Taymans
bd28637233 module-rtp-sap: ttl is uint32_t 2023-05-12 16:37:25 +02:00
Sebastian Jaeckel
01d6724819 rtp-sink: fix ttl property which is NOT a bool 2023-05-12 14:34:17 +00: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
741037f1ae impl-node: move signalfd into pw_node_target
We don't need an extra signal_func, we can write to the signalfd
directly.
2023-05-12 13:02:47 +02:00
Wim Taymans
e3d715dfdf module-raop: only send volume when recording
See #3210
2023-05-12 10:48:40 +02:00
Wim Taymans
3a08510a81 properties: fix serialization of values
When the first parsed part of the value does not look like a container,
dump the complete length of the value.

If a value would contain 'Tunnel sink', it would previously only
serialize the 'Tunnel' part and ignore the rest.

See #3212
2023-05-12 10:11:41 +02:00
Wim Taymans
7b0c019a2b pulse-server: include rate/format for tunnel 2023-05-12 10:11:17 +02:00
Wim Taymans
7eeb9a63f8 pulse-server: remove / when no target object 2023-05-12 10:11:01 +02:00
Wim Taymans
150e7031ae pulse-server: improve channel formatting 2023-05-12 10:09:42 +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
5d5576f4a8 spa: make latency struct to compare const 2023-05-11 18:28:03 +02:00
Barnabás Pőcze
2ba9881b4d pulse-server: pending-sample: handle client disconnection correctly
Previously, a client disconnecting while a sample was playing could
lead to issues. For example, if a client disconnected before the
"ready" signal of the sample-play arrives, `operation_new_cb()`
would be called and that would try to use the client's pw_manager,
however, that has previously been destroyed in `client_disconnect()`.

If the client disconnected after the "ready" signal but before the reply
has been sent, then `sample_play_ready_reply()` would never be called
since operations are completed via the client's pw_manager which
would already be destroyed at that point.

Fix this by installing a listener on the client, and properly
cancelling the operation and making sure that the pending_sample
is correctly destroyed.
2023-05-10 18:57:20 +00:00
Barnabás Pőcze
bd510bf602 pulse-server: pending-sample: add on_ prefix to event handlers 2023-05-10 18:57:20 +00:00
Barnabás Pőcze
0395424461 pulse-server: add operation_free_by_tag() 2023-05-10 18:57:20 +00:00
Barnabás Pőcze
dd5f0e6bea pulse-server: pending-sample: only start operation if not replied already 2023-05-10 18:57:20 +00:00
Barnabás Pőcze
c25b6c973e pulse-server: pending-sample: factor out freeing logic 2023-05-10 18:57:20 +00:00
Barnabás Pőcze
cc702dac69 pulse-server: pending-sample: only send reply once 2023-05-10 18:57:20 +00:00
Barnabás Pőcze
edad053911 pulse-server: pending-sample: set replied flag on error
Set the `pending_sample::replied` flag when an error reply
is sent to the client.
2023-05-10 18:57:20 +00:00
Barnabás Pőcze
dd7c47bb3d pulse-server: pending-sample: rename ready to replied
Rename `pending_sample::ready` to `pending_sample::replied` because
it is set when a reply is sent, not when the ready signal comes.
2023-05-10 18:57:20 +00:00
Barnabás Pőcze
e37da42632 pulse-server: move sample playing into pending-sample.c 2023-05-10 18:57:20 +00:00
Sebastian Jaeckel
20d00e1092 aes67: adapt aes67 default config file to use the rtp-sap module 2023-05-10 17:40:30 +00:00
Sebastian Jaeckel
3ec0e1499f rtp-sap: use correct audio format string for L24 mime 2023-05-10 17:40:30 +00:00
Sebastian Jaeckel
44feba4bb4 rtp-sap: decrement session counter when a session is freed 2023-05-10 17:40:30 +00:00
Wim Taymans
4353f9eb75 module-jack: make stream ports physical
Just like the ports we connect to.
2023-05-10 18:00:44 +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
67fcd9646d impl-node: optimize peer activation
Before this patch, every link between node A and B would increment the
activation counter of B and add a new target to A. If there are N links
between A and B, resuming node A would then do N decrements of the
activation counter of B (by iterating the target_list) before finally
activating B.

This is not optimal, we can share the same activation count for all the
links between A and B.

Add a new pw_node_peer struct to keep track of links between A and B.
Activating a link between A and B activates the single activation of B,
deactivating all links deactivates B again. Waking up B after A finished
now no longer depends on the number of links between A and B.

This is particularly important for remote nodes because before the patch
they would get the activation memory and the eventfd of the peer __for
each link__. With huge amounts of links (like in stress tests) this
would result in too many fds. filtering out the fds for the same peer
was not easily possible because the server would still increment the
counters for each link and sharing the eventfd would require refcounting
it and closing duplicates.

After this patch the remote node receives 1 activation memory and eventfd
for each peer node, independent of the number of links between them. Even
for stereo streams this saves half of the memory and fds.
2023-05-10 16:56:38 +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
e3cfd73b9e audioconvert: use target_rate/quantum when starting
When the node is starting and negotiating, use the target_rate and
quantum because that is what is going to be used in the next cycle.
2023-05-09 15:53:36 +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
Dmitry Sharshakov
249cf9bfbe chore: fix warnings shown by Clang 16
These might have existed earlier, but fixing anyway
2023-05-09 08:31:56 +00:00
Wim Taymans
171e2a99ba context: Also add driver to always_process inactive nodes
Commit 90b11e3c49 removed inactive
node from the fallback driver, even if it was always_process.

This should not happen, always_process nodes should stay on a driver in
all cases.

JACK nodes are marked like this and need to stay on the driver even when
inactive or else they don't have a transport when inactive.

Fixes #3189
2023-05-09 10:11:51 +02:00
Wim Taymans
67df9d2251 module-jack: add midi support.
Move streams in separate struct, refactor and reuse some code.

Add midi ports and convert to/from pw and jack midi.
2023-05-08 17:06:17 +02:00
Wim Taymans
318d82e14f alsa: avoid division by 0
After we se the format, we negotiate the buffer size and period size.
When this fails, the period_size can be 0. Handle this case without
causing a floating point exception.
2023-05-08 16:49:33 +02:00
Wim Taymans
d2cd65b6e2 module-jack: add volume control 2023-05-08 11:34:00 +02:00
Wim Taymans
685ada05f0 module-jack: also search in PREFIX 2023-05-08 10:45:53 +02:00
Wim Taymans
43e2978255 module-pipe: reword docs from the perspective of the module 2023-05-07 20:53:04 +02:00
Wim Taymans
c324a9fb42 improve module docs 2023-05-07 20:13:46 +02:00
Wim Taymans
b3bb7fd567 module-rt: limit nice level based on rtkit min nice
Ask RTKit what the min nice level is and clamp our value to it to avoid
InvalidArgument errors.

Also add some more info messages when the level is clamped or invalid.

Fixes #3186
2023-05-07 19:37:32 +02:00
Wim Taymans
5942f2d6aa module-rt: add some more error to errno mappings 2023-05-07 13:52:17 +02:00
Wim Taymans
a20d2406c3 impl-node: improve signal_time
For remote nodes, set the signal time before we wake up the server. For
non-remote nodes, ser the signal time in node_ready. This ensures we
take the time to start the graph into account.
2023-05-06 18:53:56 +02:00
Pauli Virtanen
a0a5320280 impl-client: check global id registry generation in client.error method
In client.error method, require that the global id in the message refers
to an existing registered global known to the sender of the message.  If
not, do not try forwarding errors to the resources.

Also emit errors on the sender client resource in this case, so that the
sender client gets to know that what it tried to do didn't work.

This addresses a race condition where session manager sends a client
error for a global id, but before server processed that message the
global got deleted and the id reused for a different object, resulting
to an error being sent to the wrong resource. See #3192.

Wireplumber & pipewire-media-session do this on non-reconnectable node
connection failures: they first delete the node, and then try to send a
client error for its id. However, the global and its resources then
usually are already deleted at that point, and there are no resources to
send messages to so that is a no-op, except in the race condition where
id gets reused and the message goes to the wrong object.

They should do it in the opposite order. That it is wrong is also
visible in that

pw-play --target badtarget -P '{ node.dont-reconnect = true }' sample.ogg

hangs instead of bailing out, which is what happens also before this
commit.
2023-05-06 19:05:12 +03:00
Wim Taymans
2ed65a7e36 profiler: improve profiler stats
The driver and follower signal times are currently the same timestamp
so allow a 0 difference between the driver and follower signal time
to calculate the scheduling delay.
2023-05-06 10:54:57 +02:00
Pauli Virtanen
2a0f1597ab module-combine-stream: fix race when destroying streams
Use separate flag for indicating if pw_stream_destroy is needed.

Don't set s->stream = NULL to indicate that, it will race with data
loop. Setting to null separately is not needed, removing from the stream
list is enough.
2023-05-06 07:24:31 +00:00