Commit graph

12525 commits

Author SHA1 Message Date
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
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
Barnabás Pőcze
8e495a3a2c spa: libcamera: remove unused includes 2024-05-15 08:31:03 +00:00
Barnabás Pőcze
55fafe8f0b spa: libcamera: remove two unused members 2024-05-15 08:31:03 +00:00
Barnabás Pőcze
87368c8e4f spa: libcamera: remove wrong prefix from log message 2024-05-15 08:31:03 +00:00
Barnabás Pőcze
b7ef5c92bc spa: libcamera: remove unnecessary snprintf() 2024-05-15 08:31:03 +00:00
Barnabás Pőcze
9eab76d862 spa: libcamera: don't calculate id twice 2024-05-15 08:31:03 +00:00
Silviu Florian Barbulescu
bb1c2c3272 Fix review comments, added METADATA_VALUE_MAX_LEN and removed entry_key in configure_bis. 2024-05-15 08:11:50 +00:00
Pauli Virtanen
345131475c bluez5: cleanup bluez5.bcast_source.config parsing
Also fix doc.
2024-05-15 08:11:50 +00:00
Silviu Florian Barbulescu
44d96ed4b9 bluez: on metadata, parse remove the length field, and deduce the length from the value plus type 2024-05-15 08:11:50 +00:00