LADI
/
spa
1
Fork 0
Commit Graph

2005 Commits

Author SHA1 Message Date
Wim Taymans 2ee7996cf7 impl-node: improve stats
The signal_time of the driver is supposed to be the time when the
driver started, not when it was signaled the last time to complete
the graph. Remember the start time and override the signal time when
the graph completes.
2023-05-25 20:22:49 +02:00
Wim Taymans 3d68c7124d impl-node: drivers run remotely now
Remove some code now that drivers also run remotely.
2023-05-25 20:06:38 +02:00
Wim Taymans a5b845650e remote-node: only signal graph end when profiling
Add a flag to the activation to mark the node as being profiled.
Only wake up the eventfd in remote-node when the profiler is running.

This keeps the server sleeping when remote nodes are driving and the
profiler is not running.
2023-05-24 22:40:28 +02:00
Wim Taymans 5fcc0e1181 filter: fix warning 2023-05-24 18:24:06 +02:00
Wim Taymans 8303082024 stream: do fast calls for the process function
We checked it while registering.
2023-05-24 18:01:41 +02:00
Wim Taymans 3605eae6ad impl-node: fix compilation 2023-05-24 17:38:40 +02:00
Wim Taymans 2994c48702 impl-node: only copy relevant fields from target
We can't copy the link or active state.
2023-05-24 14:35:47 +02:00
Wim Taymans 894eeae03c impl-node: add id and name to pw_node_target
Make a copy of the node name into a statically allocated array. This is
for debugging purposes only but might crash if we do a name change while
the data thread is reading it.

Make it possible to do reposition on the client side by copying the id
to the target. The client side does not have a node in the target so we
can't deref it.
2023-05-24 14:05:03 +02:00
Wim Taymans b74f2e19a7 impl-node: remove duplicated fields
Move all of the info to trigger a node into the target so that
we can copy it around easily.
2023-05-23 16:46:30 +02:00
Wim Taymans b8fe832188 impl-node: run the remote driver node logic remotely
Don't signal the pipewire daemon to run the driver. We can transfer the
complete driver state to the client and run everything there.
2023-05-22 17:10:01 +02:00
Wim Taymans a46076b207 Revert "impl-node: run the remote driver node logic remotely"
This reverts commit 2f67a6a5b4.

This needs more work and makes easyeffects fail
2023-05-22 14:54:38 +02:00
Wim Taymans 79d1278b2e fix -UFASTPATH compilation 2023-05-22 11:30:38 +02:00
Wim Taymans 46add98c0a impl-node: remove warning 2023-05-22 11:06:49 +02:00
Wim Taymans 7ffe64f7af client-node: make old driver nodes work
Bump the client-node version because we use the writefd differently now.
Support driver nodes using the old version somewhat. The stats will be
wrong but then again, we don't have any flatpak driver nodes that could
use an older version.
2023-05-22 11:03:20 +02:00
Wim Taymans 5c7c12638d impl-node: do stats at the end of the cycle
For remote nodes we don't activate the server anymore so the stats
won't reach the server anyway. It's better to do them at the end of the
cycle again.
2023-05-22 10:29:59 +02:00
Wim Taymans 2f67a6a5b4 impl-node: run the remote driver node logic remotely
Don't signal the pipewire daemon to run the driver. We can transfer the
complete driver state to the client and run everything there.
2023-05-22 10:29:13 +02:00
Wim Taymans 3f46044c39 impl-node: update xrun_count of late nodes
When the graph didn't complete, update the xrun_count in each node
that didn't complete.

We can then remove the code to simulate that from pw-top.
2023-05-22 10:24:51 +02:00
Wim Taymans de9b28f783 context: don't use fallback driver if priority_driver <= 0
The drivers with priority_driver <= 0 should not be used as a fallback
driver for audio ever because it does not do the timing correctly.

One example is the screencast driver.

Fixes #3219
2023-05-22 09:48:51 +02:00
Wim Taymans c5e1515b7a context: add method to add/remove context listener 2023-05-21 15:45:45 +02:00
Wim Taymans 9192892d08 impl-node: always resume non-driver nodes when finished
We don't really have a mechanism to do async resume and OK is now
emitted by the filter when nothing happened.
2023-05-19 18:07:53 +02:00
Wim Taymans f085a1fa49 impl-node: improve graph xrun detection
Simply check for the state of the activation.
2023-05-19 15:25:14 +02:00
Wim Taymans 606bbefaa4 filter: return better value from process() 2023-05-19 13:33:39 +02:00
Wim Taymans 0ab335d041 stream: improve debug 2023-05-19 13:33:32 +02:00
Wim Taymans 5a12b35be7 stream: fix state changes 2023-05-17 12:01:57 +02:00
Wim Taymans 65a5272a9f stream: keep error res around
So that we can return it when there is an error instead of the generic
-EIO.
2023-05-17 11:00:52 +02:00
Wim Taymans 318bb0b442 context: Don't stop at driver nodes, only driving nodes
Don't stop collecting runnable nodes when we find a driver, only a
driving node. Otherwise we would skip nodes between virtual sinks and
the real sink when the virtual sink is not driving.

Fixes #3220
2023-05-16 16:44:27 +02:00
Wim Taymans 26e9a4ce13 impl-node: add some comments 2023-05-15 15:42:37 +02:00
Wim Taymans 988fc9692a impl-link: only activate links between runnable nodes
The node might be active but passive, in which case it will not run and
there is no need to schedule it.

Fixes #3215
2023-05-14 20:55:38 +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 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 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 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 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 12b6adb10c filter: fix compilation with -UFASTPATH 2023-05-06 08:29:28 +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 f5a10cb734 filter: remove some unused code
Add some SPA_LIKELY
2023-05-05 21:33:28 +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 67c38490a5 move some trace to trace_fp 2023-05-05 17:41:13 +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 11c478d0fa improve debug of commands and events
Add the type name in the log.
2023-05-04 13:03:40 +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
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 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 caeaaf9c24 impl-node: work around old clients
Old clients (screencast) set the TRIGGERED state before signaling
node_ready, which causes errors in pw-top. Patch this up here.
2023-05-03 12:51:34 +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