Commit graph

15402 commits

Author SHA1 Message Date
Wim Taymans
4366621b78 filter-graph: fix max plugin
It was reading src[1] twice for no good reason. Fixed it like the min
plugin works.
2026-05-11 17:44:59 +02:00
Niklas Carlsson
a9d7023ec3 filter-graph: add min plugin
Output the lowest sample value of a number of inputs.
2026-05-11 15:39:40 +00:00
Niklas Carlsson
ecc85f2959 filter-graph: warn on clamped control values
Print a warning if a control value is clamped instead of silently
failing as the user might want to know if the intended
configuration was not applied successfully, such as filter
parameters.
2026-05-11 15:31:09 +00:00
Wim Taymans
f1b1f2d97b audioconvert: allocate memory dynamically
Instead of working with fixed buffer size, allocate everything
dynamically. This preserves a lot of memory in the normal case.
2026-05-11 17:23:33 +02:00
Wim Taymans
cd654efa6a audioconvert: support Midi control messages as well 2026-05-11 14:02:29 +02:00
Wim Taymans
2e86383aba examples: set diffent Clock and Position on source
Set a different Clock id and Position clock id on the testsrc so that it
knows that it needs to be a follower.
2026-05-11 14:02:29 +02:00
Barnabás Pőcze
5bc76c7d07 ci: disable more jobs if $COVERITY
If the pipeline is running for coverity scan, then only two jobs are needed:

   * container_coverity
   * build_with_coverity

but currently 4 container, 1 build, and 1 deploy jobs are running unnecessarily.

Disable the container jobs by simply extending `.not_coverity`.

The `build_on_fedora_html_docs` and `pages` jobs already extend `not_coverity`,
however, they override the `rules` section, hence it is replaced, so the "not coverity"
condition is lost. Fix that by adding the condition separately. (`build_on_fedora_html_docs`
referencesc the rules of `pages`, so modifying the latter is sufficient.)
2026-05-11 10:05:16 +00:00
Wim Taymans
e286061df4 fix some compilation problems 2026-05-11 11:59:54 +02:00
Wim Taymans
3813f64a27 midifile: fix meta event read 2026-05-11 11:53:36 +02:00
Vladimir Sadovnikov
bb91cfeb9e Add explicit cast to struct spa_event * result of spa_pod_builder_pop 2026-05-11 09:53:18 +00:00
Vladimir Sadovnikov
139767b4b5 Change return type of spa_pod_builder_pop to struct spa_pod * 2026-05-11 09:53:18 +00:00
Barnabás Pőcze
05a1a08a04 ci: build_on_debian: use variable expansion in needs:parallel:matrix
Since gitlab 18.6, a job can refer to a subset of parallel jobs[0],
so make use of it so that build jobs only depend on the container
job for the specific architecture.

[0]: https://docs.gitlab.com/ci/yaml/matrix_expressions/#matrix-expressions-in-needsparallelmatrix
2026-05-11 08:16:15 +00:00
Pauli Virtanen
db5cb6515a ci: use ASan/UBsan in bluetooth tests
Compile with sanitizers for the bluetooth tests, for better backtraces
on failures. Also produce backtraces via gdb.
2026-05-11 08:15:29 +00:00
Pauli Virtanen
ef35aa161b test: improve bluezenv test debug 2026-05-11 08:15:29 +00:00
Pauli Virtanen
1fc7ec2e3f ci: run bluetooth VM tests
The bluetooth VM tests require building BlueZ (specific version is
better than relying on FDO image version) and building pytest-bluezenv.

Build them and cache the results.
2026-05-11 08:15:29 +00:00
Pauli Virtanen
d12367e10e test: add VM-based full-stack bluetooth tests
Add tests that check PipeWire <-> PipeWire bluetooth audio streaming for
A2DP, BAP, HFP.  The tests use Qemu VMs and don't require Bluetooth
support from HW / kernel.

Full VM images are not required; similarly to BlueZ kernel tester these
use (read-only) mount of host filesystem.  A monolithic kernel image
with suitable config is required.  The bluetoothd binary installed on
host is used if found; otherwise tests are skipped.

These test depend on https://github.com/pv/pytest-bluezenv which manages
the VM setup.

To launch:

    python3 -m pip install pytest-bluezenv
    meson devenv -C builddir -w . python3 -m pytest test --kernel-build -v

which also builds a kernel image with required options.
2026-05-11 08:15:29 +00:00
Frédéric Danis
708cb6e2e8 bluez5: bap: Add bluez5.bap-server.ascs-announcement property
BAP/USR/ADV/BV-04-C test requires to advertise Audio Stream Control
Service properties with Targeted Announcement type.
2026-05-11 08:14:14 +00:00
Frédéric Danis
27cdac3cd6 bluez5: bap: Advertise ASCS properties
BAP/USR/ADV/BV-01-C test requires to advertise Audio Stream Control
Service properties with General Announcement type and supported
contexts values for sink and source which should be in sync with
the PACS values.
2026-05-11 08:14:14 +00:00
Vladimir Sadovnikov
5e9ecc3ce5 Fix compilation warning for Clang C++ 2026-05-11 08:13:29 +00:00
Barnabás Pőcze
dae3e92adc ci: make curl fail if response code is not appropriate
Use the `--fail{,-with-body}` options of curl to ensure that it will abort
the job if the resource cannot be fetched/submitted correctly.
2026-05-11 08:11:49 +00:00
Wim Taymans
b72f422f35 rtp: skip header extensions
When the header X bit is set, read the extension size and skip the
extension.
2026-05-11 09:25:31 +02:00
Wim Taymans
08d4e319cf avb: fix stack overflow in MRP parsing
AVB_MRP_VECTOR_GET_NUM_VALUES can be 13 bits and is stored in a
unit16_t. event_len and param_len are however calculated from this and
then truncated to 8 bits (uint8_t) which causes the bounds check to
silently pass and cause an OOB read.

Change the type to uint16_t to avoid overflows.
2026-05-08 18:13:12 +02:00
Wim Taymans
6c0a9b31f6 alsa: write silence in smaller chunks
With large quantum and many channels, the silence buffer can become
quite large (many MB), which can cause a stack overflow.

Use a fixed size silence buffer instead and write in smaller chunks.
2026-05-08 17:43:23 +02:00
Wim Taymans
0ac3cf3c88 alsa: fix warning about sign 2026-05-08 17:39:09 +02:00
Barnabás Pőcze
b9bae7fdcf spa: alsa: pcm: spa_alsa_clear(): clear pointers
Use `spa_clear_ptr()` to ensure that all freed pointers are cleared.
2026-05-08 15:27:54 +00:00
Barnabás Pőcze
c8462edf4b spa: alsa: pcm: log_write(): return early if log level is disabled
If the "debug" log level is not enabled for the "spa.alsa" log topic,
then there is no point in going into the loop and splitting the data
into lines, so skip that.
2026-05-08 15:27:54 +00:00
Barnabás Pőcze
cfe9c7d6ca spa: alsa: pcm: log_write(): don't use strcspn()
Do not use `strcspn()` because it assumes a null terminated string,
but the `fopencookie()` write callback receives a (ptr, length) pair.

So use `memchr()` instead to find the `\n`.
2026-05-08 15:27:54 +00:00
Barnabás Pőcze
bba43d4433 spa: alsa: pcm: log_write(): fix return value
The `fopencookie()` write callback should return the number of consumed
bytes, but it currently only ever returns 0, which signals an error
condition according to the documentation.

Fix that by not overwriting `size`.

Fixes: 73073eb33f ("alsa: redirect alsa output to log file")
2026-05-08 15:27:54 +00:00
Barnabás Pőcze
ff7b996596 treewide: mark fopencookie() vtable const
`fopencookie()` takes the vtable by value, so it can be marked `const`, so do that.
2026-05-08 15:27:54 +00:00
Barnabás Pőcze
8caea521d7 doc: compile tutorial programs
The programs in `doc/examples` are not compiled currently, so let's
compile them if the `docs` and `examples` options don't disallow it.

`tutorial4.c` needs a small modification to avoid `-Wfloat-conversion`.

Additionally, install them if `installed_tests` is not disabled.
2026-05-08 15:20:41 +00:00
Wim Taymans
b5d294eab0 dfffile: handle invalid channels and rate
Missing or malformed headers could cause unspecified channels or rate
that can cause crashes.
2026-05-08 17:12:54 +02:00
Wim Taymans
57770c7e18 midifile: handle some other read errors 2026-05-08 17:07:51 +02:00
Wim Taymans
c94bbb55bc midifile: read up to 4 bytes for the varlen 2026-05-08 17:00:56 +02:00
Martin Geier
c7f2f0dc73 audioconvert: update rate also for nodes with disabled resampler
When the graph rate changes it is possible that the follower node can
renegotiate to the new suggested audioconvert rate without requiring
resampling and so the extra check for the disabled resampler is not
required.

Fixes #4933
2026-05-08 15:56:05 +02:00
Wim Taymans
4c8093fa72 combine-stream: clean up some variables
Move the source offs, stride, data and size calculations out of the
destination loop. We only need to clamp the size to copy to the maxsize
of the destination buffer.
2026-05-08 13:10:30 +02:00
Wim Taymans
93b940edef module-combine: limit size to buffer maxsize
Limit the amount of data we write to the destination buffer to its
maxsize.
2026-05-08 13:01:11 +02:00
Wim Taymans
136fc59765 bluez5: avoid heap overflow in AAC decoder
aacDecoder_DecodeFrame expects the number of destination INT_PCM samples,
not bytes. Since INT_PCM is int16_t (2 bytes), passing dst_size in bytes
tells the decoder the buffer is 2x larger than reality.

Note that we don't need to care about the number of channels in this
size, the decoder will do that for us.
2026-05-08 13:01:03 +02:00
Wim Taymans
6d3122c1b1 sap: avoid reading past the end of the string
parse_sdp_a_rtpmap used c += strlen(c) + 1 to skip past the MIME type to the
rate/channels part, but if the a=rtpmap: line had no / separator, strcspn
returned the full string length and the +1 advanced past the null terminator.

Fix this by checking if / was actually found, returning -EINVAL if not.
2026-05-08 11:57:07 +02:00
Wim Taymans
7fd3e13a3e netjack2: handle 0 in sync frames
JACK2 only sends -1 as the frames, meaning we should take the value from
the negotiated period as the frames to process.

We however send the actual number of frames and use the sync value to
decide how many frames to process. We need to be careful because a value
of 0 will cause a division by 0 so treat <= 0 frames the negotiated period
size as well.
2026-05-08 11:42:15 +02:00
Wim Taymans
753eae9302 netjack2: check config against MAX_CHANNELS
Check that the params don't include more than MAX_CHANNELS of audio or
else we overflow the position array.

Adapt to the compiled value of SPA_AUDIO_MAX_CHANNELS but allow at least
128 channels.
2026-05-08 11:07:03 +02:00
Wim Taymans
6cee86e509 sendspin: avoid buffer overread
Check that we have enough bytes (>=9) to parse the message type and the
timestamp.
2026-05-08 10:33:39 +02:00
Wim Taymans
22243d5ce9 sendspin: handle parse_player errors
Otherwise, this might leave the stride 0 and cause a division by 0
later.
2026-05-08 10:32:28 +02:00
Wim Taymans
5b37b9cf99 filter-graph: remove the pipe filter
It's a terrible idea, doesn't work so well (locks up the data-loop when
read is blocked) and a security mightmare. If you really need to pipe
samples through some program, do that somewhere else, like from the
command line with pw-cat and pw-record.
2026-05-08 10:16:12 +02:00
Wim Taymans
b3257ae425 context: add library.use-fallback option
Normally, when loading a plugin feature, often a library.name property
is given as well. If the feature to load is not explicitly listed in
context.spa-libs, the library.name is used a fallback library.

Add an option to ignore this library.name and only use the
context.spa-libs entries. This makes it possible to only load explicitly
listed features in the config file and makes it possible to lock down
what plugins can be loaded.

Set the option to true by default for now, which keeps the existing
behaviour of using the fallback library. Add some more entries to the
context.spa-libs in case the option is switched off to make things
work.

Set the option to false for the minimal.conf.
2026-05-08 09:57:52 +02:00
Barnabás Pőcze
ddab12a5aa bluez5: cancel RegisterApplication calls when adapter goes away
If an adapter's removal is processed before the pending `RegisterApplication()`
dbus calls return, then those pending calls are not cancelled, and when the
(error) replies arrive, the callbacks will run into use-after-free issues
since they reference the removed adapter.

See #5096
2026-05-08 07:11:52 +00:00
Wim Taymans
97c8a0a5ae modules: update docs for the pipe plugin 2026-05-07 14:46:21 +02:00
Wim Taymans
85decefbef filter-graph: move the pipe plugin to separate .so
It's quite dangerous to allow it to be loaded dynamically into the
pulse server so block it. The other plugins should be safe to load.
2026-05-07 14:37:44 +02:00
Wim Taymans
a4e2856d06 pulse-server: block arbitrary filter-graphs
Add a special 'blocked' spa-libs value that returns EPERM when trying to
load the factory.

Only allow loading the LADSPA filter.graph nodes for the LADSPA sink and
source. The most problematic part is the pipe filter, that allows it to
spawn arbirary programs as part of the filter.graph.

You can add a filter-graph to any stream with stream_props.
2026-05-07 14:13:38 +02:00
Wim Taymans
e3f75314be vban: fix timestamp overflows
Like how it is done in RTP.
2026-05-07 14:07:33 +02:00
Wim Taymans
143af979ab filter-graph: error when there are no valid nodes
The nodes might have failed to load or there was an empty array or the
array did not contain objects.
2026-05-07 13:30:41 +02:00