Commit graph

14865 commits

Author SHA1 Message Date
Wim Taymans
446e36807f port: debug passive modes better 2026-04-08 13:21:24 +02:00
Wim Taymans
7012594926 dlopen: improve prefix check some more
If we pass a path /usr/libevil/mycode.so, it might have a prefix of
/usr/lib but we should still reject it. Do thi by checking that after
the prefix match, we start a new directory.
2026-04-08 12:00:04 +02:00
Wim Taymans
fbbc4271a3 doc: improve formatting 2026-04-08 11:35:52 +02:00
Wim Taymans
0e0c325194 fix some uninitialized variables warnings 2026-04-08 11:29:36 +02:00
Wim Taymans
abd8c8f666 test: fix pod size
It's at least 24 bytes, 8 for struct header, 8 for int header and 8 for
int data.
2026-04-08 11:28:04 +02:00
Wim Taymans
5474c3c3a5 doc: add running.dox 2026-04-08 10:30:46 +02:00
Wim Taymans
1a3df16e27 mem: handle overflow in pw_map_range_init()
Integer overflows can result in map_range_init() to return wrong offset
or size that can result in access to invalid or unmapped memory.

Check for the overflows and return an EOVERFLOW error.

Found by Claude Code.
2026-04-08 09:47:57 +02:00
Wim Taymans
d7be4353ad tools: avoid strcat in pw-cat
We might overflow the path buffer when we strcat the provided filename
into it, which might crash or cause unexpected behaviour.

Instead use spa_scnprintf which avoids overflow and properly truncates
and null-terminates the string.

Found by Claude Code.
2026-04-07 18:44:43 +02:00
Wim Taymans
337801717e test: add unit test for fds mismatch 2026-04-07 18:31:56 +02:00
Wim Taymans
c9ecbf9fab protocol-native: check msg fds against available fds
Check that the number of fds for the message does not exceed the number
of received fds with SCM_RIGHTS.

The check was simply doing an array bounds check. This could still lead
to out-of-sync fds or usage of uninitialized/invalid fds when the
message header claims more fds than there were passed with SCM_RIGHTS.

Found by Claude Code.
2026-04-07 18:20:26 +02:00
Wim Taymans
247918339e doc: add docs about the runnable calculations 2026-04-07 16:20:46 +02:00
Wim Taymans
50aacea749 plugins: allow some absolute paths
Allow abosulte paths as long as they start with one of the search paths.
2026-04-07 09:44:22 +02:00
Wim Taymans
57299da899 filter-graph: improve debug when loading fails
List the path name and the plugin search path when we can't load an
error.
2026-04-06 15:01:43 +02:00
Wim Taymans
785bf36b9b docs: remove support for absolute paths from docs 2026-04-06 14:47:21 +02:00
Wim Taymans
8fd7982087 only dlopen from the defined search paths
Don't accept absolute library paths and skip the ../ in paths to avoid
opening arbitrary libraries from unexpected places.
2026-04-06 14:20:56 +02:00
Pauli Virtanen
ad0bab69a1 spa: system: make spa_poll_event compatible with epoll_events
spa_poll_event should have exactly same layout as epoll_events to be
compatible across platforms. The structure is packed only on x86-64.

Fix packing and replace the data member with similar union as
epoll_data, to fix compatibility on 32-bit etc.
2026-04-06 10:24:32 +00:00
Wim Taymans
6b0248d68c Revert "impl-node: Don't suspend when links are busy"
This reverts commit bb0efd777f.

It is unclear what the problem was before this commit. If there are any
pending operations, the suspend should simply cancel them.

See #5207
2026-04-06 10:39:15 +02:00
Alexander Sarmanow
54a4515b09 bluez5: bap: add support for manual BIS config 2026-04-05 20:18:22 +00:00
ValdikSS
ee1b429441 bluez5: aac: Use VBR encoding with Mode 5 by default 2026-04-05 20:24:47 +03:00
ValdikSS
a35b6b0c4b bluez5: aac: use higher band limit for CBR mode
FDK-AAC encoder uses band pass filter, which is automatically
applied at all bitrates.
For CBR encoding mode, its values are as follows (for stereo):

* 0-12 kb/s:   5   kHz
* 12-20 kb/s:  6.4 kHz
* 20-28 kb/s:  9.6 kHz
* 40-56 kb/s:  13  kHz
* 56-72 kb/s:  16  kHz
* 72-576 kb/s: 17  kHz

VBR uses the following table (stereo):

* Mode 1: 13   kHz
* Mode 2: 13   kHz
* Mode 3: 15.7 kHz
* Mode 4: 16.5 kHz
* Mode 5: 19.3 kHz

17 kHz for CBR is a limiting value for high bitrate.

Assume >110 kbit/s as a "high bitrate" CBR and increase the
band pass cutout up to 19.3 kHz (as in mode 5 VBR).

Link: d8e6b1a3aa/libAACenc/src/bandwidth.cpp (L114-L160)
2026-04-05 20:24:47 +03:00
ValdikSS
49d5f4f236 bluez5: aac: use maximum possible peak bitrate according to MTU
Android 11 and newer, in both CBR and VBR modes,
* Sets bitrate (AACENC_BITRATE) to the max_bitrate value of A2DP
* Sets peak bitrate (AACENC_PEAK_BITRATE) according to the maximum data
   which could fit into single audio packet based on MTU

AACENC_BITRATE is used only in CBR mode. For VBR mode, the only limiting
factor is AACENC_PEAK_BITRATE.

Do the same in Pipewire.

Link: https://gitlab.freedesktop.org/pipewire/pipewire/-/work_items/1482#note_2949680
Link: https://cs.android.com/android/platform/superproject/+/android16-qpr2-release:packages/modules/Bluetooth/system/stack/a2dp/a2dp_aac_encoder.cc;drc=37d7b4549f7b8740df1a290f04c20c591a2d3391;l=269
2026-04-05 20:24:47 +03:00
Wim Taymans
67dd3549a7 system: use attribute packed for the spa_poll_event
This makes it the same size as epoll_event and we don't need to copy the
results over.

It however technically causes an ABI break, in case someone was using
the system interface directly.
2026-04-01 16:28:47 +02:00
Martin Geier
54c517b2d9 module-rtp: Add more logging for debugging timer related issues 2026-03-30 23:45:34 +02:00
Carlos Rafael Giani
0121bdc475 module-rtp: Lower missing timeout log line from warn to trace
A warning is not warranted in this case, and this log line can spam
the logs, so set it to trace.
2026-03-30 23:45:34 +02:00
Carlos Rafael Giani
5b86e3d418 module-rtp-source: Only enable IGMP recovery when using multicast
IGMP recovery makes no sense with unicast IP addresses.
2026-03-30 23:45:34 +02:00
Carlos Rafael Giani
3080bca85a module-rtp-source: Fix unicast by-address packet filtering
Using connect() on a UDP receiver creates a strict filter based on
the sender's _source_ port, not the sender's destination port. The
source port specifies at what sender port the packet exits the sender.
The destination port specifies at what receiver port the packet enters
the receiver. But, the RTP sink uses an ephemeral (= random) port as the
source port. Consequently, connect() at the receiver will cause a
comparison of that ephemeral port with the fixated one (which is actually
the number of the _destination_ port). This incorrect filtering causes
all packets to be dropped.

Use bind() to filter for the local destination port, and use recvmsg()
with manual IP comparison to filter for the sender's identity.
2026-03-30 23:45:34 +02:00
Carlos Rafael Giani
41b5bc662e network-utils: pw_net_are_addresses_equal() function 2026-03-30 23:45:33 +02:00
Carlos Rafael Giani
9ba92bd728 spa: Do not perform upper range check on 32-bit platforms 2026-03-30 23:31:36 +02:00
Wim Taymans
18c97222c4 channelmix: make up/downmix levels configurable
Add channelmix.center-level, channelmix.surround-level and
channelmix.lfe-level to control how center, surround and LFE is
up/downmixed.

Fixes #5198
2026-03-30 17:50:48 +02:00
Sriman Achanta
03f894bab0 alsa-udev: Add wireless device status monitoring 2026-03-30 07:43:27 +00:00
Barnabás Pőcze
7f4baba41c spa: do not use SPA_PROP_live
Remove support for changing `SPA_PROP_live` in node implementations
that supported it, and hard-code `SPA_PROP_live = true`. If a mode
of operation is desired where the data is processed as fast as possible,
it can be achieved by implementing non-driver operation and using the
freewheel driver in pipewire.
2026-03-27 18:03:24 +01:00
Barnabás Pőcze
00b4717c6e spa: remove async members
Some node implementations have an `async` member, but these members
are not written anywhere. So remove them.
2026-03-27 11:32:29 +01:00
Barnabás Pőcze
84e7b744a6 spa: libcamera: use std::span
libcamera is planning to move to C++20 and drop the custom `libcamera::Span`
type at some point in the future. Since pipewire already uses C++20, remove
all uses of it and instead use `std::span` so that things will compile
after the removal.
2026-03-27 09:57:56 +01:00
Barnabás Pőcze
29b221671f spa: remove timerspec members
These are only used when the timer is set, so convert them to local variables.
No functional changes intended.
2026-03-26 14:43:54 +01:00
Wim Taymans
7599079d61 jack: increase notify buffer and items
Make the notify buffer larger, it was 8K but we can make it 64K. Also
reorder the notify struct fields to make it smaller.

This should avoid "notify queue full" warnings. Ideally we should
dynamically size this queue and not lose any messages.
2026-03-26 11:59:28 +01:00
Wim Taymans
60062432b8 module-rtp: handle the send_packet/feedback as callbacks
They are emited from the streaming thread and therefore can be emitted
concurrently with the events on the main thread. This can cause crashes
when the hook list is iterated.

Instead, make those events into callbacks that are more efficient,
and threadsafe.
2026-03-26 09:34:45 +01:00
Wim Taymans
50fcf64058 tools: add -C | --monitor to pw-cat
It sets the stream.capture.sink property which makes a record stream
capture from a sink monitor instead.
2026-03-25 18:06:17 +01:00
Wim Taymans
9eeb2f1930 mixer: handle control.ump property
Add a control.ump port property. When true, the port wants UMP and the
mixer will convert to it. When false, the port supports both UMP and
Midi1 and no conversions will happen. When unset, the mixer will always
convert UMP to midi1.

Remove the CONTROL_types property from the filter. This causes problems
because this is the format negotiated with peers, which might not
support the types but can still be linked because the mixer will
convert.

The control.ump port property is supposed to be a temporary fix until we
can negotiate the mixer ports properly with the CONTROL_types.

Remove UMP handling from bluetooth midi, just use the raw Midi1 events
now that the mixer will give those and we are supposed to output our
unconverted format.

Fix midi events in-place in netjack because we can.

Update docs and pw-mididump to note that we are back to midi1 as the
default format.

With this, most of the midi<->UMP conversion should be gone again and we
should be able to avoid conversion problems in ALSA and PipeWire.

Fixes #5183
2026-03-25 11:59:43 +01:00
Wim Taymans
7fe191bc10 buffers: handle 0 result from Buffers param enumeration
Since abf37dbdde the param enumeration in
the client-node can return 0 when the parameter is supported but there
are no params uploaded.

When negotiating buffers we need to assume a 0 result as a NULL filter
as well or else we will error.
2026-03-25 11:59:43 +01:00
Wim Taymans
ea28343166 midi: don't convert Midi in nodes
Avoid doing conversions in the nodes between Midi formats, just assume
the imput is what we expect and output what we naturally produce.

For ALSA this means we produce and consume Midi1 or Midi2 depending on the
configurtation.

All of the other modules (ffado, RTP, netjack and VBAN) really only
produce and consume MIDI1.

Set the default MIDI format to MIDI1 in ALSA.

Whith this change, almost everything now produces and consumes MIDI1
again (previously the buffer format was forced to MIDI2).

The problem is that MIDI2 to and from MIDI1 conversion has problems in
some cases in PipeWire and ALSA and breaks compatibility with some
hardware.

The idea is to let elements produce their prefered format and that the
control mixer also negotiates and converts to the node prefered format.
There is then a mix of MIDI2 and MIDI1 on ports but with the control
port adapting, this should not be a problem.

There is one remaining problem to make this work, the port format is
taken from the node port and not the mixer port, which would then expose
the prefered format on the port and force negotiation to it with the
peer instead of in the mixer.

See #5183
2026-03-25 11:59:43 +01:00
Wim Taymans
67070762d0 mixer: only add input ports to mixer 2026-03-25 11:59:43 +01:00
George Kiagiadakis
0d1280a5b2 bluez5: parse the broadcast adapter value from the correct iterator 2026-03-24 16:55:00 +00:00
Barnabás Pőcze
22c1a16dce spa: audioconvert: benchmark-fmt-ops: initialize convert
Since c02cdcb5ce ("audioconvert: add avx2 optimized s32_to f32d")
`conv_s32_to_f32d_avx2()` reads `convert::cpu_flags`, which was
previously unitiailized, fix that by setting it to 0.
2026-03-24 17:50:51 +01:00
Barnabás Pőcze
39f4cbfc98 spa: audioconvert: test-fmt-ops: initialize convert
Since c02cdcb5ce ("audioconvert: add avx2 optimized s32_to f32d")
`conv_s32_to_f32d_avx2()` reads `convert::cpu_flags`, which was
previously unitiailized, fix that by setting it to 0.
2026-03-24 17:38:26 +01:00
lumingzh
bc87bc8588 update Chinese translation 2026-03-24 07:29:02 +00:00
Julian Bouzas
4f56442249 bluez: Discard latency and quality codecs worse than SBC for A2DP auto profiles.
Since SBC is mandatory in all devices that support A2DP, we dont need to inclide
them in the priority tables.

This change also increases the priority of OPUS_G codec as it has better latency
and quality than SBC.
2026-03-24 07:28:14 +00:00
Julian Bouzas
e1f53b7f39 bluez: Set initial profile to quality A2DP 2026-03-24 07:28:14 +00:00
Julian Bouzas
2e7aee3573 bluez: Increase priority of A2DP quality and latency profiles
This improves the UX as the highest A2DP profile will be selected by default.
2026-03-24 07:28:14 +00:00
Vitaliy Fadeev
01b9abc5ef Edit overview.dox
five flags
Node
2026-03-24 07:26:15 +00:00
Wim Taymans
d47b4974ce impl-node: add () around &&
To fix a compiler warning.
2026-03-23 11:55:05 +01:00