Commit graph

13837 commits

Author SHA1 Message Date
Wim Taymans
241147968e doc: add FOSDEM talk 2025-07-09 14:13:34 +02:00
Jonas Holmberg
85ff73d690 echo-cancel: reset buffers when deactivating
Reset buffers when deactivating to avoid having old data in the
ringbuffers, which also adds latency when activated again.

Clear sink_ready and capture_ready when resetting buffers to avoid
calling process() before there is new data to process.
2025-07-09 10:20:51 +02:00
Wim Taymans
0efd0258a7 filter-graph: rename the plugin files
Move the plugin prefix to the front like everywhere else and this also
makes it easier to spot the plugins when listing the directory.
2025-07-08 16:18:13 +02:00
Robert Mader
9debb4b814 gst: pipewireformat: Validate fourcc before converting to string
gst_video_dma_drm_fourcc_to_string() asserts when called with
DRM_FORMAT_INVALID.
2025-07-08 11:38:28 +00:00
Frédéric Danis
80d44e8f39 bluez5: backend-native: Fix incorrect dial number management
When dialing an incorrect phone number some phones (e.g. iOS 18.5)
replies with OK but never send +CIEV updates, so there's no way to
know that the dial is not in progress and the call object should be
removed.

This change waits for +CIEV event to create the call object.
2025-07-08 11:37:45 +00:00
Albert Sjolund
2581575bd1 gst: fix leak in sink_update_params
buffer_pool_get_config returns a copy of the config structure, but it is
never freed in this function. Add a gst_structure_free to fix the leak
2025-07-08 13:07:44 +02:00
Wim Taymans
d3eb06ab74 pod: improve array copy function
Make a new function to also returnt he child size and type.

Make a new function that accepts the array item size. Check that the
array item size and destination item size match before memcpy the array
contents. This avoids overflowing the target array with a malformed
array pod.
2025-07-08 10:11:11 +02:00
Wim Taymans
ce2f9eebb4 pod: avoid checking size or alignment
For the embedded children, they will always be aligned. We can also
avoid the max size checks for children because this is already checked
for the parent and with the remaining size check.

For arrays and choice we simply don't get any elements in the array when
the sizes are too large.
2025-07-08 10:06:51 +02:00
Wim Taymans
289b33281f pod: check size before getting pod contents
Before accessing the pod contents, check if the size is at least what we
expect it to be or else we might read out of bounds.
2025-07-07 19:40:24 +02:00
Julien Massot
8aa836d588 alsa-pcm: add support for api.alsa.dll-bandwidth-max
In USB Audio Class 2 (UAC2) setups, pitch control is handled by
feedback endpoints. The host adjusts its data rate accordingly.

When pitch control is active (pitch_elem), applying the default
delay-locked loop (DLL) bandwidth can lead to instability and
oscillations around the target rate.

This patch adds a new parameter, api.alsa.dll-bandwidth-max, to
configure the maximum DLL bandwidth. It introduces a new field
in the ALSA state to store this value.

By default, it uses SPA_DLL_BW_MAX, but when pitch control is in
use, setting it to a lower value (e.g. 0.02) helps ensure better
stability, based on empirical testing.
2025-07-07 10:40:11 +00:00
Wim Taymans
deb7dddbef test: format float values with .
Depending on the locale, the decimal separator can be , or .
We need it to be . in all cases or else the checks for the expected
value might fail.
2025-07-07 12:09:55 +02:00
Wim Taymans
5f4b4b02f9 pod: remove the ALIGNED from the pod struct
We don't really want to do this here otherwise structs that include a
pod will be padded so that an array of those structs will be aligned.

This makes a test case fail where we have a struct with a choice_body
followed by 3 uint32_t enum values. The size with and without the
aligned attribute is different.
2025-07-07 12:07:05 +02:00
Wim Taymans
a0f5c4153f builder: avoid oveflow 2025-07-07 10:38:56 +02:00
Wim Taymans
8554c9d02a pod: enforce max pod size
Set a max pod size and add some more over and underflow checks
2025-07-07 10:38:56 +02:00
Wim Taymans
2011474936 pod: improve type checks some more 2025-07-07 10:38:56 +02:00
Demi Marie Obenour
e4fcbef89a pod: Improve type-safety in SPA POD code
Use direct field access when the type is known, instead of a macro that
includes a cast.
2025-07-07 10:38:56 +02:00
Wim Taymans
aa2289a25b pod: check pod alignment
Make a SPA_POD_ALIGN = 8 and make sure all pods are aligned to it. Use
the new constant to pad and check alignment. Make some new macros to
check for the pod type, alignment and minimal size.
2025-07-07 10:38:56 +02:00
Wim Taymans
b75ed93e51 pod: improve spa_pod_from_data()
spa_pod_from_data() is now safe against integer overflow.
2025-07-07 10:38:56 +02:00
Jonas Holmberg
a0beb30ba8 echo-cancel: drop if playback is not streaming
capture and sink streams may start before playback stream so process()
may fail to dequeue a playback buffer. In that case advance the read
pointers to avoid building up latency in the ringbuffers.
2025-07-03 19:02:59 +00:00
Arun Raghavan
019b53ace8 spa: alsa: Try to get driver rate before setting up matching
In some cases, it is possible that the follower shares a clock with the
driver, but the driver rate is not known when the follower is assigned
to the driver. If this happens, then state->driver_rate is 0, and when
setting the format, we might think that we need to resample (because
follower rate != driver rate). This can cause us to incorrectly halve
the period size for the node.

This was introduced in commit 0b67c10a9c,
which forces reevaluation of matching status on driver change.

To avoid this, let us also probe for the driver rate when updating the
matching status, so we can make the update more accurate.
2025-07-03 19:02:02 +00:00
Wim Taymans
ef5d9ff028 filter-graph: add a simple noise gate 2025-07-03 20:58:00 +02:00
Wim Taymans
616db9809e module-rtp: add some rate limit to send/recv errors 2025-07-03 20:57:49 +02:00
Wim Taymans
47ee9ef10a module-rtp: set the EMPTY flag on empty buffers
And make sure other flags are reset.
2025-07-03 20:57:19 +02:00
Arun Raghavan
70aaec0ac4 spa: v4l2: Drop unused variable
Fixes warning:

[186/359] Compiling C object spa/plugins/v4l2/libspa-v4l2.so.p/v4l2-source.c.o
In file included from ../spa/plugins/v4l2/v4l2-source.c:164:
../spa/plugins/v4l2/v4l2-utils.c: In function ‘spa_v4l2_enum_format’:
../spa/plugins/v4l2/v4l2-utils.c:1103:22: warning: unused variable ‘drop_next’ [-Wunused-variable]
 1103 |                 bool drop_next = false;
      |                      ^~~~~~~~~
2025-07-03 10:07:54 -04:00
Julian Bouzas
a8b9ce2050 alsa: add option to disable pro-audio profiles
Some devices might have nonfunctional 'Pro Audio' sound. This patch adds a
new 'api.acp.disable-pro-audio' option to disable pro-audio profile entirely.
2025-07-02 08:11:48 -04:00
Wim Taymans
653e1578a1 audioconvert: use faster clear when dealing with empty buffers
When we are converting an empty buffer, use the more efficient
clear function.
2025-07-02 10:34:00 +02:00
Wim Taymans
0817001728 audioconvert: add clear function
Sets all samples to 0 in the target format.
2025-07-02 10:27:26 +02:00
Wim Taymans
3ff0c270dd echo-cancel: send capture/source latency correctly
Input latency received on the source (output stream) should be
propagated on the input stream (capture).
2025-06-30 15:48:20 +02:00
Wim Taymans
f93b3b23a3 loop: fix use after free case
Because we can now destroy sources (and free the source structure) by
simply holding the lock, there is a window where we might access the
freed source.

When we in iterate release the lock and go into the epoll, another
thread might acquire the lock and delete the fd from epoll. This might
happen right after epoll detected activity on the fd. When iterate
manages to acquire the lock again, it will process to dispatch the
active fd and deref the ep.data pointer, which is now pointing to freed
memory.

Fix this by incrementing a removed_count whenever we remove a source.
Check the counter if it was the same as before the epoll otherwise we
can't assume all sources are alive still. Return in that case as if
there were no fds to poll. The caller should reenter the iterate at some
point and we will return all the fds with activity, minus the one that
got destroyed. We need to give control to the caller because part of the
removal could be to stop the loop iteration all together.
2025-06-30 12:44:15 +02:00
Sam James
e9a0ac1346 spa: allow disabling deps via -Debur128/-Dudev
With .enabled(), Meson doesn't have some magic that packagers rely on
to explicitly disable finding a dependency if an option is off. Drop
the unnecessary .enabled() accordingly.
2025-06-28 07:55:54 +00:00
Sam James
69eaa6d098
ci: add fftw 2025-06-28 08:23:59 +01:00
Sam James
64b7a8990e
meson: add fftw option
Packagers need to have a way to control whether a dependency is used
even if it's installed/available.
2025-06-28 02:59:03 +01:00
Michael Olbrich
a77c1cbd0b gst: pipewireformat: enforce DMA_DRM when possible
with memory:DMABuf, DMA_DRM should be used as 'format'. So only add
formats to 'format' if there is no equivalent drm format.
2025-06-27 12:57:40 +00:00
Michael Olbrich
7795e06563 gst: add colorimetry support 2025-06-27 12:57:01 +00:00
Michael Olbrich
41b831d0f8 spa: v4l2: add colorimetry support 2025-06-27 12:57:01 +00:00
Michael Olbrich
6294cbeb68 spa: add helper to determine if a video format is RGB 2025-06-27 12:57:01 +00:00
Michael Olbrich
20cdc9155f spa: video/color: add some more transfer functions and color primaries 2025-06-27 12:57:01 +00:00
Michael Olbrich
4c5e3f9015 spa: video/color: drop 'since' comments
These are GStreamer versions that make no sense here.
2025-06-27 12:57:01 +00:00
Wim Taymans
9a6f8d31dc loop: unlock the lock when blocking on invoke
When we are the owners of the loop lock and we are not in the loop
thread itself, release all locks so that the loop can start processing
our invoke items and we get a chance to make progress. After that
re-acquire the locks.

This can happen when you change some of the core loop_locked() calls to
blocking _invoke functions that are called with the loop locked.

We have all core blocking invoke functions removed now so this is not
actually going to be used but just in case an application tries to
blocking invoke while locking the loop, this will now at least do
something else than deadlock.
2025-06-26 14:23:36 +02:00
Michael Olbrich
17c755714d v4l2: allow negotiation with modifier
This assumes that the modifier is always 'linear'. That is not quite
correct for all V4L2 formats. But PipeWire only uses input devices and
other modifiers are very unlikely.

This makes it possible to use DMABUFs with the GStreamer pipewiresrc.
2025-06-26 09:21:00 +00:00
Harald Sitter
1541ce3368 Revert "alsa: add Teufel Cage Pro mapping"
This reverts commit b57b87abbb.

It turns out this device is subtily different and doesn't work with the
current profile configurations. A UCM profile was added to alsa-ucm-conf
instead.
2025-06-26 09:19:09 +00:00
Wim Taymans
c045767252 stream: improve drain
Make sure we safely stop draining the stream by using the loop lock.

Always stop draining when we change the state of the stream.
The idea is that you either wait for the drain signal or cancel the
pending drain early with a new set_active() call.
2025-06-25 13:07:16 +02:00
Wim Taymans
a9cece3c2e audioconvert: remove unused field 2025-06-25 10:37:56 +02:00
Wim Taymans
dd6c9de604 tests: set the flags on buffers correctly 2025-06-25 10:34:50 +02:00
Wim Taymans
8a09bacdf6 audioconvert: map buffers with right prot 2025-06-25 10:31:39 +02:00
Wim Taymans
bd7ce5c7fa pulse-server: only react to state changes when not corked
When we are starting or corked we don't emit suspend/resume caused
by state changes.
2025-06-25 10:31:32 +02:00
Wim Taymans
bcb9ff20fd audioconvert: mark output as not empty when draining
When we are draining, we use an empty input buffer but then we push out the
remaining samples out of filters and we can't assume they are empty.
2025-06-25 10:31:24 +02:00
Wim Taymans
d093402d97 filter-graph: compare with float to avoid conversion 2025-06-24 13:46:30 +02:00
Wim Taymans
fa52a596f4 audioconvert: undef the right function 2025-06-24 13:46:08 +02:00
Wim Taymans
5c8e1ab7b6 jack: only update port name for other ports
Don't try to check for renames of our own port, we cause that
ourselves.

Also use the name of the port to find our ports.
2025-06-24 13:44:53 +02:00