Commit graph

7062 commits

Author SHA1 Message Date
Wim Taymans
9856500a13 module-spa: evaluate node and device rules
Before loading the node or device spa plugin, evaluate the node and
device rules so that we can use them to configure the plugin properties
when it is loaded.
2024-06-10 10:26:06 +02:00
Wim Taymans
cfeb937443 context: add loader.rules
Add loader.rules that are executed right before the loader tries to load
the plugin with the info. This can be used to add or change properties
for the plugin.

One example would be to pass extra properties to the alsa or v4l2
plugin, even when this plugin is loaded by another process like
wireplumber.
2024-06-10 10:26:06 +02:00
Benjamin Cook
45758ecb68 Fixed two small typoes in documentation: conneced -> connected. 2024-06-07 07:21:09 +00:00
Wim Taymans
961134dc72 impl-node: improve xrun debug
We can now also detect xruns in the async nodes when we try to make them
NOT_TRIGGERED. Rework the debug of graph, sync and node xruns.
2024-06-05 15:37:15 +02:00
Wim Taymans
722e646f90 impl-node: add backwards compat for old clients
Bump the client-node version to 6. Older clients expect the server to
prepare the activation counters so make a flag to do that.
2024-06-05 15:37:15 +02:00
Wim Taymans
46f71b1cd2 Rework how targets are managed
Manage them like we do on the client and reuse logic. Make a node
function to safely add and remove a target.

Activate the targets from the process loop when we can be sure that we
can resume them. This avoids incrementing the pending state when we are
not going to be able to resume the nodes (like when the cycle is ongoing
and we have already been scheduled) and avoids glitches and xruns.

When a node is added to the poll loop, it can activate its own targets.
This is mostly for driver so that they have something to schedule and
can then activate the other targets.

Try to resume the target when it is removed and we are supposed to be
scheduled.

Also add targets to the target_list when the node is remote to make sure
the profiler can see the targets as well.

Keep the node in the INACTIVE state as long as the eventfd of the node
is not added to the loop. Skip nodes in the INACTIVE state from going to
the NOT_TRIGGERED status, which avoids scheduling the node.

Make sure we remove any local targets we have in a node when we export
it, we will receive new targets from the server.

This should eliminate any glitches when adding and removing nodes from
the graph.

See #4026, #2468
2024-06-05 15:37:15 +02:00
Tristan Cacqueray
ce985def73 loop: clarify the pw_main_loop_run returned value 2024-06-04 15:34:59 +00:00
Wim Taymans
1e9a557c06 module-ffado: keep track of transfered data
When for some reason we don't manage to transfer data from the source
or to the sink (timeout, scheduling problems..), try to do it when we
get a timeout to avoid xruns.
2024-06-04 16:53:56 +02:00
Jonas Holmberg
1deffe757c profiler: Decrease memory usage
Make flush buffer initially smaller and increase it when needed.
2024-05-31 07:29:47 +00:00
Robert Mader
e6f2aa6ce0 gst: src: Improve DMA_DRM caps selection
The translation between Pipewire parameters and Gstreamer caps is,
for compatibility reasons, ambiguous. Formats with linear modifier
are translated both in the legacy way as `format`, as well as
`drm-format`.

When finishing negotiation and setting caps, ensure that we:
1. set caps that the peer actually supports in order to prevent
   negotiation errors.
2. fixate caps to DMA_DRM if both options are supported, using the newly
   introduced helper, in order to prevent hangs.

While on it, add some small clean-ups that hopefully make the code
easier to follow, notably that `pwsrc->caps` and `pwsrc->possible_caps`
are only used during negotiation.
2024-05-29 19:29:02 +02:00
Robert Mader
05b1c9d0c8 gst: Add helper to fixate DMA_DRM caps
When support for modifier-aware DMA_DRM formats was added in f1b75fc6,
the translation between Pipewire parameters and Gstreamer caps was kept
compatible with the] non-DMA_DRM/legacy API by reporting format/modifier
combinations with linear or invalid modifier both as `format` and
`drm-format`.

In cases when a linear modifier ends up being negotiated, this, however,
resurts in non-fixated caps, preventing the negotiation to succeed.

Add a helper that allows to fixate such caps.
2024-05-29 19:05:53 +02:00
Robert Mader
adead74e8c gst: src: Indentation fix
Fixes: f400ff205 (gst: Check for video/ caps before parsing for info)
2024-05-29 18:52:06 +02:00
George Kiagiadakis
68711290bd gst: sink: post an element error when all buffers are removed abruptly
When the link on the pipewire side is destroyed, on video streams, buffers
are removed abruptly and there is no way this pipeline can be revived,
so let's post an element error to stop it.

On a normal shutdown, the pool is first set to flushing in change_state(),
so checking for the flushing state is a good indicator to know if this
is a normal shutdown or not.

See #1980
2024-05-29 10:39:31 +03:00
George Kiagiadakis
ef5f5d4c3c gst: pool: remove unused variable of unknown type 2024-05-29 10:39:31 +03:00
George Kiagiadakis
0b7a62ae02 gst: sink: improve debug messages related to buffer management 2024-05-29 10:39:31 +03:00
George Kiagiadakis
1e2618f314 gst: pool: add explicit remove_buffer method
This is for readability and better control.
Make sure we clear out all pointers to anything related to the released
pw_buffer, including all the memories.
2024-05-29 10:39:31 +03:00
George Kiagiadakis
40fd2553ea gst: pipewirepool: remove dead code 2024-05-29 10:39:31 +03:00
Wim Taymans
eaa3d04bcc impl-node: update required state atomically
We might be updating the required state from multiple threads in the
future.
2024-05-28 13:11:15 +02:00
Arun Raghavan
315dc7cdad gst: sink: Fix some object-less debug messages
We have the object, so there's no reason to skip that in the logs.
2024-05-28 13:47:30 +03:00
Arun Raghavan
1e3797512a gst/src: Check for 0 framerate before setting duration
This is possible if the source doesn't provide the framerate (as is the
case for libcamera), or if the framerate is variable (0/1).
2024-05-28 13:47:30 +03:00
Arun Raghavan
169e5ecd4b stream: Fix reference to pw_time.now in pw_stream_get_nsec() docs 2024-05-28 11:47:17 +03:00
Arun Raghavan
3cc5ca5a91 gst/src: Set buffer duration
We compute this from the clock quantum for audio and the negotiated
framerate for video.

Fixes: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/1438
2024-05-28 08:18:47 +00:00
Wim Taymans
ffb0eff708 impl-node: resume peer targets when unlinking
Atomically change the node status from TRIGGERED to AWAKE. Only trigger
the peer nodes when the node was previously in the AWAKE state.

When we remove a node from the graph or when we destroy a link, we need
to manually resume the peers. We can do this now by atomically setting
the node to FINISHED and checking if it was previously != FINISHED.

This ensures that removing nodes/links never leaves some nodes (and also
the driver) untriggered and cause a xruns.

Fixes #4026
2024-05-27 16:58:39 +02:00
Wim Taymans
9f32b89e5a impl-node: some cleanups 2024-05-27 16:58:39 +02:00
Wim Taymans
219d1e45c4 module-ffado: set next_nsec to something better
Add the duration of the period to the current nsec to get the next_nsec.
2024-05-27 16:58:39 +02:00
Arun Raghavan
f400ff2050 gst: Check for video/ caps before parsing for info
The gst_video_info_from_caps() API isn't really intended to be used as a
check-for-videoness function (it generates an error-level GStreamer
debug message when used this way).

We check the caps for a video/ name for this reason, which is
functionally equivalent.
2024-05-27 16:01:24 +03:00
Wim Taymans
26c1993e8a snapcast-discover: add snapcast discover module
The module detects remote snapcast servers and creates a new sink
with protocol-simple for each server.

It sets up a new stream on the server for the sink with JSON-RPC.
2024-05-23 12:41:53 +02:00
Wim Taymans
59c4e7645f protocol-simple: remove old debug line 2024-05-23 11:51:32 +02:00
Wim Taymans
378b196738 impl-node: don't move unprepared nodes
If a node was unprepared and we're moving it to another driver, don't
try to unprepare and prepare it to the new driver because then we end up
with a prepare node that should not be scheduled.

Fixes #4017
2024-05-22 10:26:54 +02:00
Wim Taymans
ccb9f89347 ffado: add priority.session property
It seems to be required to unselect it as default node in wireplumber.

Fixes #4023
2024-05-22 09:37:39 +02:00
Wim Taymans
7cfbd38cbb protocol-simple: handle IPv6
Handle ipv6 addresses.

Support 0 port, which uses a free port to listen on.

Place the list of addresses we listen on as a property of the module so
that dynamically allocated ports can be retrieved.
2024-05-22 09:23:31 +02:00
Diego Viola
7410755c03 Fix typos
found them with codespell.

Signed-off-by: Diego Viola <diego.viola@gmail.com>
2024-05-22 09:19:34 +02:00
Barnabás Pőcze
b3bd026699 pipewire: remove cleanup.h
Since `spa/utils/cleanup.h` is not a private header anymore, there is
no need for a separate `pipewire/cleanup.h` since the definitions of
the cleanup routines can now be moved into the respective headers.
2024-05-16 17:35:58 +02:00
Wim Taymans
d2ca50399a modules: add options to discover local services as well
This makes it possible to discover a local RAOP, pulse or RTP services
and connect to them.

IPv6 addresses need the interface appended to local addresses to
make the connection work.
2024-05-15 15:39:27 +02:00
Jonas Holmberg
d8a32e5272 impl-port: update added flag from rt thread
Avoid trying to remove a port before it has been added.
2024-05-15 09:27:33 +00:00
Wim Taymans
bd4d61c83c raop: use pw_net utils to parse address 2024-05-15 11:26:12 +02:00
Barnabás Pőcze
46e4a33f27 pulse-server: message: use union to store event data
Store subscription event data in a union instead of
just an array for better readability.
2024-05-15 08:31:40 +00:00
Barnabás Pőcze
d467f6fdc6 pulse-server: client_queue_subscribe_event(): check message allocation 2024-05-15 08:31:40 +00:00
Arun Raghavan
db365ac855 impl-node: Expose driver id in node.props
Makes it easier for clients to track what the current driver of a node
is.
2024-05-14 20:04:13 +00:00
Wim Taymans
78fbe6f750 protocol-simple: add per stream properties and formats
Add capture.props and playback.props to configure the created streams
with arbitrary properties.

Improve format parsing, make it possible to have different formats peer
stream.

Improve some of the property handling.

This can now also be used to upload a stream to a snapcast server, add
an example of this to the docs.
2024-05-14 17:30:05 +02:00
Wim Taymans
d7df3811e1 tools: queue the buffer again in all cases 2024-05-09 19:32:37 +02:00
Wim Taymans
b2844201c2 impl-node: update rt flags from rt threads
Update the added and prepared flags from the rt thread.

We also need to check if the node was prepared before we can schedule
it.
2024-05-08 17:14:32 +02:00
Wim Taymans
fac0d47c23 impl-port: swap io areas instead of doing cycle math
Instead of doing (cycle+1) & 1 for output ports, simply swap the io
areas depending on the port direction (0 = input, 1 = output) and
just to cycle&1 for all ports.
2024-05-08 10:45:53 +02:00
Wim Taymans
03d62dc756 impl-port: input ports read from io cycle & 1
Input ports read from the async buffer cycle & 1 and output ports write
to (cycle + 1) & 1
2024-05-08 10:45:53 +02:00
Sanchayan Maity
9d94db6646 parametric-equalizer: Use field widths in sscanf 2024-05-07 15:43:10 +05:30
Sanchayan Maity
6c6f944e53 Fix doc build pipeline failing with parametric-equalizer module 2024-05-07 09:04:15 +00:00
Sanchayan Maity
68ed40570d Add a module for loading Parametric EQ
Websites like squig.link or https://www.autoeq.app/ generate a file for
parametric equalization for a given target, but this is not a format
that can be directly given to filter chain module.

This module translates the file to filter chain module arguments and
then loads the filter chain module with these arguments.
2024-05-07 11:37:48 +05:30
Wim Taymans
a30c27dce0 pulse-server: add pulse.allow-module-loading option
Add an option to disable loading and unloading of modules with the
native protocol.

Document some more options.
2024-05-06 15:28:43 +02:00
Wim Taymans
a3ccbd00b4 pulse-server: implement describe-module with core message
Implement the old pacmd describe-module command with a core message:

pactl send-message /core pipewire-pulse:describe-module
module-echo-cancel
2024-05-06 11:39:52 +02:00
Barnabás Pőcze
6d7b0284dd pw-dump: destroy all objects not just those matching the pattern
`registry_event_global()` creates an `object` object for every object,
not just those matching `data::pattern`. However, previously
`registry_event_global_remove()` only destroyed those objects
that matched the given pattern. Fix that by destroying
every object.

Fixes #4001
Fixes 47e1f38f03 ("pw-dump: also dump object removal")
2024-05-05 16:39:42 +02:00