Commit graph

7475 commits

Author SHA1 Message Date
Wim Taymans
70b7b42f5d pw-cat: fix encoded format playback
We keep a mapping between the sndfile formats and the format we would
like to decode them to for encoded formats. Make sure we don't mix up
the sample widths between them.

Make sure we don't send encoded formats as raw.

Debug the uncompressed format name correctly.

Fixes #5155
2026-03-06 17:03:20 +01:00
Wim Taymans
a179e8c695 sendspin: implement parsing of client state 2026-03-06 11:24:21 +01:00
Wim Taymans
784ad934a4 impl-node: remove the can_suspend boolean
Sink and Sources can now be implemented as the follow passive mode,
they won't activate anything themselves but follow the state of the
peer.
2026-03-06 10:42:00 +01:00
Wim Taymans
118d8574c8 impl-port: support mode port.passive values
Add a port.passive = follow mode and the node.passive equivalents
out-follow, in-follow, follow.

This makes it possible to control how a port influences the state of
the peer and how the peer influences the state of the node independently.

In passive mode, the port will not make the peer runnable and will also
not become runnable when the peer activates.

In the follow mode, the port will not make the peer runnable but it will
become runnable when the peer is active.

This makes it possible to do new things like (f for follow):

  Source -> (f)loopback1-in|loopback1-out(f) -> Sink

It will not make the source and sink run but when one of them start, all
will become runnable.

Or you can now better do the leak node hack that was previously used:

  Source -> (f)pw-record

That will only start running when the source is activated by something
else.

With port.passive = true|false|follow there is a potential 4th case
which would activate the peer but not be activated by the peer, which is
not something that makes sense.
2026-03-06 09:35:17 +01:00
Wim Taymans
437a8d32f2 impl-node: remove the leaf node check
This was a hack around some scheduler issues that we should be able to
handle better now.

One of the cases is:

  Source -> (p)pw-record

Which would never work otherwise because pw-record does not activate the
Source and when the Source is activated in any other way, pw-record
would not follow.

This will still fail with the current scheduler, but the leaf check is
not so great because it doesn't work in this case:

  Source -> (p)loopback-in|loopback-out(p) -> Sink

What is probably required is a passive mode that doesn't activate but
does follows the peer.
2026-03-05 15:03:30 +01:00
Wim Taymans
106b4a37d4 node: remove node.link-group from drivers
Sink/Source pairs should not have the same link-group otherwise the
session manager will not be able to autoconnect them with a loopback or
some other internally linked stream.
2026-03-05 14:32:41 +01:00
Wim Taymans
e6a5951a47 gst: fix compilation on older GStreamer
These functions are since 1.28, which is a little too new.
2026-03-04 17:55:53 +01:00
Robert Mader
efd1526423 pipewiresrc: Use clock time difference to update last_buffer time
Setting the current clock time when resending buffers is often wrong.
Especially for pseudo-live sources - the default mode - it discards
the original buffer time, which again is used by the base-class to
adjust the timestamps further, ultimately resulting in very wrong
timestamps.

Instead, try to calculate the delta between when we originally got the
buffer and now.
2026-03-03 22:52:52 +01:00
Robert Mader
49300d8ee0 pipewiresrc: Take a copy instead of a reference for last_buffer
Buffer timestamps get adjusted by the base class, GstBaseSrc, even if we
take an additional ref. Arguably the base class should check if buffers
are writable (gst_buffer_make_writable()), which would trigger a buffer
copy. That is currently not the case, though, thus do so on our side.

Notes:
1. Usually a buffer copy doesn't copy the underlying memory, i.e.
copying is cheap.
2. The copy holds a reference to the copied buffer, preventing the
buffer from getting recycled as before.
2026-03-03 22:51:04 +01:00
Wim Taymans
a3853c2c3d scheduler: activate links also in make_runnable
Also make sure we unset the preparing flag when the port state
changes.
2026-03-03 11:56:35 +01:00
Elliot Chen
95e89f786a pipewiresrc: update per-plane stride and offset according to chunk info 2026-03-03 09:16:51 +00:00
Wim Taymans
ea21281f38 scheduler: skip checking runnable from suspendable nodes
We used to skip the runnable state from driver nodes because we assume
that they will be activated from other nodes. We however need to make
this more general to all suspendable nodes.

This makes pw-play -> loopback1-sink loopback1-out -> loopback2-sink
loopback-out -> sink also work correctly because the loopback2-sink does
not activate loopback1-out then.
2026-03-02 17:22:05 +01:00
Wim Taymans
797cdbc72f impl-link: link.passive is no longer used 2026-03-02 17:19:41 +01:00
Wim Taymans
b8e27cc02b modules: IO_HUP also has an error 2026-03-02 12:22:30 +01:00
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
ed361a856f tools: port various tools to the new json-builder
Remove custom json serialization code and use the new json-builder
from various tools.

spa-json-dump now has color and raw mode and can probably be simplified
a bit more.

The properties can now serialize arbitrarily large keys, which makes
a unit test work. It also has a new 'simple' option for SPA output,
which is added and used in pw-config.
2026-02-26 10:51:17 +01:00
Wim Taymans
6961bfeaa1 examples: adapt samplerate in audio-dsp-src
Follow the graph rate to generate the sine wav instead of using a
hardcoded value.

See #5135
2026-02-24 15:12:43 +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