Commit graph

13827 commits

Author SHA1 Message Date
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
yay me
b2edefbc4c po: Add Arabic translation 2025-06-24 07:00:17 -04:00
Elliot Chen
43441a4d69 pipewiresrc: fix sending last buffer failure if waiting operation exits in advance 2025-06-23 16:16:13 +00:00
Wim Taymans
4b236f8274 stream: fix a typo 2025-06-23 11:34:43 +02:00
Arun Raghavan
220b037683 pulse-server: Implement stream suspended callback 2025-06-23 09:19:10 +00:00
Wim Taymans
fd2db174c1 pipewire: update global properties
When the properties of an object change, update the properties on the
global as well. There is no way to notify clients of a changed global
but they are supposed to listen to the object specific events for that.
The global properties are meant to be a snapshot at the time of
enumerating the registry and can change later.
2025-06-23 10:42:47 +02:00
Pauli Virtanen
7fd05e7eaa bluez5: drop old SCO fragment data when sink starts
Any pending SCO fragment data should be cleared when sink starts, so
that we don't send out any old data.
2025-06-21 16:13:57 +03:00
Pauli Virtanen
665a27f281 bluez5: replace sco-source with media-source
Change media-source to use sco-io for HFP codecs.

Replace sco-source with media-source.

sco-source is mostly copypaste from media-source, only differed in the
IO handling.
2025-06-21 16:08:30 +03:00
Pauli Virtanen
5b4e9dc33e bluez5: replace sco-sink with media-sink
Change media-sink to use sco-io for HFP codecs.

Move SCO fragmentation to sco-io side.

Replace sco-sink with media-sink.

sco-sink is mostly copypaste from media-sink, and only differed in the
fragmentation detail, which can as well be handled on sco-io side.
2025-06-21 16:08:30 +03:00
Pauli Virtanen
f9b0bf3f95 bluez5: limit CVSD block size
Don't try to write data in too large blocks.

This controls the maximum amount of data to send at once. sco-io will
buffer and fragment packets to the right size.

Previously in sco-sink, SO_SNDBUF was not set, so there could be a
longer queue in the socket.
2025-06-21 16:08:30 +03:00
Wim Taymans
2f74789a92 jack: support port_rename callbacks
Look at the port name in the port_info properties and emit the
port_rename callback when it changes.

Fixes #4761
2025-06-20 16:28:26 +02:00