Commit graph

10747 commits

Author SHA1 Message Date
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
Wim Taymans
12b6adb10c filter: fix compilation with -UFASTPATH 2023-05-06 08:29:28 +02:00
Wim Taymans
727775201f spa: make node callbacks fast 2023-05-06 00:47:39 +02:00
Wim Taymans
efea7ad060 hooks: add and use _fast callback function
Add a _fast callback function that skips the version and method check.
We can use this in places where performance is critical when we do the
check out of the critical loops.

Make all system methods _fast calls. We expect them to exist and have
the right version. If we add new versions we can make them slow.
2023-05-06 00:27:12 +02:00
Wim Taymans
9967c35bbe audioconvert: exit early to ask more data
We don't need to peek all the output buffers before deciding that we
need more data. Just check if we have input, if not ask more data.
2023-05-05 21:34:53 +02:00
Wim Taymans
f5a10cb734 filter: remove some unused code
Add some SPA_LIKELY
2023-05-05 21:33:28 +02:00
Wim Taymans
4b5b94303e loop: clear rmask after dispatching all sources
To make the unit tests work again.
2023-05-05 18:36:50 +02:00
Wim Taymans
93530df139 filter: don't copy position info
We copied the position information for the deprecated _get_time()
function. Don't do this anymore and just read the values from the
get_time() function directly.

They might race with the processing thread but that's why the
function is deprecated.

Improves performance in tight loops.
2023-05-05 17:56:01 +02:00
Wim Taymans
8452e6d28e data-loop: optimize iterate dispatch
Avoid doing the interface unref and version check for each iteration but
do this before entering the loop. Improves performance in high frequency
wakeups.
2023-05-05 17:43:27 +02:00
Wim Taymans
fbf17cf980 loop: add optimized non-cancellable iterate
Only use the more heavy cancellable loop when the loop.cancel property
was set. Makes pipewire go from 5% to 3% in high frequency wakeups.
2023-05-05 17:41:37 +02:00
Wim Taymans
67c38490a5 move some trace to trace_fp 2023-05-05 17:41:13 +02:00
Wim Taymans
0629647cb5 module-jack: load libjack.so.0 with dlopen
This way we can search for the real jack library instead of using our
custom libjack.so. Add an option to override the search path with
LIBJACK_PATH and an option to select the library name to load.
2023-05-05 15:42:14 +02:00
Wim Taymans
7da4eb13f7 pulse-server: add some module docs 2023-05-05 15:41:44 +02:00
Wim Taymans
39bba88544 jack: emit a warning when disabled 2023-05-05 15:41:18 +02:00
Wim Taymans
a77b12a024 client-node: clean up useless node object 2023-05-04 21:46:07 +02:00
Wim Taymans
ffa21d696d module-pulse-tunnel: avoid using NULL module
Set the module to NULL when unloading. Check if the module exists before
attempting to unload it.

Flush any pending invokes on the mainloop before destroying the impl.

Fixes #3199
2023-05-04 20:28:10 +02:00
Wim Taymans
75d7c574cf impl-node: don't do output mix for remote nodes
Remote nodes already did the output mix remotely so we don't have to
attempt it on the server (and it doesn't actually have output mixers).
2023-05-04 20:26:17 +02:00
Wim Taymans
f756eebac5 impl-node: add some SPA_LIKELY 2023-05-04 20:25:50 +02:00
Wim Taymans
7f53571e0c impl-node: avoid division by zero better
Since the activation is in shared memory, a bad client could try to
modify them after we check the signal_time and prev_signal time and
cause a division by zero. Make a unique copy of the values and use
those.
2023-05-04 19:47:46 +02:00
Wim Taymans
2be49838d0 pulse-server: remove some warnings 2023-05-04 19:11:21 +02:00
Wim Taymans
b13e9f7a8d pipewire-pulse: add module-jackdbus-detect 2023-05-04 18:46:36 +02:00
Wim Taymans
37210794d8 pulse-server: rework audioinfo argument parsing
Make a new method to parse parts of the audioinfo based on custom
keys, leaving unparsed values to defaults. Implement the generic audio
parsing with this.

We can then remove some duplicate code where the audio keys didn't match
or where only parts of the info needed to be parsed.

Also make a method to serialize the audioinfo to properties and use that
when making arguments to load the modules.

Avoid doing some custom property serialization, move all key/values into
properties and serialize those with the generic functions.
2023-05-04 18:43:08 +02:00
Wim Taymans
11c478d0fa improve debug of commands and events
Add the type name in the log.
2023-05-04 13:03:40 +02:00
Wim Taymans
0b3a06192e module-jack: add jack.connect option 2023-05-04 11:55:01 +02:00
Wim Taymans
43b6054631 module-jack: add jack.client-name option 2023-05-04 11:44:55 +02:00
Wim Taymans
7ac8e29160 module-jack: handle non-duplex case 2023-05-04 11:41:17 +02:00
Wim Taymans
7a82fc7fc7 module-jack: fix compilation without fastpath 2023-05-04 09:29:51 +02:00
Pauli Virtanen
55fc2ac7ef stream: ignore latency of monitor stream ports
Have monitor streams not affect the latency calculation of the ports
they are connected to.

Connecting monitor streams to ports (e.g. volume level monitoring)
should not affect latency values of other streams connected to those
ports.

This fixes e.g. just running pavucontrol from modifying latencies of all
existing ports.
2023-05-03 18:01:00 +00:00
Pauli Virtanen
6e17962ad0 impl-port/audioconvert: add PORT_IGNORE_LATENCY
Add port.ignore-latency prop, which if true causes peer ports to ignore
the latency of the given port.

This is useful for ports that are not intended to affect latency
calculations of other ports, such as ports in monitor streams.
2023-05-03 18:01:00 +00:00
Pauli Virtanen
85d2933268 module-access: add missing include
Ensure PATH_MAX gets defined also if no glib2.
2023-05-03 18:00:03 +00:00
Wim Taymans
1d872c5cde impl-node: restore previous signal_time
So that we can save if below and do the stats correctly.
2023-05-03 19:03:16 +02:00
Wim Taymans
107061bb77 module-jack: implement with pw-filter
It is faster and allows us to add midi easily as well.
2023-05-03 18:37:43 +02:00
Wim Taymans
09994f7141 filter: add more possible params
Support Format and EnumFormat node params to make it possible to
implement a sink.
2023-05-03 18:33:46 +02:00
Wim Taymans
ff6a86644b client-node: take data_loop and system from node 2023-05-03 18:18:12 +02:00
Barnabás Pőcze
2dd3a00bb5 spa: bluez: modemmanager: fix DBusMessage leaks
A DBusMessage needs to be unref-ed after sending it regardless
whether or not it was successfully sent. So do that in
`mm_dbus_connection_send_with_reply()` so that the callers
do not need to deal with that.
2023-05-03 11:27:25 +00:00
Barnabás Pőcze
4591cfcd37 spa: bluez: modemmanager: do not log message sender as warning 2023-05-03 11:27:25 +00:00