Commit graph

7289 commits

Author SHA1 Message Date
Wim Taymans
2c6aa8e0d0 pulse-server: only use passive for devices
The dont-inhibit-auto-suspend flag does not do anything when using
direct-on-input-idx (capturing from a stream) in pulseaudio, so also
make it do nothing on pulse-server.

See #4991
2025-11-25 10:17:14 +01:00
Wim Taymans
ed2889cecf filter-graph: improve latency reporting of convolver
The latency of the convolver depends on the IR used. It's 0 for /dirac,
len/2 for /hilbert and let's assume it is 0 for file IRs.

Fixes #4980
2025-11-24 13:56:18 +01:00
Wim Taymans
3f292e3ce3 stream: generate PeerCapbility for old servers
Automatically make an empty PeerCapability param when we receive a
Latency event without a PeerCapability. This makes new client always
receive a PeerCapability param, even when the other side did not provide
anything or when the server is too old to collect them.
2025-11-21 10:19:36 +01:00
Wim Taymans
941fc5f51c spa: add Capability and PeerCapability
Add a new SPA_TYPE_OBJECT_ParamDict object that contains a struct with
key/value pairs. We're using something similar for Tags but this is a
more generic version.

Make a new Capability param that uses the ParamDict object. This is
meant to be used to describe capabilities with the generic key/value
struct.

Make a new PeerParam object where the keys are generic ids of the peer
objects and the values any Pod. The idea is to use this object to store
a peer objects. Make some helpers to iterate the peers and their
objects.

Add a new PeerCapability param that uses the PeerParam object with
Capability objects. This can be used to send the collection of
Capabilities from all peers to a port. This is a bit like the tags but
in a more generic way. The tags could also be implemented in this new
generic way later.

Make the PeerFormats use the same PeerParam of Format objects.

The Capability param is set on ports. impl-link will collect all
Capability objects into a PeerCapability object and send this to the
peer. The difference with the Tag param is that these Capability params
are not in any way forwared on the node automatically (like what is done
in the loopback module) because they represent the capabilities of the
ports betweem the link.
2025-11-21 10:08:46 +01:00
hackerman-kl
3372d8f102 module-avb: descriptor: moving to endstation builder (i.e es_builder) 2025-11-21 08:26:15 +00:00
hackerman-kl
55e4c7e4cb module-avb: descriptor: adding todo for simplification 2025-11-21 08:26:15 +00:00
hackerman-kl
57af462ecf modules-avb: Introducing entity builder. The entity builder is necessary
to attach ressource to the descriptors instead of having them splitted.

It is the case for the avb-streams which in a seperated list. Instead they
should be encapsulated within the descriptor itself, as one cannot leave
without the other.
2025-11-21 08:26:15 +00:00
hackerman-kl
8ea56477d9 module-avb: aecp-aem-descriptors: adding upper limit 2025-11-21 08:26:15 +00:00
hackerman-kl
f2093a3f76 module-avb: mrp: fix leavall timer issue, introducing lva state machine 2025-11-21 08:24:44 +00:00
hackerman-kl
03428f3380 module-avb: mrp: add human readable m*rp states 2025-11-21 08:24:44 +00:00
Daniel Tang
a7735677ae systemd: Bind pipewire-pulse to pipewire
Like filter-chain.service. No point in keeping pipewire-pulse.service
unusably running when pipewire.service is masked for a non-interactive
user.
2025-11-21 08:21:22 +00:00
Wim Taymans
dabd2af828 modules: handle NULL stream when getting time
The stream can be destroyed when requesting the time, fall back to
MONOTONIC time then.

Fixes #4970
2025-11-10 18:33:21 +01:00
Wim Taymans
fb20b96024 filter-graph: support inline convolver IRs
Refactor the IR loading code, Make some generic open/load/close
functions and handle the different filenames in the open call.

This makes it possible to reuse some of the delay and alloc code.

It also makes it easier to add new IRs loading code.

Support /IR:<rate>,<value1>,<value2>,... as an inline IR definition.
2025-11-10 16:42:29 +01:00
Carlos Rafael Giani
60c47e96a8 module-rtp: Change IGMP recovery log line levels from info to debug
The associated cases where IGMP membership is silently dropped may happen
infrequently. But when they do, these log lines can occur at a large
volume. To not spam the logs in such cases, change the log level from
info to debug.

Signed-off-by: Carlos Rafael Giani <crg7475@mailbox.org>
2025-11-10 14:55:21 +01:00
Arun Raghavan
3337af64ca pulse-server: Support clearing default sink/source
The PulseAudio way of doing this is to accept @NONE@ to clear the
default setting, so let's accept that.
2025-11-06 17:23:16 -08:00
Wim Taymans
7bd65cfe93 pulse-server: increase min quantum values
The default values of 128/48000 seem to be too low as a good default.
Bump them to 256/48000.

Fixes #4875
2025-11-06 12:52:48 +01:00
Wim Taymans
8f6566422f include <sys/types.h> for ssize_t
Fixes #4961
2025-11-06 12:33:54 +01:00
Wim Taymans
1191c18641 thread: add thread.reset-on-fork
Add a new thread.reset-on-fork property for the thread creator. when set
to false, it will clear the default SCHED_RESET_ON_FORK flag and new RT
threads will be able to fork and inherit the rt policy and priority.

When creating a thread make sure we set SCHED_RESET_ON_FORK when the
thread.reset-on-fork property is not explicitly false;

module-rt needs to preserve the SCHED_RESET_ON_FORK flag when changing
the policy.

Set thread.reset-on-fork=false explicitly for JACK clients to restore
the JACK behaviour where implementations can fork and inherit the RT
policy and priority by default.

Fixes #4966
2025-11-06 11:55:20 +01:00
Wim Taymans
fc55ceb2f4 impl-port: handle tags like latency
No links on the port will result in a NULL tag and >0 links will always
result in a non-NULL tag (that could be empty).

This makes it easier to see when a port is linked or not.
2025-11-05 11:26:23 +01:00
Wim Taymans
ffb7663f4d Revert "stream: add peer_added and peer_removed signals"
This reverts commit 3eb011c9d1.

Not a good idea, the internal signals are for scheduling peers and so
some peers are simply not signaled when they don't need to be scheduled,
like for async nodes or upstream nodes.
2025-11-04 13:52:35 +01:00
Wim Taymans
d610c84e31 Revert "test: fix test and indentation"
This reverts commit b0fe422b4f.
2025-11-04 13:50:35 +01:00
Wim Taymans
3aa931fdb0 Revert "stream: avoid emitting peer_added/removed for our id"
This reverts commit 78f5df2846.
2025-11-04 13:50:29 +01:00
Wim Taymans
78f5df2846 stream: avoid emitting peer_added/removed for our id
We internally also add ourselves as a peer when we are a driver. Avoid
emitting events for this.
2025-11-04 12:18:33 +01:00
Wim Taymans
b0fe422b4f test: fix test and indentation 2025-11-04 11:47:05 +01:00
Wim Taymans
3eb011c9d1 stream: add peer_added and peer_removed signals
Forward existing impl-node peer_added and peer_removed signals on the
stream.

Because the stream is not on the server, there is no impl_node in the
node target. Add the node id to the peer_added/removed signal and use
that for the stream event argument. Implementations can then look up the
details on the global.
2025-11-04 11:29:52 +01:00
Shengjiu Wang
ef7d4a3fc3 avb: fix frame header of listener
The vlan tag has been stripped by the kernel, the header should be
avb_ethernet_header.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2025-11-04 15:22:55 +08:00
Bernhard Sulzer
5bca3731a3 module-roc: Add support for multi-channel audio 2025-11-03 15:36:34 +00:00
fuleyi
23f0acfd1d pulse-server: Fix missing subscription events on device port changes
When a device profile changes (e.g., Bluetooth headset switching from
a2dp-sink to headset-head-unit), the active port information changes
but PulseAudio compatibility layer clients don't receive the expected
PA_SUBSCRIPTION_EVENT_SOURCE or PA_SUBSCRIPTION_EVENT_SINK change events.

Root cause:
The collect_device_info() function updates the active_port index from
SPA_PARAM_Route parameters, but doesn't update the corresponding
active_port_name field. When update_device_info() uses memcmp() to
detect changes in the device_info structure, it compares the entire
structure including active_port_name. If the pointer value doesn't
change (even though the actual port changed), no change is detected,
and the change_mask flag (PW_MANAGER_OBJECT_FLAG_SOURCE/SINK) is not
set, preventing subscription events from being sent.

Solution:
After setting active_port in collect_device_info(), look up the
corresponding port name from SPA_PARAM_EnumRoute parameters by
matching both the port index and direction. Initialize active_port_name
to NULL at the start to ensure it's always recalculated.

This fix applies to all device types (Bluetooth, USB, PCI sound cards)
and all profile switching scenarios, ensuring applications using the
PulseAudio compatibility layer receive proper device change notifications.

Tested with:
- Bluetooth headset profile switching (a2dp-sink ↔ headset-head-unit)
- Applications subscribing to PA_SUBSCRIPTION_MASK_SOURCE/SINK events
- Verified no regression in audio initialization
2025-11-03 15:31:15 +00:00
Barnabás Pőcze
fa8b0ba018 pipewiresrc: Fix renegotiation
Some downstream elements trigger re-negotiations when the stream is
running, e.g. due to output window resizing for the below pipeline.

gst-launch-1.0 pipewiresrc ! videoconvert ! video/x-raw ! gtk4paintablesink

This fails due to a side effect introduced by commit 77143e54 with
handle_format_change() setting `is_video` to `false` when param was
NULL. Fix this by explicitly tracking media type and not just video
using a boolean.
2025-11-03 15:27:46 +00:00
Wim Taymans
c63c100c4b pulse: use more specific type when parsing params
We expect a Struct for the classes and a Object for the props so we can
use the right POD type when persing.
2025-10-31 12:04:00 +01:00
Wim Taymans
a60eb4fe64 stream: add some redundant checks
Remove some redundant checks and handle calloc failure.
2025-10-31 11:48:22 +01:00
Robert Mader
77a5100280 gst: Use gst_util_uint64_scale instead of scale_int
GST_SECOND * t.rate.num can turn into a negative gint, resulting in
assertions like:
_gst_util_uint64_scale_int: assertion 'num >= 0' failed

Just use the 64bit version instead.
2025-10-30 16:46:58 +00:00
Wim Taymans
ff0bc22cb1 modules: support audio.layout where we can 2025-10-30 12:29:31 +01:00
Wim Taymans
9f3c553298 tools: add -t option to the help 2025-10-28 10:29:01 +01:00
Carlos Rafael Giani
1096d63468 module-rtp-source: implement IGMP recovery for multicast subscription loss
Add IGMP recovery mechanism that monitors RTP packet reception and
triggers multicast group refresh when no packets are received if
a deadline is reached. The deadline is configurable via a new stream
property "igmp.deadline.sec" (in seconds), with the default value
being 30 seconds (and a minimum of 5 seconds).

A timer checks regularly if the deadline was reached. That timer's
interval is set by the igmp.check.interval.sec property (in seconds),
with the default value being 5 seconds (and a minimum of 1 second).

When the deadline is reached, the mechanism performs IGMP leave/rejoin
operations to refresh multicast group membership. This ensures RTP
data continues to be received when network conditions cause IGMP
membership to expire or become stale due to router timeouts or
network issues.
2025-10-27 22:40:22 +01:00
Carlos Rafael Giani
955c9ae837 module-rtp: Get the current stream time in a reusable manner
That way, redundant pw_stream_get_nsec() and clock_gettime()
calls can be avoided.
2025-10-27 22:40:22 +01:00
Carlos Rafael Giani
3e0f4daf60 module-rtp-sap: implement IGMP recovery for multicast subscription loss
Add IGMP recovery mechanism that monitors SAP packet reception and
triggers multicast group refresh when no packets are received if
a deadline is reached. The deadline is set to half of the cleanup
interval, with a minimum of 1 second.

When the deadline is reached, the mechanism performs IGMP leave/rejoin
operations to refresh multicast group membership. This ensures SAP
announcements continue to be received when network conditions cause
IGMP membership to expire or become stale due to router timeouts or
network issues.
2025-10-27 22:40:22 +01:00
Carlos Rafael Giani
5d21e12658 module-rtp-source: Use make_socket() error value instead of errno
make_socket() already returns the negative errno.
2025-10-27 22:14:09 +01:00
Carlos Rafael Giani
f1ffd5e5e8 module-rtp-source: Read cleanup.sec property from stream properties
This allows for setting the cleanup.sec value in the create-stream
block in the module-rtp-sap configuration.
2025-10-27 22:14:09 +01:00
Carlos Rafael Giani
80e7302a05 module-rtp-sap: Add retry code for when start_sap() fails due to ENODEV 2025-10-27 22:14:09 +01:00
Carlos Rafael Giani
b57bd00be0 module-rtp-sap: Improve names for clearer code 2025-10-27 22:14:09 +01:00
Rui Matos
c1e737bbe4 module-rtp: Attempt to reconnect the ptp management socket
This should gracefully recover the cases where the other end of the
socket isn't ready yet when we start or terminates and gets restarted.
2025-10-27 18:08:00 +01:00
Jonas Holmberg
76a31a47c2 module-echo-cancel: Avoid discontinuity
Keep the samples in the ringbuffer that are needed the next cycle to
avoid discontinuity when the aec blocksize is not equal to or divisible
by quantum.
2025-10-27 14:39:29 +01:00
Wim Taymans
0276bb5b06 modules: ringbuffer avail is signed 2025-10-27 11:43:04 +01:00
Jonas Holmberg
614186a590 module-echo-cancel: Sync capture and sink buffers
Call process() when capture and sink ringbuffers contain data from the
same graph cycle and only process the latest block from them to avoid
adding latency that can accumulate if one of the streams gets more than
one buffer before the other gets its first buffer when starting up.
2025-10-27 08:43:08 +01:00
Pauli Virtanen
3d08c0557f properties: fix assign + conditional expression 2025-10-26 14:12:19 +00:00
Wim Taymans
c4244a6cf3 string: use spa_strbuf instead of snprintf magic 2025-10-24 17:00:11 +02:00
Wim Taymans
d18670d7bb pw-cat: improve channel checks
Make sure we don't use too many channels.
2025-10-24 10:42:05 +02:00
Wim Taymans
aa0272f6f3 treewide: remove some obsolete channel checks
The spa_audio_info can not be parsed with too many channels so there
is always enough space for the positions.
2025-10-24 10:31:45 +02:00
Wim Taymans
78219471ff spa: remove some obsolete functions
The spa_audio_info array now always holds enough positions for all
channels and we don't need to wrap around.
2025-10-24 09:35:59 +02:00