Commit graph

13471 commits

Author SHA1 Message Date
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
Arun Raghavan
6fe66cec2e pulse-server: Implement PA_STREAM_DONT_INHIBIT_AUTO_SUSPEND
We do this by setting the node as passive.

Fixes: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/4255
Fixes: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/4726
2025-06-03 16:19:03 +02:00
Wim Taymans
889d069b46 adapter: use the right default when filtering default
Before fixating the format, we try to add as many of the PortConfig
fields as we can as defaults. However, when we already have a property
that intersects, prefer to use the original negotiated one prefered by
the follower.

This got changed when the default for the pod filter changed to the
filter value.

The effect is, for example, when the follower asks for FL FR FC LFE SL
SR and the sink is using FL FR SL SR FC LFE, the PortConfig (and the
default) would then be FL FR SL SR FC LFE. After negotiation, we would
get FL FR FC LFE SL SR as the format but then with the filter and the
wrong default we would fixate to FL FR SL SR FC LFE, which does not
match what the follower wanted and either results in wrong channels
or an error of the follower.

See #4722
2025-06-03 10:54:07 +02:00
Wim Taymans
3f79bcae5d 1.4.4 2025-05-29 09:17:47 +02:00
Jonas Holmberg
fc9aa51619 pod: declare offset as unused in spa_pod_builder_bytes_end()
Fixes compiler warning:

/usr/include/spa-0.2/spa/pod/builder.h:357:69: error: unused parameter 'offset'
[-Werror=unused-parameter]
2025-05-29 09:08:40 +02:00
Wim Taymans
62a719d71a adapter:handle -ENOENT when enumerating buffers
When the follower has no buffer suggestion, it can return -ENOENT, which
should not generate an error but simply use the converter buffer
suggestion instead.
2025-05-27 16:14:15 +02:00
Robert Mader
eda42ef2fc gst: src: Change DEFAULT_MIN_BUFFERS back to 1
The change from 1 to 8 was done without justification in the commit
message and possibly for debug purposes. Unfortunately it breaks
negotiation with the libcamera virtual pipeline, which defaults to
4 buffers.

Set the the value to 1 again as successful negotiation - even with an
unusually low number of buffers - is usually more desirable than an
error.

Fixes: 98b7dc7c0 ("gst: don't do set_caps from the pipewire callback")
(cherry picked from commit e81fb77322)
2025-05-26 19:28:32 +02:00
Wim Taymans
c507c4b0ff adapter: negotiate from target to follower
Since 3abda54d80 we prefer the format
of the filter. This reverses the selection of the default value when
negotiating buffers from the target to the follower.

If the follower does not select a reasonable value for the buffer size,
for example, this then results in wrongly sized buffers.

Fix this by reversing the order of allocation from target to follower
where we let the target (converter) select a default value, which is
more likely to be correct.

See #4713, #4619
2025-05-26 15:44:51 +02:00
Wim Taymans
06941f7315 alsa: remove UMP flag from control format
Don't set the UMP type flag on the format. Use the negotiated types flag
to decide what format to output. Add support for output to old style
midi.

Set the UMP type flag only on the new mixer and JACK when UMP is
enabled.

This ensures that only new (or explicitly requesting) apps get UMP and
old apps receive old midi.

This makes JACK running on 1.2 in flatpaks work with midi again.
2025-05-23 17:00:16 +02:00
Wim Taymans
76db05a0f8 Use "8 bit raw midi" for control ports again
There is no need to encode the potential format in the format.dsp of
control ports, this is just for legacy compatibility with JACK apps. The
actual format can be negotiated with the types field.

Fixes midi port visibility with apps compiled against 1.2, such as JACK
apps in flatpaks.
2025-05-23 17:00:05 +02:00
Wim Taymans
483b59a9d9 pod: add bytes start/append/end functions
Add functions to dynamically start and build a bytes pod.
2025-05-23 16:59:54 +02:00
Wim Taymans
331d5e0351 1.4.3 2025-05-22 10:59:37 +02:00
Wim Taymans
b24ceda8b2 filter-graph: lv2 features need a NULL terminator 2025-05-21 15:37:02 +02:00
Wim Taymans
6115a240d1 filter-chain: manage graph from source only
Only react to the capture stream state change and format changes. The
playback and capture streams change state somewhat concurrently and so
the graph state might not be consistent.

Because only the capture stream will trigger the playback stream and
start the processing, we can safely react to capture stream changes
only.
2025-05-21 15:34:01 +02:00
Wim Taymans
2a3f92e67f client-node: let all events go to the node
Just pass all events to the node and only error out when they return an
error value.

Make sure we pass the result values of the command around.
2025-05-21 15:28:08 +02:00
Wim Taymans
61168adb92 adapter: log command errors when no converter 2025-05-20 10:54:48 +02:00
Christian Glombek
603aae2dc8 daemon/pipewire.conf.avail: Add snippet enabling module-raop 2025-05-20 10:54:43 +02:00
Wim Taymans
a968027bdc adapter: handle -ENOTSUP for commands
When using custom commands, the converter might return -ENOTSUP and
we should ignore this.
2025-05-20 10:54:38 +02:00
Wim Taymans
9207fea992 libcemara: take care of index offset when enumerating controls
Add an index offset when enumerating controls. We insert 2 properties
before enumerating the controls so the index of the first control needs
to have an offset of 2.
2025-05-20 10:53:55 +02:00
Wim Taymans
a66377cf42 alsa: only use default rate and channels when valid
Check the user provided rate and channels and only use them to limit the
rate and channels when they are valid.
2025-05-19 12:12:36 +02:00
Wim Taymans
e7610de305 alsa: clamp audio.channels to MAX_CHANNELS
So that we don't end up trying to use too many channels later on.
2025-05-19 12:09:21 +02:00
Robert Mader
2a8d5c1f40 v4l2: Re-enable first buffer skip for jpeg types
The workaround is typically needed with usb-cameras using jpeg streams.
Re-enabling the skip shouldn't affect what the commit was trying to do,
i.e. fix encoded streams like h264 etc.

Fixes: bcf0c0cf8 (v4l2: only skip buffer for raw formats)
(cherry picked from commit e387772dc2)
2025-05-17 15:08:45 +02:00