Commit Graph

12535 Commits

Author SHA1 Message Date
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
05abc4e41f jack: rename a function
Add/remove_link is more what this function does.
2024-06-04 17:15:54 +02:00
Wim Taymans
fa154955af jack: update the eventfd from the data loop
Also update the variables we use from the data loop.
2024-06-04 17:14:02 +02: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
Silviu Florian Barbulescu
e4432190f7 Add broadcast sink support for multiple BISes 2024-05-30 13:37:27 +00:00
George Kiagiadakis
d1a6b8f23f ci: bump fedora version to 40 and alpine to 3.20
Latest alpine has gstreamer 1.24, which we should be compiling against because
the DMA_DRM code paths are not compiled with older versions. Unfortunately,
this is yet not in fedora 40.

Latest fedora is bumped just because. We should always test against latest
fedora and the previous ubuntu LTS, to make sure we support a relatively wide
range of system versions.
2024-05-30 13:31:34 +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
Vlad Pruteanu
0b5f716526 bluez5: bap: Support Mono Channel Allocation
The Bluetooth SIG Assigned Numbers Document has been updated and a
value of 0 for the Channel Allocation is now allowed, with the
meaning of "Mono".
2024-05-28 16:42:08 +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
Arun Raghavan
2f9a5e0694 alsa: Use hw:X for accessing card ctl
In ACP mode, we might be accessing front:0 as the PCM, and using that
string to generate the ctl device name does not make sense. In
PulseAudio, we used the card index to generate a hw:X string, and we
replicate that here.

Fixes: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/4028
2024-05-28 10:39:24 +03:00
Silviu Florian Barbulescu
5be2f5e096 Resolve problems found on review 2024-05-27 16:08:36 +00:00
Barnabás Pőcze
625c0f5784 Apply 1 suggestion(s) to 1 file(s)
Co-authored-by: Barnabás Pőcze <pobrn@protonmail.com>
2024-05-27 16:08:36 +00:00
Silviu Florian Barbulescu
1259829ac3 Remove device and transport for broadcast source on interfaces_removed 2024-05-27 16:08:36 +00:00
Silviu Florian Barbulescu
ab87eba149 Add support for the broadcast source multiple BIS implementation in BlueZ. 2024-05-27 16:08:36 +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
7eeb657d37 1.1.82 2024-05-24 11:48:53 +02: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
Wim Taymans
8a24ad3073 acp: handle some errors better
Handle allocation failure and size overflow.
2024-05-20 11:22:46 +02:00
Pauli Virtanen
a63aa6329b spa: fix integer overflows etc. in spa_pod_compare_value
Add macro SPA_CMP to do 3-way comparisons safely, and use it to avoid
signed integer overflows.

Fix also float/double comparisons (previously 0.1 == 0.8 since cast to
return type int).

Fix Id/Bool comparisons so they can return negative value.
2024-05-20 09:11:25 +00:00
Pauli Virtanen
b94d6e53a1 bluez5: use initial SCO RX wait workaround only for USB controllers
Kernel-provided MTU does not work for USB controllers and the correct
packet size to send can be known currently only from RX. So we are
waiting for RX to get it.

The known problem is USB-specific, we shouldn't need the workaround for
other transport types.

Don't wait for POLLIN for non-USB controllers on connect, but ready
things on POLLOUT as usual.

For non-USB controllers, pick some sensible packet sizes to use
initially, before we switch to same size as for RX.
2024-05-18 13:53:45 +03: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
80df1957bf NEWS: fix spelling mistake 2024-05-16 10:37:44 +02:00
Wim Taymans
e37a1e25fc 1.1.81 2024-05-16 10:25:45 +02:00
Barnabás Pőcze
354387ca58 pipewire-v4l2: redirect to correct functions from fortified variants 2024-05-16 01:53:38 +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