Commit graph

6266 commits

Author SHA1 Message Date
Wim Taymans
ccd118368e pw-metadata: add -l option to list available metadata 2023-04-14 15:06:55 +02:00
Wim Taymans
6394eb1b18 metadata: return pw_metadata from factory create
That is what the factory return value says.
2023-04-14 12:50:07 +02:00
Wim Taymans
c968259348 module-rtp: silence some debug 2023-04-14 12:17:43 +02:00
Wim Taymans
a275e825c7 context: improve state calculations
Always make peers of non-passive links runnable, even if we already
visited the peer node. This makes non-passive links between drivers set the
drivers to runnable. (midi-bridge, source to sink). It also makes nodes
collected from the (link-)group runnable when they are linked together.

To calculate the runnable state of the other nodes, only start from
non-driver runnable nodes (like we already did when following links).

This makes a link from echo-cancel-source to echo-cancel-sink activate
the echo-canceler chain instead of staying idle.
2023-04-14 12:01:03 +02:00
Wim Taymans
0962555291 gst: implement renegotiation
If the stream format changes, set the basesrc caps again before pushing
a new buffer.

See #3147
2023-04-14 10:42:01 +02:00
Wim Taymans
b84083a1bb pulse-server: improve echo-cancel aec_args parsing
Actually convert the aec_args argument to something that the
echo-canceler will understand. Add the beamforming and mic-geometry
and target_direction properties.
2023-04-13 17:38:26 +02:00
Wim Taymans
94a1531ec5 thread-loop: remove callbacks in destroy
Make sure the pw_loop doesn't call our callbacks anymore after we are
destroyed.

See #3150
2023-04-12 16:46:39 +02:00
Robert Mader
5fc782b893 pipewireclock: Disable clock_reset() for now
This was introduced in 4faa28fd96 in order to correctly map the time
from the stream. From d52df30c88 on, however, the clock switched to
monotonic time, which does not need the extra-offset.

Disable `clock_reset()` for now but leave it in place so we can easily
reenable it once we use the stream time again.

This fixes video recording in Cheese and similar apps.

Closes https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/3149
2023-04-12 10:13:54 +00:00
Wim Taymans
bd04af6cc9 context: handle non-passive driver links to itself
A non-passive link between the driver and itself should make the driver
active as well.

This makes the midi-bridge running when linking its ports. It also activates
a sink when its monitor ports are connected to its playback ports.

Fixes #3153
2023-04-12 12:05:47 +02:00
Wim Taymans
2a5c23c811 module-echo-cancel: support different channels per stream
Make the channels configurable for capture, source, playback and
sink streams. The playback and sink stream need to have the same number
of channels but the layout can be different.

Use init2 of the echo-cancel plugin when available to pass this info
around. The echo-canceler will then further adjust the settings to make
things work.
2023-04-11 16:55:48 +02:00
Wim Taymans
8748c77451 context: make driver runnable when we add a runnable node
Explicitly make the driver runnable when we add a runnable node to it.

We have to do this because the runnable node might not be directly linked
to this driver.

In the case of the echo-canceler, for example, a playback stream
can be linked to the sink before the echo canceled virtual sink.
All echo-cancel nodes are added to a source driver, which would not be
activated because there is no direct path from the playback stream
to the source river.

Fixes #3145
2023-04-11 16:31:44 +02:00
Wim Taymans
f64c21ed81 filter-chain: fix bq_raw activate
The raw biquad takes its values from the config and then updates the
control ports with them in activate. At runtime, the changes to the
ports are applied to the biquad.

Other biquads take values from the config ports in activate.
2023-04-07 16:45:28 +02:00
Wim Taymans
880c1b0bd6 module-filter-chain: add raw biquad
Add bq_raw that allows access to the raw biquad filter values.

Fixes #3139
2023-04-06 18:28:49 +02:00
Wim Taymans
148569279b pulse-server: add enable_opus support in rtp-send 2023-04-06 12:10:46 +02:00
Wim Taymans
0520db8d5f module-sap: add opus to sap receiver 2023-04-06 12:10:25 +02:00
Wim Taymans
e5cf9ba1fd modules: update docs 2023-04-06 11:49:25 +02:00
Wim Taymans
7f7821c3f2 module-raop: handle 0 timing_port
When the timing_port is 0, just don't send out an initial timing packet.

When we receive a timing packet, reply to the same address/port that the
timing packet was sent from.

Fixes #3133
2023-04-04 17:55:02 +02:00
Wim Taymans
e0a09ccf31 private: don't block context related problems, just emit a warning 2023-04-04 16:20:10 +02:00
Wim Taymans
74831aa967 support: add support for checking loop context
Add check for running the the loop context and thread.

Add checks in filter and stream to avoid doing things when not run from
the context main-loop because this can crash things when doing IPC from
concurrent threads.
2023-04-04 16:19:41 +02:00
Wim Taymans
a6497839bb stream: move some code around
So that we don't have to call public API internally. We might want to
add some checks there later that don't need to happen when called
internally.
2023-04-04 16:16:47 +02:00
Wim Taymans
f2be2923e6 thread: use pthread_equal to compare thread ids 2023-04-04 12:43:25 +02:00
Wim Taymans
edbfd180d0 thread-loop: only restore recurse on error
Only restore the previous recurse state when we fail to unlock.
2023-04-04 12:20:56 +02:00
Wim Taymans
aa2ea737c7 thread-loop: add some additional check
Check for errors from pthread_ functions and log an error.
Check the recursion count to check if locks were correctly taken.
2023-04-04 11:34:03 +02:00
Wim Taymans
796a0d2cfe thread-loop: small cleanup
Use named fields for the event, prefix function.
2023-04-04 11:12:13 +02:00
Wim Taymans
8b1902c825 echo-cancel: reset buffers in suspend
Or else some stay samples from the previous run might be played when
resuming.
2023-04-04 10:17:44 +02:00
Wim Taymans
9664787cff context: Only activate runnable nodes
Rework the runnable state calculation. It works in 2 steps now:

1. Collect all nodes linked to a driver in some way. Mark nodes that
   are reachable with a non-passive link as runnable.
2, Go through all runnable nodes and set all linked nodes to the
   runnable state as well, up to the driver.

Step 2 is new. Previously if there was just one runnable node, *all*
nodes would be set to runnable. With the addition of step 2, some nodes
might remain idle when they are not used.

This has the effect that virtual sinks without inputs stay idle when
the driver is otherwise running. Grouped nodes (like the RTP session)
will now also only run the linked nodes.
2023-04-04 10:17:44 +02:00
Wim Taymans
35d2bce24b context: also follow link-groups
Nodes from the same link-group also need to be linked together to the
same driver.
2023-04-03 16:59:17 +02:00
Wim Taymans
147674c5dd Revert "context: handle link-group nodes"
This reverts commit 2bfe772bb4.

This does not take into account nodes recursively becomming runnable and
so does not set the runnable state on all nodes correctly, like for
combine-stream.

Revert for now, it probably requires a new algorithm to make this work.

See #3128
2023-04-03 10:25:58 +02:00
Wim Taymans
0873c6942a stream: don't crash when _set_control is given 0 values 2023-03-31 11:28:55 +02:00
Wim Taymans
bed961a4b2 keys: update comment 2023-03-31 10:33:20 +02:00
Wim Taymans
9485b2819a impl-node: add support for node.force-rate=0
If you set node.force-rate=0, the rate will be forced to the node.rate
denominator.

This makes it possible to autiomatically make the graph switch to the
native rate of the stream by setting this as the default property on
streams.

See #3026
2023-03-31 10:30:36 +02:00
Wim Taymans
7372a078b4 context: don't try to restore rate on !runnable nodes
There is no point in trying to restore a node to the default rate when
it's not going to run.

This avoids loops when rate switching from one forced rate to another.
2023-03-31 10:14:36 +02:00
Wim Taymans
917d865ea8 stream: invoke RequestProcess in the main loop
pw_stream_trigger_process() can be called from any thread but the
RequestProcess event always needs to be scheduled in the main-loop.
2023-03-30 16:39:32 +02:00
Wim Taymans
d3bd687bc2 buffers: add new ASYNC flag
Make sure we allocate at least 2 buffers when we are dealing with an
ASYNC node. This ensures that an adapter without a converter will at
least negotiate to 2 buffers when the follower stream is async (such as
is the case with pw-cat).
2023-03-30 15:03:29 +02:00
Wim Taymans
a163f29a43 improve logging 2023-03-30 15:03:21 +02:00
Wim Taymans
7bddb80c93 pulse-server: improve Buffer param
We need to be able to fill up one quantum of data when the stream
requests it so suggest a quantum_limit buffer size. Normally, the
converter will further improve the buffer size parameters when
resampling is involved but this is a good default for when working in
passthrough mode.

We don't actually use the stream buffering features so we're happy with
just 1 or 2 buffers.
2023-03-30 10:13:43 +02:00
Wim Taymans
f28c30d526 impl-link: only make passive links with suspendable peers
Only make a passive link when one of the peers is passive and the other
one can be suspended or when both are explicitly passive.

This avoid making passive links between a sink/source pair.

It also avoid making passive links between two streams if they are not
explicitly marked as passive.

It does allow making passive links between a passive stream and a
sink/source or between two passive streams.
2023-03-28 18:14:19 +02:00
Wim Taymans
c84ef9e29a Revert "impl-link: make passive link if both ports are passive"
This reverts commit 6a64b4461e.

Now that sinks and sources are no longer passive by default, we need
just one part of the link to be passive to make things passive.

This breaks the stream recording from a passive stream case but we can
find a different fix for that later.
2023-03-28 17:32:02 +02:00
Wim Taymans
0f27432f8c Revert "impl-node: assume Sink/Source nodes are passive"
This reverts commit 67999f0f9c.

This breaks direct links between two devices because all ports are
passive. This needs some more thinking.
2023-03-28 17:32:02 +02:00
Harri Nieminen
4323a8ad4a module-pipe-tunnel: remove extra whitespace 2023-03-28 13:36:16 +00:00
Wim Taymans
2bfe772bb4 context: handle link-group nodes
Nodes with the same link-group should be added to the same driver.

Also the runnable state of the nodes in the same link group is
shared between eachother. This makes it look like the linked nodes are
really just one big node.

With this change we correctly calculate the state of all nodes and we
can then only set the running state on the runnable nodes.

If you have 2 loopback sinks in front of a driver, this change will
only make the used loopback sink running and keep the other one
idle. It also works for grouped nodes, where only the active nodes
will now be running (such as rtp-session nodes).
2023-03-28 15:19:16 +02:00
Wim Taymans
93e6e98a17 module-link-factory: ignore link.passive by default
Make an option to allow link.passive properties and set it to false by
default.

This effectively ignores the link.passive properties from the session
manager, jack clients and pw-link when set. This is a good idea because
the logic for making passive links is better handled in the core.
2023-03-28 15:19:16 +02:00
Wim Taymans
67999f0f9c impl-node: assume Sink/Source nodes are passive
If not otherwise stated, assume the Sink and Source nodes
are passive.
2023-03-28 15:18:50 +02:00
Wim Taymans
6a64b4461e impl-link: make passive link if both ports are passive
Only make a passive link when both ports are passive.
Otherwise, adding a monitor stream on the loopback output stream will
make a passive link.
2023-03-28 11:58:32 +02:00
Wim Taymans
c8bfa69320 context: init flags before starting recalculate
Init the node flags before recalculating the graph state. There is no
reason to do this later.
2023-03-28 11:52:36 +02:00
Wim Taymans
8fca3808d8 impl-node: only update the trigger node state once
Don't increment the required activation count every time we change the
node prorties with a TRIGGER property. Only increment/decrement when the
value actually changed.
2023-03-28 09:48:21 +02:00
Wim Taymans
08642adddc module-rtp: free the avahi client as well 2023-03-27 16:01:50 +02:00
Wim Taymans
f6e25c239f module-pulse-tunnel: don't unload module from pulse thread
We are not allowed to call pipewire methods from any other thread than
the main thread so use invoke to schedule a module unload from the
pulseaudio thread.

Fixes some infinite loops when the work-queue list gets corrupted.
2023-03-27 11:10:12 +02:00
Wim Taymans
6363bbd1b9 stream: we should not update clock automatically
A driver node should update the clock before it starts the graph
cycle.
2023-03-27 09:52:15 +02:00
Niklāvs Koļesņikovs
265f7dd09f src/daemon: move the optional drop-ins to conf.avail
These drop-ins are not meant to be enabled by default, so let's move
them to fontconfig style *.conf.avail/ subfolders from which they can
be copied or symlinked to a location that will get merged into the
corresponding configuration file.

Signed-off-by: Niklāvs Koļesņikovs <89q1r14hd@relay.firefox.com>
2023-03-27 07:19:27 +00:00