Commit graph

3775 commits

Author SHA1 Message Date
Wim Taymans
6e2522b657 modules: improve error reporting
Instead of reporting -EPIPE, get the error from the socket and report
that instead.
2026-03-02 12:13:22 +01:00
Jonas Holmberg
f4e174870e module-protocol-native: Fix socket activation
Fix path comparison in is_socket_unix() and don't unset LISTEN_FDS since
the function that uses it is called more than once and it was not unset
when sd_listen_fds() was used.

Fixes #5140
2026-03-02 10:28:26 +01:00
Wim Taymans
d206b06c70 sendspin: cleanup receive sync and logging
don't check the same thing twice.

Make sure values are set before we log them.
2026-03-01 12:49:24 +01:00
thewrz
8ceb671cc8 module-vban: derive write position from frame counter
Instead of writing packets sequentially and losing sync on any
frame gap, compute the write position from the VBAN header's
n_frames field. Out-of-order packets land at the correct
ringbuffer offset, matching how module-rtp handles this.

Only advance the writeindex when a packet extends the frontier
so that late arrivals fill gaps without moving the pointer
backwards.

Fixes: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/5145
2026-02-27 22:48:12 -08:00
Wim Taymans
b05fcdbfbd modules: fix compilation without avahi 2026-02-27 20:36:37 +01:00
Wim Taymans
8eed27820c meson: try to fix the doc build 2026-02-27 18:23:45 +01:00
Wim Taymans
9ad5ca2e5a websocket: fix some overflows
Fix some integer and buffer overflows as suggested by Sami Farin.
2026-02-27 17:58:51 +01:00
Wim Taymans
dee2d5ee06 zeroconf: sanitize the properties
Use some constants for the zeroconf properties. Make the right ones are
used in all places.
2026-02-27 17:31:42 +01:00
Wim Taymans
3a1b790588 modules: port snapcast to zeroconf helper 2026-02-27 17:31:38 +01:00
Wim Taymans
a065cff8c1 zeroconf: pass user data as const 2026-02-27 16:06:33 +01:00
Wim Taymans
db713c8264 modules: port rtp-session to new zeroconf helper 2026-02-27 13:50:49 +01:00
Wim Taymans
a1db2b8d35 pulse-server: port zeroconf publish to helper 2026-02-27 12:22:52 +01:00
Wim Taymans
c09bcfdc97 zeroconf: support proto, ifindex and subtypes
Also improve debug a little.
2026-02-27 12:22:24 +01:00
Wim Taymans
cd77dd0e62 zeroconf: add some more error checking
Also publish domain and host when we can and fix a memleak.
2026-02-26 23:19:53 +01:00
Wim Taymans
79d8e7f61d modules: port zeroconf-discover to new helper 2026-02-26 23:19:49 +01:00
Wim Taymans
b67937f247 module-raop: port to new zeroconf helper 2026-02-26 18:16:08 +01:00
Wim Taymans
fa04146cfb modules: move zeroconf code to zeroconf-utils 2026-02-26 17:09:45 +01:00
Wim Taymans
4a399172b6 sendspin: implement receiver zeroconf connect
Let a receiver connect to the zeroconf server. Add option to connect to
multiple serves with rules.

Fix some leaks.

Fixes #5095
2026-02-26 16:48:06 +01:00
Wim Taymans
d6654e84a7 sendspin: add sendspin sender and receiver
The sender makes an input stream for each connected client. This makes
it easier to do the per client conversion using the adapter and send
different channels to clients.

The receiver uses linear regression to map ringbuffer indexes to server
timestamps and server timestamps to client timestamps. It can then
schedule playback against its own clock.
2026-02-26 12:17:17 +01:00
Wim Taymans
be3c63d55e module-raop: move base64 to separate file 2026-02-26 12:00:31 +01:00
Wim Taymans
5a285602e2 scheduler: sync-groups don't define the node runnable state
The sync-groups are only to group nodes with the same driver but don't
make them runnable.

This avoid making v4l2 runnable (without a link) when running ardour
because ardour uses the transport, which activates the sync group.
2026-02-23 11:32:40 +01:00
Ripley Tom
367ce4626c
src/modules/module-rtp-source.c: Fix alignment requirement for 32 bit build 2026-02-21 20:55:17 +01:00
Wim Taymans
846096d435 scheduler: prepare link before usage
A link might become unprepared because a node suspended. When we want
to make the nodes runnable, make sure the link is prepared again.
2026-02-21 17:25:54 +01:00
Wim Taymans
476220c18b scheduler: don't take active state into account for grouping
The grouping of the node does not depend on the active state.
2026-02-21 16:33:21 +01:00
Wim Taymans
973f48dde7 scheduler: make always_process nodes runnable
Don't just set the flag but call make_runnable for always_process node
so that the peers also get activated.
2026-02-21 16:32:30 +01:00
Wim Taymans
9e82e49446 scheduler: rework the runnable state calculation
Move the runnable state calculation out of the collect_nodes function.
They are really two different steps that doin't overlap much.

The runnable state of a node is very easy to calculate. A node is
runnable if it is linked to another node without a passive port. When we
find two runnable nodes, make them runnable, which makes all nodes
linked to them runnable, stopping at passive ports.

We don't have to check the active state of the nodes or links to group
them together. This ensures we don't swap nodes around too much when the
node or link state changes.
2026-02-21 16:19:34 +01:00
Wim Taymans
8f3d8d77ab impl-link: prepare a link right after creating it
There is no reason to delay preparing the link (by the scheduler) when
both nodes are active, we can do that right from the start.

This makes things a bit more symetrical because deactivating a node does
not unprepare a link.

This however changes things a bit because you can no longer delay link
prepare until you activate the node. I don't know if this is actually in
use and it would probably be to delay format negotiation. The right way
do delay format negotiation is to wait until an EnumFormat is set but
that is something to improve later.
2026-02-20 10:35:31 +01:00
Barnabás Pőcze
d7c3e8c2bc pipewire: module-roc-{sink,source}: fix log format string issues
Passing an unknown string as the format string is unsafe, so don't do it.

Fixes: b9922d8ed5 ("module-roc: forward roc-toolkit logs to pipewire logs")
2026-02-19 19:37:15 +00:00
Barnabás Pőcze
d8b06f94ee pipewire: module-roc-{sink,source}: remove logging related unused code
!2699 has been merged a bit prematurely and it contained things that are
not used. So remove the unused member variables, functions, fix module
usage strings, and move some functions from headers.
2026-02-19 19:37:15 +00:00
Wim Taymans
2fb38af3e0 modules: move the scheduler to a module
Mostly because we can but also because there are more ways of doing
the scheduling and this opens the door for some experimentation.
2026-02-19 17:44:27 +01:00
Wim Taymans
be0e037809 pulse-server: avoid doing allocations and string copies
We can just concatenate the stream and client dict on the stack, reusing
all the strings without having to do allocations or copies.

Also filter out the object.id and object.serial from the client, we want
to keep the ones from the streams.
2026-02-19 13:03:50 +01:00
Wim Taymans
6eb4483069 pulse-server: add client props to sink_input/source_output
Instead of adding the client props to the stream props when we create
it, add them when we enumerate the streams.

This makes it possible to also have the client props in the stream props
for streams that are not created with the pulse API.

Fixes #5090
2026-02-19 12:08:23 +01:00
Misha Baranov
b9922d8ed5 module-roc: forward roc-toolkit logs to pipewire logs
Roc-toolkit log records are captured via a callback and
written to PipeWire log with corresponding verbosity level.
The log.level config parameter limits record verbosity at
the roc-toolkit level.
2026-02-19 08:42:29 +00:00
Wim Taymans
7956d7ceaf snapcast: support IPv4 link-local addresses 2026-02-17 13:08:56 +01:00
Wim Taymans
0e80287625 RAOP: also support link-local addresses for IPv4
Patch by Lairton Lelis da Fonseca Junior (@lairton)

Remove the hard skip for IPv4 link-local addresses and add an interface
binding (matching the existing IPv6 link-local behavior).

The host needs a link-local address on the interface (ip addr add
169.254.x.x/16 dev wlan0 or via NetworkManager +ipv4.addresses).

Fixes #4830
2026-02-17 13:02:03 +01:00
Wim Taymans
ab70dae0a8 modules: add PRIORITY_SESSION
For driver nodes, priority.session is needed to be able to change the
default device.

Fixes #5125
2026-02-16 10:38:05 +01:00
Hugo Osvaldo Barrera
57efceeb02 Implement socket activation without libsystemd
Socket activation uses sd_listen_fds from libsystemd, and can only be
compiled on systems with systemd.

This is an issue for Alpine / postmarketOS, where upstream has no
systemd package, but downstream depends on upstream's pipewire package
and wants to rely on socket activation. This also prevents using
socket-activation on other non-systemd distributions, including
non-Linux.

Implement equivalent functionality without a dependency on libsystemd.
2026-02-03 13:17:59 +01:00
Wim Taymans
ac7728097f snapcast: support newer snapcast service type
Newer snapcast servers publish the service as _snapcast-ctrl._tcp so
listen for that as well.

Fixes #5104
2026-02-03 10:01:38 +01:00
Carlos Rafael Giani
642504f5f9 module-rtp: Compensate for stream resampler effects in RTP sink node 2026-02-03 09:07:48 +01:00
Carlos Rafael Giani
6192c11038 module-rtp: Convert clock pos to RTP time in RTP source and factor in ASRC
This can easily be overlooked if the RTP rate equals the clock rate, which
is fairly common (for example, RTP rate and clock rate both being 48 kHz).

And, if an ASRC is active, and converting the output of the RTP source
node, the resampler's delay need to be taken into the account as well.
2026-02-03 09:07:48 +01:00
Stanislav Ruzani
e874f705a9 module-rtp: clear ringbuffer when stream stops to prevent old packets
Clear the ringbuffer in stream_stop() when processing stops to prevent old invalid packets
from being sent when processing resumes via rtp_audio_flush_packets().

This ensures a clean state when the stream restarts.
2026-02-03 09:07:48 +01:00
Carlos Rafael Giani
a16485f8aa module-rtp: Extract common RTP code into static library for better reuse 2026-02-03 09:07:48 +01:00
Carlos Rafael Giani
5d7f21f130 module-rtp: Improve rtp_audio_flush_packets() logging 2026-02-03 09:07:48 +01:00
Carlos Rafael Giani
9f0dc9c1af module-rtp: Update ringbuffer indices upon resync with proper API calls 2026-02-03 09:07:48 +01:00
Carlos Rafael Giani
543000151f module-rtp: Handle unsigned 32-bit integer overflow in constant delay mode 2026-02-03 09:07:48 +01:00
Carlos Rafael Giani
413f5762c4 module-rtp: Clear ringbuffer in constant delay mode
Clearing the ring buffer is important not only in the direct timestamp
mode, but also in the constant delay mode, since missed packets can lead
to gaps in the ring buffer. These gaps may have stale data inside if the
ringbuffer is not cleared after reading from it.
2026-02-03 09:07:48 +01:00
Carlos Rafael Giani
95970e539e module-rtp: Fix invalid ring buffer read attempts in direct timestamp mode
In corner cases where the read and write pointers are very close, it may
not be possible to read out all the wanted samples. This can for example
happen when there is a jump in the graph driver position. Currently, the
code reads the wanted number of samples out of the ring buffer regardless
of the write and read pointer positions. It does so even when the read
pointer is ahead of the write pointer (that is, an underrun occurs).

Fix this by checking the fill level and reading only the available amount
of samples if that amount is less than the wanted amount. The remaining
space in the target buffer is then filled with nullbytes.
2026-02-03 09:07:48 +01:00
Carlos Rafael Giani
a32e6e108c Revert "module-rtp: Remove device_delay from timestamp math"
This reverts commit dcdc19238b.

Reverting this because it caused big sync errors of ~62 ms in test setups.
Further discussions about this can be found here:

https://gitlab.freedesktop.org/pipewire/pipewire/-/merge_requests/2666

Followup commits modify the device delay application (by scaling it),
which is another reason why this needs to be reverted.
2026-02-03 09:07:36 +01:00
Wim Taymans
3c80f0fb3e filter-graph: add gain option to sofa
So that we can apply the gain to the IR. This is more efficient than
doing a volume after the convolution.

See #5098
2026-02-02 16:28:54 +01:00
Pauli Virtanen
f60e03b4ef pulse-server: use timeout also for creating sample-play streams
Add 35 sec timeout for PLAY_SAMPLE streams to start streaming, similar
to what we do with normal streams, and fail playback if they don't
start.

This avoids pending sample playback using up resources indefinitely if
streams fail to start for some reason, e.g. session manager is not
linking them.
2026-02-02 11:25:01 +00:00