Commit graph

14617 commits

Author SHA1 Message Date
Barnabás Pőcze
cad1df748e meson.build: define SPA_AUDIO_MAX_CHANNELS for C++ as well
Previously the override was only present in `cc_flags`, meaning that
C++ source files, like `aec-webrtc.cpp`, would not have it.

Fixes: 6d74eee874 ("spa: bump channels to 128 again")
2026-02-02 18:13:14 +01:00
Wim Taymans
3c80f0fb3e filter-graph: add gain option to sofa
So that we can apply the gain to the IR. This is more efficient than
doing a volume after the convolution.

See #5098
2026-02-02 16:28:54 +01:00
Pauli Virtanen
f60e03b4ef pulse-server: use timeout also for creating sample-play streams
Add 35 sec timeout for PLAY_SAMPLE streams to start streaming, similar
to what we do with normal streams, and fail playback if they don't
start.

This avoids pending sample playback using up resources indefinitely if
streams fail to start for some reason, e.g. session manager is not
linking them.
2026-02-02 11:25:01 +00:00
Pauli Virtanen
a50e9a995e pulse-server: disconnect from server on EPROTO
If we get EPROTO, we likely have missed on some messages from the
server, and our state is now out of sync.

It's likely we can't recover (e.g. if error is due to fd limit hit), so
just drop the server connection in this case, similarly as if we got
EPIPE.
2026-02-02 11:16:15 +00:00
Alexander Sarmanow
f34a87fe38 bluez5: bap: add support for per adapter broadcast config
By setting the hci handle (e.g. hci0) of the desired adapter, the BIG
config will only applied on that adapter. In case no "adapter" entry in
the config is given, it will be applied on all adapters.

Signed-off-by: Alexander Sarmanow <a.sarmanow@televic.com>
2026-02-02 11:15:41 +00:00
Frédéric Danis
1a478c7147 bluez5: Fix stack smashing crash in remote_endpoint_update_props()
Commit 2942bae034 introduced parsing of
"SupportedFeatures" which uses a third DBusMessageIter pointer.

*** stack smashing detected ***: terminated
==389050==
==389050== Process terminating with default action of signal 6 (SIGABRT)
==389050==    at 0x4F57B2C: __pthread_kill_implementation (pthread_kill.c:44)
==389050==    by 0x4F57B2C: __pthread_kill_internal (pthread_kill.c:78)
==389050==    by 0x4F57B2C: pthread_kill@@GLIBC_2.34 (pthread_kill.c:89)
==389050==    by 0x4EFE27D: raise (raise.c:26)
==389050==    by 0x4EE18FE: abort (abort.c:79)
==389050==    by 0x4EE27B5: __libc_message_impl.cold (libc_fatal.c:134)
==389050==    by 0x4FEFC48: __fortify_fail (fortify_fail.c:24)
==389050==    by 0x4FF0ED3: __stack_chk_fail (stack_chk_fail.c:24)
==389050==    by 0xBC1D1A1: remote_endpoint_update_props (bluez5-dbus.c:3137)
==389050==    by 0xB53609F: ???
==389050==    by 0x1DF: ???
==389050==    by 0x61C17BF: ??? (in /usr/lib/x86_64-linux-gnu/libdbus-1.so.3.32.4)
==389050==    by 0x1DF: ???
==389050==    by 0xC5ED113: ???
2026-01-30 18:02:38 +01:00
Wim Taymans
69d8822303 filter-chain: tweak spatializer gain
We're adding two signals together so half the gain to keep it at
the same volume.
2026-01-29 16:52:02 +01:00
Wim Taymans
47dd57faa7 filter-graph: handle other SOFA errors as errno 2026-01-29 16:50:52 +01:00
Wim Taymans
2aecb49f50 pulse-server: use null to clear the value
The message makes it seem that you can pass 'clear' to clear the setting
but in fact you should pass 'null'.
2026-01-27 10:17:34 +01:00
Arun Raghavan
ed59342d28 pipewire-pulse: Expose bluetooth headset autoswitch config as a message
Makes it easier for libpulse-based clients to modify this setting if
they want.
2026-01-26 14:44:30 -08:00
Arun Raghavan
703380d62d pulse-server: Fix querying after setting of mono mixdown 2026-01-26 14:37:08 -08:00
Mengshi Wu
bc53b6b343 bluez5: Remove unused bt_features variable in sco_create_socket. 2026-01-25 17:26:15 +00:00
Mengshi Wu
332e35039d doc: Fix bluez5.hw-offload-datapath property type in documentation 2026-01-25 17:26:15 +00:00
Mengshi Wu
254620676f bluez5: Use named constants for Bluetooth codec IDs
Replace magic numbers (0x02, 0x05) with named constants BT_CODEC_CVSD
and BT_CODEC_MSBC for better code readability. Also remove redundant
zero initialization of num_caps field since the buffer is already
memset to zero.
2026-01-25 17:26:15 +00:00
Mengshi Wu
78f16bc04b bluez5: Remove hw-offload feature flag check and associated quirks
The sco_offload_btcodec() function now returns void and only skips
offload setup when using the default datapath, simplifying the logic
and removing the need for explicit feature flag checks.
2026-01-25 17:26:15 +00:00
Mengshi Wu
2b5d21da5b bluez5: simplify SCO datapath parsing with spa_atou32 2026-01-25 17:26:15 +00:00
Mengshi Wu
2d6a7d2186 bluez5: fix format string in sco_offload_btcodec log message 2026-01-25 17:26:15 +00:00
Mengshi Wu
db7c74a042 bluez5/backend-native: Add HFP/HSP hardware offload datapath configuration
Add support for configuring the SCO hardware offload data path for
HFP/HSP profiles using the Bluetooth SIG-specified procedure. This
enables vendor-specific SCO offload integrations.

Changes:
- Add `bluez5.hw-offload-datapath` configuration property (default: 0)
- Implement `sco_offload_btcodec()` to set BT_CODEC socket option
- Add `SPA_BT_FEATURE_HW_OFFLOAD` quirk feature flag
- Apply offload configuration when creating SCO sockets if quirk enabled
- Document new property in pipewire-props.7.md

The datapath ID is configurable via device parameters and only applied
when the hardware offload feature flag is set in quirks, allowing
platform-specific SCO offload implementations.
2026-01-25 17:26:15 +00:00
Wim Taymans
35817c0d85 pw-cat: support some more formats
So that you can give an .oga extension and --format=opus to get an
opus ogg file.
2026-01-22 17:14:41 +01:00
Jonas Ådahl
f2c4452e8d stream: Make capability device IDs an JSON object
Also change the encoding of the byte array to use hexadecimal encoding,
i.e. the byte array [100, 200] in becomes "64c8".
2026-01-22 16:08:19 +00:00
Jonas Ådahl
8600721de0 stream: Change PW_CAPABILITY_DEVICE_ID_NEGOTIATION to a version number
This allows easier evolvement of the negotiation protocol.
2026-01-22 16:08:19 +00:00
Arun Raghavan
04793138b5 alsa-card-profiles: Add config for a couple of JBL gaming headsets
Similar to the existing SteelSeries and Logitech ones, but the order of
the playback endpoints is reversed, and only mono input is supported.
2026-01-22 15:35:05 +00:00
Wim Taymans
f978b702b1 pw-cat: also look at simple formats for extension
The simple formats contain some common mappings for other extensions such
as mp3.

Makes pw-record test.mp3 actually write an mp3 instead of a wav file.
2026-01-22 13:08:06 +01:00
Wim Taymans
f82f4945b9 filter-graph: improve min/max checks for control
Clamp the control values to their min/max.

Remove the default_control array, we can just restore the default with
the port_set_control_value(). Do this when no value has been set on the
port when we set up the graph. The avantage is that we calculate the
default, min and max correctly when they depend on the graph rate.

Fixes #5088
2026-01-21 18:35:36 +01:00
Sven Ulland
c634ef9610 pipewiresrc: Fix video crop metadata not being set
Since commit a1f33a99df changed buffer handling to create new GstBuffers
instead of reusing pool buffers, the video crop metadata was silently
lost. The code used gst_buffer_get_video_crop_meta() which returns NULL
on a fresh buffer, so the crop values from PipeWire were never applied.

Change to gst_buffer_add_video_crop_meta() to actually attach the
metadata to the buffer.

Also remove the now-obsolete call in gst_pipewire_pool_wrap_buffer.

This was discovered when using the XDG Desktop Portal's RemoteDesktop
interface: the full desktop was being delivered instead of just the
selected window, because the crop region metadata was not being
propagated to the GStreamer buffer.

Fixes: a1f33a99df ("gst: dequeue a shared buffer instead of original
pool buffer"), from merge request !1258

CC: @jameshilliard
2026-01-21 15:26:57 +00:00
Wim Taymans
56a4ab5234 filter-chain: support no input or output streams
When the graph has no inputs and the channels is set to 0, don't create
a capture stream. Likewise, don't create a playback stream when there
are no graph outputs and the output channels is 0.

You can use this to make a sine source or a null sink.
2026-01-21 16:26:16 +01:00
Wim Taymans
7f2cce1021 filter-graph: add a null plugin
It discards all input.
2026-01-21 16:26:16 +01:00
Wim Taymans
a97c4d10af filter-graph: allow 0 input and output ports
There is no reason to fail when there is no input or output port.
We can simply run the graph with what there is. Even if there is no
input or output at all, running one instance of the plugins is
possible.

Add a busy builtin plugin that has no ports and keeps the CPU IDLE or
busy for the give percent.
2026-01-21 16:26:16 +01:00
Wim Taymans
ba3e564e34 filter-graph: notify about default numner of in/out
The filter graph has, after parsing, a default number of input and
output ports. This is based on the description or the first/last element
input and output ports. Pass this information in the properties when
we emit the info.

Don't use the number of configured input/output ports as the default
number of channels in filter-chain because this is only determined after
activating the graph. Instead, use the default input/output channels.

The result is that when you load filter-chain without any channel
layout, it will default to the number of input/outputs of the graph
instead of 0. This allows for the node to be visible in the pulseaudio
API.

Fixes #5084
2026-01-21 16:26:16 +01:00
Jonas Holmberg
39dd760c60 impl-port: Free capabilities
Free capabilities when destroying port.
2026-01-20 15:21:56 +01:00
Wim Taymans
0a27618cd4 1.5.85 2026-01-19 16:21:00 +01:00
Wim Taymans
e18c8ec224 doc: fix some typos 2026-01-19 13:30:15 +01:00
Carlos Martín Nieto
a858255ea2 doc: correct a copy-paste error in the pw-loopback manpage 2026-01-17 16:43:30 +01:00
Alexander Stephens
c74acf6c25 module-rtp: Fix timestamp integer overflow 2026-01-16 11:06:21 +00:00
Alexander Stephens
dcdc19238b module-rtp: Remove device_delay from timestamp math 2026-01-16 11:06:21 +00:00
Wim Taymans
b4b057196d resample: add bool to force inter resampler
Don't rely on the out_rate vs n_phases to decide on when to use the
inter resampler because the out_rate can change when we activate the
adaptive resampler.

Instead use a boolean that we can set at the start.
2026-01-16 11:03:43 +01:00
Wim Taymans
06e4772864 channelmix: add some more channelmix positions
Implement downmix of some top and rear channels as well.
2026-01-15 16:43:43 +01:00
Wim Taymans
c28a85ab34 zeroconf: use name+mode to detect duplicates
So that there can be a sink and source tunnel even when the name is the
same.

Based on patch by @kajusnau

Fixes #5079
2026-01-15 13:08:24 +01:00
Wim Taymans
9fdbe98330 resample: limit the amount of phases
If we have in and out rates with a very small GCD, we might end up with
a lot of phases. Limit the number of phases to 1024 and switch to
interpolating mode. 1024 phases is enough to accurately interpolate
from.

Together with the MAX_TAPS limit we will never create a filter
size that overflows 32 bits.

Fixes #5073
2026-01-15 12:05:07 +01:00
Jonas Ådahl
f055cf398d examples: Make fixate examples support device ID negotation
Things are structured in a way allowing testing falling back to
implicitly assumed device by defining/not defining macros.
2026-01-14 08:15:43 +00:00
Jonas Ådahl
5481a235ed examples: Make fixate examples optionally stream DMA buffers
The video-play-fixate example will downgrade the stream to MemFd one
modifier at a time. Sometimes it's useful to test with not downgrading;
to avoid having to depend on actual DRM devices (real or virtual), fake
them by using memfd and mapping them in the sink.
2026-01-14 08:15:43 +00:00
Jonas Ådahl
fc5b43a0b0 examples: Make fixate examples start inactive
The actual formats are sent just before activating. This is done in
preparation for supporting device ID negotiation.
2026-01-14 08:15:43 +00:00
Jonas Ådahl
58b958860e stream: Add DRM device negotiation
A DMA buffer from a DRM device are typically accessed using API related
to a DRM device, e.g. Vulkan or EGL. To create such a context for using
with a PipeWire stream that passed DRM device DMA buffers applications
have so far usually guessed or made use of the same context as the
stream content will be presented. This has mostly been the Wayland
EGL/Vulkan context, and while this has most of the time worked, it's
somewhat by accident, and for reliable operation, PipeWire must be aware
of what DRM device a DMA buffer should be accessed using.

To address this, introduce device ID negotation, allowing sources and
sinks to negotiate what DRM device is supported, and what formats and
modifiers are supported by them.

This will allow applications to stop relying on luck or the windowing
system to figure out how to access the DMA buffers. It also paves the
way for being able to use multiple GPUs for different video streams,
depending on what the sources and sinks support.
2026-01-14 08:15:43 +00:00
Jonas Ådahl
e615f17573 examples/video-src-fixate: Fake DmaBuf fd with memfd
Otherwise the stream will fail due to not being able to import fd.
2026-01-14 08:15:43 +00:00
Jonas Ådahl
21217a1fad examples/video-play-fixate: Switch to RGBA
The video-src-fixate was previously changed from RGB to RGBA, so to be
able to resolve a format, switch here too.
2026-01-14 08:15:43 +00:00
Jonas Ådahl
97976e4daf examples/video-play-fixate: Split out format param handler 2026-01-14 08:15:43 +00:00
Jonas Ådahl
01627e0367 examples/video-src-fixate: Split out format param handler 2026-01-14 08:15:43 +00:00
Wim Taymans
13131706aa spa: use the right AVX2 flags
Our AVX optimizations are really AVX2 so rename the files and functions
and use the right HAVE_AVX2 and cpu flags to compile and select the
right functions.

Fixes #5072
2026-01-13 12:03:09 +01:00
Pauli Virtanen
c1f7963c2a bluez5: fix crash due to debug_mono
Enabling bluez5.debug-iso-mono was in non-ISO branch and crashes. Fix
that.
2026-01-12 19:57:56 +02:00
Pauli Virtanen
f21c44751e bluez5: iso-io: resync if controller packet completion is out of sync
Add heuristic to resync streams if controller packet completion times
for different streams differ by too much.  This likely indicates
controller has lost sync between the streams, and we have to reset
playback.

There's no way to do this properly. The ISO-over-HCI transport is badly
specified in Bluetooth Core Specification.  Many controllers have broken
implementation of the current send timestamp read command, so packets
have no identifiers which ISO interval they belong to.

Controllers try to reconstruct the right interval based on
manufacturer-specific heuristics probably based on packet arrival times.
Kernel + USB introduce timing jitter, and playback sometimes desyncs and
packet from some streams are persistently sent some multiple of the SDU
interval off from the intended timing.

Try to determine this from packet completion latencies.  This is
somewhat manufacturer specific, tested on Intel & Realtek, hopefully
works on others too.
2026-01-11 17:55:26 +02:00