Commit graph

13492 commits

Author SHA1 Message Date
Christian Glombek
f81d733644 raop: set mtu to 1448 by default 2025-08-25 12:57:17 +02:00
Christian Glombek
30df4e70d0 raop: Add fp_sap25 encryption type
Add support for FairPlay SAP v2.5 (encryption type 5) type devices such as Apple Home Pod Minis.

Apparently only these devices require the `POST /feedback` heartbeat, so fix that.
2025-08-25 12:56:38 +02:00
Wim Taymans
1c542e9a0c 1.4.7 2025-07-23 17:42:58 +02:00
Wim Taymans
fefea32d9f resample: optimize phase scaling
Precalculate the constant factor to avoid a division for each sample.
2025-07-23 14:51:25 +02:00
Wim Taymans
140ae1bb62 resample: fix compilation
Also fix a compiler warning in clang
2025-07-23 14:51:11 +02:00
Wim Taymans
f04e8164a6 resample: avoid calculating GCD in rate updates
We don't actually need to calculate the GCD for each resampler rate
update. The GCD is only used to scale the in/out rates when using the
full resampler and this we can cache and reuse when we did the setup.

The interpolating resampler can work perfectly fine with a GCD of 1 and
so we can just assume that.
2025-07-23 14:50:15 +02:00
Wim Taymans
4a22b53b74 resample: reorder resample function setup
We also don't need to copy the resampler function name with each dynamic
function update, this is just for debugging.
2025-07-23 14:50:12 +02:00
Wim Taymans
a95d6dd553 alsa: update resampler requested size before reading
spa_alsa_read is called from the source process function when we are a
follower and no buffer is ready yet.

Part of the rate correction was performed by the ALSA driver when it
woke up but now, the resampler has updated the requested size and we
need to requery it before we can start reading samples.

Otherwise, we end up with requested samples from before the rate update
and we might not give enough samples to the resampler. In that case, the
adapter will call us again and we will again try to produce a buffer
worth of the requested samples, which will xrun.
2025-07-23 14:50:05 +02:00
Niklas Carlsson
5aa46bbddd filter-graph: fix index off by one in dsp_delay_c
Checking w + 1 > n_buffer means that w will go to n_buffer, which
in turn leads to reading buffer[2 * n_buffer].
2025-07-22 15:54:48 +02:00
Wim Taymans
c3ec30dec7 client-node: close SyncObj fd as well
We also need to close the SynObj fd we got, just like we close any
DmaBuf or MemFd.

Make sure we get a compiler error when we add more items to the
data type enumeration later.

Fixes #4807
2025-07-22 14:47:04 +02:00
Wim Taymans
74ad61f094 alsa: update resample state in all cases
We need to manually recheck the resample state when the matching state
got updated.
2025-07-22 14:43:37 +02:00
Wim Taymans
83fa53ba6e alsa: don't try to activate resampling with unknown rates
If the driver or our rate is not known yet, don't assume we will need to
resample.
2025-07-17 10:21:25 +02:00
Pauli Virtanen
7cd256d14c bluez5: aac: fix for A2DP v1.4 using rfa bits for more channels
A2DP v1.4 uses the rfa bits for adding 5.1 and 7.1 configurations.
Clear those bits properly when sending configuration, in case remote
device sets them.

(cherry picked from commit ae7a893ce9)
2025-07-10 17:17:22 +03:00
Arun Raghavan
7b70906162 spa: aec: webrtc: Expose echo canceller mobile_mode
Significantly better CPU performance in lieu of canceller quality. Not
implemented for 0.x series, as there's a lot more to enable there (such
as routing modes), and I am hoping to drop support for those versions
before too long.
2025-07-09 13:29:23 -04:00
Arun Raghavan
c5e90d7d51 spa: aec: webrtc: Drop outdated comment
The Intelligibility enhancer was removed, so the FIXMEs are irrelevant.
2025-07-09 13:29:21 -04:00
Arun Raghavan
5c9ddfd882 spa: audioconvert: Avoid reading past filter-graph param name end
Ensure we have at least a `.` after `audioconvert.filter-graph`, so we
don't try to read past the end if it does not exist.

Cherry-picked from a328e0ae28, dropping
the param doc update as that doesn't exist.
2025-07-09 12:14:27 -04:00
Arun Raghavan
af7ce19919 spa: aec: webrtc: Actually enable echo cancellation for 2.0 2025-07-09 15:26:11 +00:00
Jonas Holmberg
8ecdddeb04 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 15:26:11 +00:00
Robert Mader
8661034620 gst: pipewireformat: Validate fourcc before converting to string
gst_video_dma_drm_fourcc_to_string() asserts when called with
DRM_FORMAT_INVALID.

(cherry picked from commit 9debb4b814)
2025-07-09 17:11:43 +02:00
Jonas Holmberg
951cdf309a 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-07 22:32:19 -04:00
Wim Taymans
5eba752b95 echo-cancel: send capture/source latency correctly
Input latency received on the source (output stream) should be
propagated on the input stream (capture).
2025-07-07 22:32:00 -04:00
Wim Taymans
83a155d0c0 1.4.6 2025-06-27 13:16:18 +02:00
Wim Taymans
060d0e1761 Revert "loop: don't call the hooks around blocking wait"
This reverts commit 46dfa69f26.

We do actually need to release the locks for now. The reason is that
pipewire core will at various points do a blocking invoke into the
thread-loop (which is the data-loop when using non-rt/async processing)
to synchronize state. Because these functions are called with the
thread-loop lock and from some other thread (like gstreamer) it causes
a deadlock because the thread-loop is locked and can't run and the
caller is waiting for the thread-loop to complete.

See #4472
2025-06-26 12:45:29 +02:00
Wim Taymans
ff60e68a23 Revert "alsa: add Teufel Cage Pro mapping"
This reverts commit 0321f543d3.
2025-06-26 11:34:20 +02:00
Wim Taymans
c644f54ea7 audioconvert: remove unused field 2025-06-25 10:46:05 +02:00
Wim Taymans
cc94909ca1 tests: set the flags on buffers correctly 2025-06-25 10:45:59 +02:00
Wim Taymans
0fa5ceba1c 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:44:11 +02:00
Wim Taymans
86d1233107 alsa: don't log unknown events with info
Debug is good enough
2025-06-25 10:43:18 +02:00
Harald Sitter
0321f543d3 alsa: add Teufel Cage Pro mapping 2025-06-25 10:42:03 +02:00
Wim Taymans
a53a960645 alsa-udev: support alsa.use-ucm
Make a new alsa.use-ucm option that sets api.alsa.use-ucm on the device
it creates (when set).

There is some documentation floating around (thr arch wiki) with this
property.

See #4755
2025-06-25 10:41:51 +02:00
Wim Taymans
75034634d0 pulse-server: mark empty buffers
This makes it use some more optimal paths in the mixer.
2025-06-25 10:41:08 +02:00
Pauli Virtanen
b238060d9b doc: add links to docs of other versions 2025-06-14 12:09:46 +03:00
Christian Glombek
e0b1277b3a 50-raop.conf.in: Add a condition that allows for disabling module 2025-06-13 11:59:33 +02:00
Wim Taymans
88046b9f03 spa: add volume_ramp_scale enum type info
And link it to the SPA_PROP_volumeRampScale property
2025-06-13 11:53:42 +02:00
Wim Taymans
ecbd4f552c spa: make the wave, pattern and ditherType Int
Properties of type Id should have a type of the enum with the possible
values associated with them.

The other types that don't have a fixed enumeration but are usually
mapped to some constant/description with PropInfo should be Int.

Fixes !2399
2025-06-13 11:53:42 +02:00
Wim Taymans
6a880af0f3 modules: Propagate the combine latency
When we get latency on the combine stream, forward it to all
streams after setting the per stream compensate latency (if any).

See #4731
2025-06-13 11:53:42 +02:00
Wim Taymans
a975973bc2 module-combine: use a better empty property string
The empty string fails to parse as a properties, use "{}" instead.
2025-06-13 11:53:42 +02:00
Wim Taymans
e3f6a81df1 alsa: reset alsa_sync when linked
When a linked node needs to be resynced we actually never clear the
flag or reset the dll. Move the code around so that it still does
the reset of the flag and dll without actually doing the resync in
the ringbuffer when it is a linked node.
2025-06-13 11:53:42 +02:00
Wim Taymans
4cfef13042 alsa: reset dll in prepare
When we do_prepare, always reset the dll. We already set the alsa_sync
field but that is only used by followers to resync in some cases.

When reseting the dll, we also reset the next_time and base_time values,
we however need to do this before calculating the error in update_time
when we are the driver in IRQ mode or else we get some crazy error
that distorts the rate estimation.
2025-06-13 11:53:42 +02:00
Wim Taymans
12cfaa7d50 modules: make sure we deactivate the graph safely
Use a blocking invoke to ensure the loop is not using the graph anymore
when we deactivate or reset it.

See #4750, #4700
2025-06-13 11:53:41 +02:00
Wim Taymans
512db73823 filter-chain: do graph reconfigure in playback state change
Because we do the processing of the graph in the playback process
function, only do graph reset and reconfigure from the playback state
change so that we don't have process and state change at the same time
and crash.
2025-06-13 11:53:08 +02:00
Martin Geier
b5e9e59cdb alsa-pcm: enable interrupts after alsa recovery
Interrupts are disabled in alsa_irq_wakeup_event -> playback_ready method
to not produce another wakeups when waiting for a new data. Interrupts are
enabled again when a new data arrives in a method spa_alsa_write.
In rare cases, when there is multiple streams providing data and one of
them is disconnected, a new data fails to be delivered and the spa_alsa_write
is not called. Not providing data produces underrun and alsa-pcm invokes
recovery process. Recovery process starts a new playback, but without interrupts
enabled is graph not triggered and new data are not delivered (to enable
interrupts). Recovery process keeps running in loop.
Now the interrupts are enabled again after the recovery and the starvation
should not occur.

Signed-off-by: Martin Geier <martin.geier@streamunlimited.com>
2025-06-13 11:14:22 +02:00
Martin Geier
cc1093de5f module-combine-stream: flush data in paused state
When stream is paused, internal delay buffers were cleared, but some
data could stay in stream output queue. Without a flush, these data where
played in front of a new data.
Patch was inspired by 64d6ff4184 fixing the
same issue in a filter-chain module.

Signed-off-by: Martin Geier <martin.geier@streamunlimited.com>
2025-06-13 11:14:09 +02:00
Martin Geier
b8cdb7e4f9 module-combine-stream: update latency right before playback starts
Combine stream selects the biggest latency from all output streams and sent
the latency upstream. To select the biggest latency, each stream needs to have
the sample rate and the quantum size set.
The combine stream recalculates the latency in the latency changed callback
or during data processing.
Stream sets the sample rate and the quantum size in a copy_position call
which is normally called during processing the output data or when state
changes to streaming.
Before this change, it wasn't guarantee the copy_position was called for
each stream already and latency in the combine stream was selected from
random stream.

Signed-off-by: Martin Geier <martin.geier@streamunlimited.com>
2025-06-13 11:13:56 +02:00
Wim Taymans
46dfa69f26 loop: don't call the hooks around blocking wait
The blocking invoke function is not meant to be called with any of the
loop context locks acquired so that it can actually run the invoke call
while blocking. Make this (and other blocking risks) clear in the
documentation.

Because it is not supposed to be called with any of the locks, we should
also not try to call the hooks (that implement the unlock/lock).

Fixes #4472
2025-06-10 12:18:28 +02:00
Wim Taymans
1139ab5966 alsa: handle NULL io
It is possible that the port io is set to NULL when the node is
negotiating or destroying.

Fixes #4734
2025-06-10 11:01:36 +02:00
Jonas Holmberg
269f42430e gst: deviceprovider: take a ref to devices
When _probe() is called, take a ref to the newly created devices instead
if sinking the floating ref, since gst_clear_object() is called when
core is disconnected. Otherwise the devices will be freed before the
caller gets them.

Fixes the following assert in the caller:

g_object_is_floating: assertion 'G_IS_OBJECT (object)' failed

Or sometimes a segfault with the backtrace:

0  g_type_check_instance_is_fundamentally_a (type_instance=type_instance@entry=0x116c1b0, fundamental_type=fundamental_type@entry=80) at /usr/src/debug/glib-2.0/2.84.0/gobject/gtype.c:3918
1  0xb6d40cc6 in g_object_is_floating (_object=0x116c1b0) at /usr/src/debug/glib-2.0/2.84.0/gobject/gobject.c:3843
2  0xb6bc4c74 in gst_device_provider_get_devices (provider=0x109ba00) at /usr/src/debug/gstreamer1.0/1.24.12/gst/gstdeviceprovider.c:426
2025-06-10 11:01:28 +02:00
Wim Taymans
83ada1e086 1.4.5 2025-06-04 10:59:16 +02:00
Wim Taymans
9d61a530ed alsa: unlock pending drain in drop
When we set activated=false, signal the thread because it might be
waiting in drain.

See #4728
2025-06-03 16:19:29 +02:00
Wim Taymans
70f55d1689 pulse-server: Implement record PA_STREAM_DONT_INHIBIT_AUTO_SUSPEND
Also implement the flag for record streams, where it is more usually
used, like in pavucontrol to disable starting a network source.
2025-06-03 16:19:12 +02:00