Commit graph

2818 commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
ff6a86644b client-node: take data_loop and system from node 2023-05-03 18:18:12 +02:00
Pauli Virtanen
10352dbaa5 pulse-server: combine-sink: add latency_compensate option
Add option to turn on latency compensation in module-combine-stream.
2023-05-03 11:22:01 +00:00
Pauli Virtanen
cc5da73665 module-combine-stream: add option to add delays for latency compensation
Add combine.latency-compensate option, which uses delay buffers to
compensate for different latencies in the target streams.
2023-05-03 11:22:01 +00:00
Wim Taymans
e24d7cc8b7 module-jack: don't crash when NULL source/sink
It is possible that we destroyed the source/sink when we get a latency
update from jack, don't try to update the source/sink in that case or
we will crash.
2023-05-03 13:04:58 +02:00
Wim Taymans
ea1385ffe0 jack-tunnel: use cycle_wait/cycle_signal
Use cycle_wait and cycle_signal so that we can avoid using a semaphore
and resume the jack graph right after we finish the pipewire graph.
2023-05-03 11:51:13 +02:00
Wim Taymans
bcbb6e42e7 remote-node: don't send signal/awake time in ready
Let the server calculate signal time when it starts the graph. Otherwise
we overwrite old values and we can't do stats.

We might be able to piggyback the signal time in the prev_signal_time
field later.
2023-05-03 11:06:14 +02:00
Christian Glombek
b6b8035b0d module-raop-sink: Add default PW_KEY_DEVICE_ICON_NAME prop
Default icon prop to "audio-speakers"
2023-05-02 17:08:09 +00:00
Wim Taymans
f8663ab31c client-node: activate using the node eventfd
Don't make an extra eventfd for activating the remote-node, we can
use the server side eventfd and send them to the remote side using
the transport.

The remote node already adds the eventfd to the data-loop so avoids
doing the same on the server.

This makes driver nodes trigger all remote nodes directly instead of
going through an intermediate eventfd. For resuming nodes, we already
used the node eventfd directly so this only a small optimization
for the initial cycle start.
2023-05-02 18:47:10 +02:00
Pauli Virtanen
7d4491ce6b module-combine-stream: add latencyOffsetNsec prop
Add latencyOffsetNsec prop to the combine node.

This is mainly useful for BAP device sets; the property appears in
Pulseaudio UI only when the node is associated with a device.
2023-05-02 13:43:56 +00:00
Wim Taymans
6bbe64a64b node: small cleanups and debug improvements 2023-05-02 14:11:37 +02:00
Wim Taymans
adb7559359 impl-node: fix timing for client-nodes using trigger
For client-nodes that use trigger, set the signal and wakeup time when
they start the server node. Also set finish time before we resume the
peers on the server.

Client-nodes should really resume the peers directly without going
through the server but this is something to improve later.
2023-05-01 13:37:44 +02:00
Wim Taymans
c23c27b566 module-raop: fix warning on uninitialised res variable 2023-05-01 09:59:55 +02:00
Christian Glombek
0bb0b524c7 raop: Deduplicate sink creation
Currently, RAOP sinks referencing the same remote ip and port may be created multiple times:
One each for IPv4 and IPv6, times the number of network interfaces used for mDNS discovery.

A recent change added `(IPv4)`and `(IPv6)`identifiers to the sinks' pretty names, however that
is misleading, as often times the service advertised through an mDNSv6 record is actually an
IPv4 service (i.e. the IP reference contained in the IPv6 record may be an IPv4 address).

With this change, sink creation is skipped if a sink with the same advertised name already exists.
2023-05-01 07:48:19 +00:00
Pauli Virtanen
0e831c52d8 module-access: determine trusted application executable
Determine application executable file so that the result can be trusted,
and the file exists in the current namespace.

Don't use /proc/pid/cmdline, since that contains whatever was specified
by the exec() call.
2023-05-01 07:44:08 +00:00
Pauli Virtanen
a6481c48aa module-combine-stream: propagate latency
Propagate latency information from the target streams to the combine
stream.
2023-04-30 19:02:52 +00:00
Wim Taymans
90c8cb42ff meson: fix filename 2023-04-30 10:39:06 +02:00
Wim Taymans
4a81c17b68 modules: add jackdbus-detect module
Loads jack-tunnel based on jackdbus state.
2023-04-30 10:34:19 +02:00
Wim Taymans
39f9fa9c05 jack-tunnel: let client cleanup continue in on_shutdown
We should close the client eventually so don't set the client to NULL.
2023-04-30 10:19:51 +02:00
Wim Taymans
56c59630c9 Revert "jack-tunnel: run graph from JACK thread"
This reverts commit d89df144f0.

This is not better than using a semaphore and the regular data thread.
2023-04-28 17:17:04 +02:00
Wim Taymans
d89df144f0 jack-tunnel: run graph from JACK thread
Stop our own data-loop and enter/iterate/leave it from the jack thread.
This runs all our nodes in the JACK thread and removes 2 context
switches (jack to and from pw thread).

We can possibly do this nicer by only pushing our own streams onto a
new custom data-loop but that's for later.
2023-04-28 17:06:29 +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
9e7921b37d module-jack: improve xrun reporting 2023-04-27 18:10:41 +02:00
Wim Taymans
381aa90b54 module-jack-tunnel: improve some docs 2023-04-27 17:22:05 +02:00
Wim Taymans
ab0cee29dd doc: add jack-tunnel to docs 2023-04-27 17:03:10 +02:00
Wim Taymans
73f5f7ae65 jack-tunnel: add a new 0-latency JACK sink/source module
Add a new JACK sink/source pair that translates to a single JACK
client.

The JACK playback port appears as PipeWire source and is processed
directly, synchronously, through the complete pipewire graph into
the PipeWire sink that is then made available on the JACK capture
ports.

Because all this happens in the same JACK cycle with no delay, the
latency is 0. A jack_iodelay on the JACK server has exactly the same
latency as the jack_iodelay on the PipeWire side.

The PipeWire sink and source are forced into the same rate and
buffer_size as the JACK server and can't dynamically change.

This only supports Audio for now.
2023-04-27 16:27:54 +02:00
Wim Taymans
9eb1633b02 protocol-native: don't remove all fds in clear
When we consumed all the buffer data, don't clear all the fds but only
those that were already consumed in the message. It is possible that we
already have fds for the next message and we don't want to discard
those.

Fixes some intermittend memory map errors.
2023-04-27 11:03:53 +02:00
Wim Taymans
3cae535da0 impl-node: calculate stats at cycle start
Calculate the stats at the start of the new cycle. The results will be
about the previous cycle but this gives more accurate results because
we can also include awake and finish times of remote nodes.

Make sure not to change the status of the activation in the ready event
so that we don't overwrite the status of the last cycle yet.

This means we can always set the AWAKE and awake_time, the remote node
might update it when triggered but that's ok.

After processing we can update the FINISHED state for non-remote nodes,
the remote nodes will update it after they complete the process
function.
2023-04-27 09:34:07 +02:00
Wim Taymans
5303fced50 client-node: pass the ready status in the activation state
Pass the ready status to the client-node using the state array.

Don't just SPA_STATUS_HAVE_DATA on the server side but use the value
from the client.

This avoids some potential extra work when a driver sink pulls in data
with the NEED_DATA ready callback but then the server performs the
actions (tee) as if it were SPA_STATUS_HAVE_DATA.
2023-04-26 15:56:29 +02:00
Wim Taymans
989f597860 client-node: update the driving node status
Look at the clock and position to see if we are selected as the driver
or not.
2023-04-26 15:47:41 +02:00
Wim Taymans
12bc69a469 raop-sink: only set volume when connected
Only attempt to set the volume when connected. Apply the current
volume after connecting.

Based on patch by Tycho Haemers

Fixes #3175
2023-04-22 11:16:55 +02:00