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.
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.
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.
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.
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.
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
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
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
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.
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
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.
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.
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.
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.
Avoid doing the interface unref and version check for each iteration but
do this before entering the loop. Improves performance in high frequency
wakeups.
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.
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.
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.
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.