Commit graph

13477 commits

Author SHA1 Message Date
Vinit Mehta
6e57510d6b doc: Add BAP QoS config & select option
This adds configuration options for BAP unicast QoS based on user
config parameters
2025-04-14 07:26:28 +00:00
Vinit Mehta
55372a41b1 bluez5: Add support to select BAP QoS config
The current BAP QoS configuration allows to register a sampling
frequency based on the configuration done using wireplumber configuration.
However, for a scenario were the user need to use a specific SDU framelength
it cannot be done as the select_bap_qos function selects the QOS based on
priority and hence it will use the best possible config rather than the user
configured.

This PR adds option to select the QoS set based on user configured value. If
the remote device doesn't have the user configured capabilities it will always
use the best priority config.

Further, this change also allows the user to set RTN, Latency, Delay QoS config
for certain use case to have controller use optimum bandwidth usage.

Below are the example configuration on setting LC3 capabilities in config file:

bluez5.bap.set_name = "48_2_1"
bluez5.bap.rtn = 5
bluez5.bap.latency = 20
bluez5.bap.delay = 40000
bluez5.framing = false
2025-04-14 07:26:28 +00:00
Vinit Mehta
d22a4d60b3 doc: Add BAP QoS config & select option
This adds configuration options for BAP unicast QoS based on user
config parameters
2025-04-14 07:26:28 +00:00
Vinit Mehta
6dfb164cab bluez5: Add support to configure & select BAP QoS config
The current BAP unicast QoS configuration allows to register a sampling
frequency based on the configuration done using wireplumber configuration.
However, for a scenario were the user need to use a specific SDU framelength
it cannot be done as the select_bap_qos function selects the QoS based on
priority and hence it will use the best possible config rather than the user
configured.

This PR adds option to select the QoS set based on user configured value. If
the remote device doesn't have the user configured capabilities it will always
use the best priority config.

Further, this change also allows the user to set RTN, Latency, Delay QoS config
for certain use case to have controller use optimum bandwidth usage.

Below is the example for the options that can be configured & selected
in config file:

bluez5.bap.set_name = "48_2_1"
bluez5.bap.rtn = 5
bluez5.bap.latency = 20
bluez5.bap.delay = 40000
bluez5.framing = false
2025-04-14 07:26:28 +00:00
Kenny Levinsen
558721efc2 audioconvert: Increase param length limit to 4096
Parameter values read into a 512 byte long buffer, which is insufficient
for medium to long filter-graph parameters.

Increase the buffer to 4096 bytes to give some wiggle-room.
2025-04-11 20:03:25 +00:00
Christian Glombek
9e3f9607a6 raop: Add fp_sap25 encryption type
Add support for FairPlay SAP v2.5 (encryption type 5) type devices such as Apple Home Pod Minis.

Apparently only these devices require the `POST /feedback` heartbeat, so fix that.
2025-04-10 23:13:46 +02:00
Pauli Virtanen
4c51e6518b bluez5: ldac decoding support
Add support for LDAC decoding, if libldac decoder is available.
2025-04-10 13:22:57 +00:00
Pauli Virtanen
bbe1587f71 bluez5: fix volume ids
Node ids don't map directly to volume ids. Fix the indexing.
2025-04-09 07:50:30 +00:00
fossdd
b15ec9bec9 doc: fix typo in pw-link(1) 2025-04-09 07:48:10 +00:00
Pauli Virtanen
42b92a3487 pw-loopback: add missing --channel-map long option 2025-04-09 07:47:32 +00:00
Sanchayan Maity
bb1bb07f6c gstpipewiresrc: Handle stream being disconnected
When PW source is used with something like Camera and the camera is
disconnected, all buffers are removed and stream will be paused.

When using PW sink with source, the sink side pipeline can go to EOS.
This again results in all the buffers being removed and stream being
paused on the source side. PW source side pipeline can also crash if
the sink was in the middle of frame copying a buffer to render which
got removed.

Handle this scenario by sending a flush-start event at the start of
buffer removal and flush-stop at the end followed by an end of stream
or pipeline error depending on user selection.
2025-04-09 07:45:27 +00:00
Pauli Virtanen
e9a2406314 CI: bump to Fedora 41
Fedora 40 EOL is next month, and newer Doxygen version is better for
docs.pipewire.org.
2025-04-06 12:12:59 +03:00
Pauli Virtanen
e3122a8555 doc: add links to docs of other versions 2025-04-05 14:36:43 +03:00
Pauli Virtanen
b8ad9acbc7 CI: build also 1.4 docs 2025-04-05 11:27:32 +00:00
Wim Taymans
e355df3785 channelmix: fix channel_mask bits iteration
Iterate the number of bits in the channel mask based on the number of
bits in the mask, not the max amount of channel positions.
2025-04-04 17:06:43 +02:00
Wim Taymans
a99ed4da2a raop: fix byte array initialization
Initialize the byte array with bytes instead of a string because the 0
byte at the end of the string does not fit in the array and causes a
compiler warning.
2025-04-04 16:12:41 +02:00
Wim Taymans
031014bbab acp: remove channel limit from API
Internally bump the channel limit and allocate the channel map
dynamically.
2025-04-04 15:46:03 +02:00
Wim Taymans
8205038ffb buffers: increase max datas limit
Increase the max amount of buffer datas allowed.
2025-04-04 15:46:03 +02:00
Wim Taymans
a9f12537d1 pulse: clamp channel numbers to right values
When converting between pipewire and pulse channelmaps, make sure we
clamp the channel numbers to the the right limit.
2025-04-04 15:46:03 +02:00
Wim Taymans
722776cf65 Remove some hardcoded channel number values
Mostly related to the number of channels.
2025-04-04 15:46:03 +02:00
Wim Taymans
5cfd461ba2 alsa: Use the configured max channels
Don't hardcode the max channels to 64 but use the globally configured
SPA_AUDIO_MAX_CHANNELS value.
2025-04-04 15:46:03 +02:00
Quentin
9d6098f8c6 Small changes, more natural sounding 2025-04-03 23:31:55 +00:00
Sanchayan Maity
77143e54d9 gstpipewiresrc: Fix re-linking for audio
For a pipeline like below, we might want to dynamically switch the audio
source.

gst-launch-1.0 -e pipewiresrc autoconnect=false ! queue ! audioconvert ! autoaudiosink

On switching to a different audio source, any one of driver, quantum
or clock rate might change which changes the return `result` value of
gst_pipewire_clock_get_internal_time.

This can result in the basesrc create function incorrectly waiting in
gst_clock_id_wait. We post clock lost message to fix this. In the case
of gst-launch, it will set the pipeline to PAUSED and then PLAYING to
to force a new clock and a new base_time distribution.

Without the clock lost message, the following can be seen

before re-linking to a different source
0:00:30.887602864 79499 0x7fffe8000d40 DEBUG              GST_CLOCK gstsystemclock.c:1158:gst_system_clock_id_wait_jitter_unlocked:<pipewireclock0> entry 0x7fffd803fad0 time 0:00:17.024565416 now 0:00:17.024109144 diff (time-now) 456272

after re-linking to a different source
0:00:45.790843245 79499 0x7fffe8000d40 DEBUG              GST_CLOCK gstsystemclock.c:1158:gst_system_clock_id_wait_jitter_unlocked:<pipewireclock0> entry 0x7fffd803fad0 time 0:00:31.927694059 now 0:00:17.066883864 diff (time-now) 14860810195

With the clock lost message, the following can be seen

before re-linking to a different source
0:01:09.336533552 89461 0x7fffe8000d40 DEBUG              GST_CLOCK gstsystemclock.c:1158:gst_system_clock_id_wait_jitter_unlocked:<pipewireclock0> entry 0x7fffd803fad0 time 0:00:58.198536772 now 0:00:58.197444926 diff (time-now) 1091846

after re-linking to a different source
0:01:21.659827958 89461 0x7fffe8000d40 DEBUG              GST_CLOCK gstsystemclock.c:1158:gst_system_clock_id_wait_jitter_unlocked:<pipewireclock0> entry 0x7fffd803fad0 time 0:28:24.853517646 now 0:28:24.853527204 diff (time-now) -9558

Note the difference in `time` and `now` fields of the above log message.

This is easy to reproduce by using a pipewiresink as the audio source
with a pipeline like below, as one of the sources during switching.

gst-launch-1.0 -e audiotestsrc wave=ticks ! audioconvert ! audio/x-raw,format=F32LE,rate=48000,channels=1 !
pipewiresink stream-properties="props,media.class=Audio/Source,node.description=pwsink" client-name=pwsink

Applications need to handle the GST_MESSAGE_CLOCK_LOST message in their
bus handlers.
2025-04-03 19:20:34 +05:30
Arun Raghavan
dd683176c2 gst: sink: Set provide clock flag if not in provide mode
Handle a theoretical corner case of an element that is first started
with mode=provide, and then restarted without mode=provide.
2025-04-03 06:59:31 -04:00
Wim Taymans
832c5a6d25 fix printf modifier for gsize
Fixes #4641
2025-04-02 13:25:31 +02:00
Wim Taymans
5c547d58d1 adapter: handle builder overflow 2025-04-02 10:39:34 +02:00
Taruntej Kanakamalla
ee2c6eb41e gst: sink: Manage buffer pool memory manually
Let's make sure we own the memory in buffers, so that we can be
resilient to the PW link going away. This currently maintains the status
quo of copying data into the pipewirepool for sending to the remote end,
but moves the allocation of buffers so that ownership is maintained by
the sink in all cases.

There are some tricky corners, especially with bufferpool vs. buffers
param negotiation -- bufferpool parameters can be negotiated in
GStreamer before the link even comes up, so we try to adapt the buffers
param to use the negotiated value. For now, that is more brittle than
tying those two aspects together. We can revisit this if we can find a
way to tie pipeline state and link state more closely.

Co-authored-by: Arun Raghavan <arun@asymptotic.io>
2025-04-02 08:20:38 +00:00
Arun Raghavan
1b258f4ecc gst: sink: Only add VideoCrop meta for video 2025-04-02 08:20:38 +00:00
Wim Taymans
774f9cbb80 videconvert: fix compilation on 32 bits 2025-04-02 10:15:37 +02:00
Wim Taymans
bf952a6e4b videoconvert: improve setup of DSP mode
Parse and use DSP formats.

Redo the conversion setup when the formats changed. We usually do this
when starting the node but the formats can change while running as well.
2025-04-01 16:35:32 +02:00
Wim Taymans
da69bddb95 adapter: Improve convert setup
Always do configure_convert, even when the passthrough state didn't
change, for example when going from none to convert.
2025-04-01 16:31:25 +02:00
Wim Taymans
1adc9e5445 videoadapter: init the builder for each param
Or else we keep on adding items until we overflow.
2025-04-01 16:24:40 +02:00
Wim Taymans
aca673b3ab impl-link: improve debug log
Log the format after we patch it up and log some context lines.

Move some info log to debug.
2025-04-01 10:19:40 +02:00
Wim Taymans
94910f77c9 pod: handle builder overflows
When the builder is overflowed, we might get a NULL pod. This is a valid
situation that we need to handle because it can be used to get the
required builder buffer size.
2025-04-01 10:18:05 +02:00
Wim Taymans
5c5075f4d6 videoconvert-ffmpeg: copy complete passthrough buffer data
We also need to copy the data type, flags and sizes.
2025-03-28 16:10:42 +01:00
Wim Taymans
b23161d772 videoconvert: always put frame size on Format param
We can now set the 0x0 frame size as the default as a wildcard.
2025-03-28 16:09:36 +01:00
Wim Taymans
5f4c0cdd1e improve debug and error reporting a little 2025-03-28 16:08:57 +01:00
Wim Taymans
ae1bbc93d8 videoconvert: return error on invalid formats 2025-03-28 16:08:19 +01:00
Wim Taymans
dba31d7e2a videoadapter: use the supported dataType in Buffer param
Get the dataType field from the Buffer param. This is a mask of the
supported data types for the buffers. Pass this to the allocating node
if there is one, otherwise use MemPtr as the allocated format.
2025-03-28 16:04:54 +01:00
Wim Taymans
d0c4b491da v4l2: handle nearest set_format
The set_format function can return 1 when the format was adjusted to the
nearest supported format so return this from the port_set_param
function.

This instructs the adapter to recheck the configured format so that it
can store the adjuted format on the converter.
2025-03-28 16:00:51 +01:00
Wim Taymans
b501290bd5 audioconvert: support DYNAMIC data again
Because we advertize on out ports that we support DYNAMIC data, we need
to read the data pointer directly from the buffer and only fall back to
our cache (mmaped) pointer when it is NULL.

With DYNAMIC data, the peer element (mixer-dsp) directly copies the
input data pointer into the buffer data in the processing loop in order
to avoid a memcpy when there is no mixing needed.
2025-03-27 17:00:11 +01:00
Wim Taymans
328718f958 audioconvert: add support for buffer data mmap
When there is no data and the buffer is mmapable, try to mmap it. Unmap
again when clearing the buffers.

Use the mmaped data pointer of the buffer when processing.
2025-03-27 15:37:19 +01:00
Wim Taymans
9ceb4310f8 videoconvert: unmap buffer memory as well
Set a flag when we mmaped the buffer memory so that we can unmap it
again when clearing the buffers.
2025-03-27 15:21:12 +01:00
Wim Taymans
abc03ec810 adapter: fix buffer alloc order
Prefer to let the follower allocate buffers. If we are allocating
buffers, first do use_buffers on the allocating node or else the
non-allocating node just ends up with NULL buffers.
2025-03-27 09:29:52 +01:00
Wim Taymans
afb4a2f49c Revert "gst: src: Minor fix for offsets"
This reverts commit 4c200183b9.

The offset is already applied when we share/copy the memory in the
target buffer.
2025-03-26 17:56:14 +01:00
Wim Taymans
479ba33685 videoconvert-ffmpeg: support transcoding
When the input and output is an encoded format but the dimensions are
different, do a decode, scale and encode.
2025-03-26 17:52:26 +01:00
Wim Taymans
f8dcf32c8d videoconvert-ffmpeg: fix passthrough mode
Keep the passthrough flag up to date when we unset a port format or when
it changes.

We should only fill in the buffer data/fd when the ALLOC flag is set.

We should only take the passthrough input buffer as output when we are
in passthrough mode.

Copy the header metadata.
2025-03-26 17:52:26 +01:00
Wim Taymans
2873d7a6cc adapter: add Header metadata by default
Firefox needs this but we should eventually check the Meta Params to
decide on this.
2025-03-26 17:52:26 +01:00
Arun Raghavan
d7cb68bfc7 gst: pool: Some refinements to min/max handling
A number of changes for correctness.

  1) We expose the actualy min and max values we support in the
     allocation query.

  2) We don't support max_buffers as 0, as unlimited buffers is not an
     option

  3) In ParamBuffers, we request the max_buffers from bufferpool config,
     as we cannot dynamically allocate buffers
2025-03-26 12:08:35 -04:00
Arun Raghavan
5ef13489db gst: sink: Correctly set size and offset on planar data
We need to make sure the memory sizes are correctly initialised so the
meta makes sense, and we don't copy the meta from the input buffer as
that doesn't make sense given we have our own meta already.
2025-03-26 12:08:35 -04:00