Commit graph

4195 commits

Author SHA1 Message Date
Wim Taymans
784a9dd00f pulse: do all delay calculations when we need it
Just store the values for calculating the delay in the hot path. Then
compute the delay only when we need it.
2026-05-26 14:50:47 +02:00
Wim Taymans
3a9dbc6d99 pulse: add some SPA_LIKELY 2026-05-26 14:50:15 +02:00
Wim Taymans
753ed37ec5 pulse: inline the message check
Inline the resize check and then call the resize function when
necessary.
2026-05-26 14:48:47 +02:00
Torkel Niklasson
1066ec98a8 protocol-native: expose client supplementary GIDs
Retrieve the connecting client's supplementary group list via
SO_PEERGROUPS and store it as the "pipewire.sec.gids" property.
This allows access-control policies in wireplumber to match on
all groups and not just the primary.
2026-05-25 17:08:34 +00:00
Wim Taymans
4bde2415f9 scheduler: make active nodes go to IDLE
When a node is configured and supposed to be IDLE, set it to the IDLE
state, it does not matter if it is active or not.
2026-05-25 18:40:52 +02:00
Wim Taymans
63d824d35e scheduler: don't use & when && is wanted 2026-05-25 18:35:11 +02:00
Wim Taymans
22536600b8 pulse-server: use the new in-follow passive mode
A passive port is not automatically activated anymore by an active peer
node, it now needs the "follow" mode to follow the state of the peer without
activating it.
2026-05-25 18:19:12 +02:00
Wim Taymans
63eb53c1cb pulse-server: always set stream.capture.sink for monitor
Also set the stream.capture.sink when we find the sink by index, not
just by name when it ends with .monitor.
2026-05-25 18:17:51 +02:00
Wim Taymans
e0d7b37826 pulse-server: keep track of dont_inhibit_auto_suspend
Keep the flag dont_inhibit_auto_suspend around and use it do decide when
to send suspend messages to the client.

We don't always want to send suspend messages when the stream state changes
because that could happen because the stream was, for example, relinked.

The intention of the suspend message is mostly for monitor streams that
use the dont-inhibit flag and want to follow the suspend state of the
sink.

See #5273
2026-05-25 18:16:19 +02:00
Nils Tonnaett
c732df412c module-avb: add documentation to strings.c 2026-05-25 07:55:01 +00:00
Nils Tonnaett
4831ba60af module-avb: don't encode error as state 2026-05-25 07:55:01 +00:00
Nils Tonnaett
2dd60fdbc6 module-avb: fix types 2026-05-25 07:55:01 +00:00
Nils Tonnaett
3bde62bc1d module-avb: build strings.c 2026-05-25 07:55:01 +00:00
Nils Tonnaett
c9ba3ced91 module-avb: format strings.c 2026-05-25 07:55:01 +00:00
Nils Tonnaett
ef77d995cd module-avb: SET_NAME: check that string is valid utf8 and zero padded 2026-05-25 07:55:01 +00:00
Nils Tonnaett
14b1c4d3dd module-avb: add zero padding check function 2026-05-25 07:55:01 +00:00
Nils Tonnaett
b47c07b9cd module-avb: add UTF-8 validation function 2026-05-25 07:55:01 +00:00
Wim Taymans
753ce79c18 rtp: fix compilation 2026-05-20 09:09:38 +02:00
Wim Taymans
d56d5fa87a raop: implement retransmission
Keep the last relation between the sequence number and the timestamp
(ringbuffer position).

When a retransmission is requested for a given sequence number use the
relation to calculate the corresponding timestamp and retransmit the
packet from the ringbuffer again.

See #5276
2026-05-19 17:40:07 +02:00
Wim Taymans
a6fe6196d5 modules: remove redundant close
The close in the error path will never be called because the fd has been
stolen and will be -1.

Also make sure that when we free the source that we set it to NULL or
else the destroy function will try to free it again.
2026-05-18 16:58:20 +02:00
Wim Taymans
250260e18e modules: avoid double close when loop_add_io fails 2026-05-15 13:38:32 +02:00
Wim Taymans
894e97aaa5 modules: avoid double fd close
Now that loop_add_io, avoid double free on failures. Try to use
spa_autoclose and spa_steal_fd to make the error paths easier.
2026-05-15 13:34:48 +02:00
Wim Taymans
398f74571b module: check packet size for CK messages
Check that the CK packet is large enough before we start reading its
contents.
2026-05-15 10:45:14 +02:00
Wim Taymans
f3fc645496 connection: return error if too many fds in message
Check that the number of fds in the message doesn't exceed our max or
else we might overflow the fd buffer a little later.
2026-05-14 16:32:58 +02:00
Wim Taymans
79b4aba6cc pulse: also handle potential overflow in ROUND_UP 2026-05-14 16:27:20 +02:00
Wim Taymans
98fdedf348 filter-graph: relax LADSPA plugin loading
Make a new library.filter-path for the filter-graph that will filter and
restrict the dlopen filenames (used for the LADSPA plugin only).

By default this is false and so filter-chain can load from absolute
paths without extra checks.

Enable the extra checks for the pulse LADSPA modules and the
audioconvert filter graphs because these allow loading LADSPA plugins
into other processes.

Fixes #5222
2026-05-14 13:23:19 +02:00
Wim Taymans
4f975d0071 treewide: add error checking to spa_json_builder_close
There could have been a write error or allocation error while building
the json file that we can detect in spa_json_builder_close().

Error out instead of silently using a truncated JSON.

Use spa_autofree for the memory to make cleanup easier.
2026-05-13 18:14:44 +02:00
Wim Taymans
6d1c242433 pulse-server: implement more valid_args on modules
If the valid_args is NULL, reject all arguments.
2026-05-13 16:53:40 +02:00
Wim Taymans
5fa87d67a1 protocol-native: unref resource after logging the error 2026-05-13 11:12:17 +02:00
Wim Taymans
e5ff44910e pulse-server: improve module argument checking
Make the module valid_args a structure that includes the argument key,
description and some flags. Use this to enforce mandatory properties
in a more central place.

We should be able to generate the module usage from this as wel later to
have things a bit more structured.
2026-05-13 10:23:47 +02:00
Wim Taymans
b54bac1862 modules: make and use pw_net_is_multicast 2026-05-12 13:02:21 +02:00
Wim Taymans
6d998a9193 modules: use pw_net_get_ip
Make pw_net_get_ip also accept NULL ip to just get the port and ip
version. Make rtsp-client use pw_net_get_ip.

Make sure we initialize the iovec before logging in all cases.
2026-05-12 12:52:03 +02:00
Wim Taymans
8860dc809d pulse-server: use pw_net_get_ip instead of inet_ntop 2026-05-12 12:14:52 +02:00
Wim Taymans
62846acb3f modules: use pw_net_get_ip 2026-05-12 09:29:19 +02:00
Wim Taymans
0c193b2b82 modules: invert memcmp logic
memcmp returns 0 when the memory is equal. This function is not used
currently.
2026-05-12 09:18:56 +02:00
Wim Taymans
9843ee858f modules: use sockaddr_storage for socket address
sockaddr_in only works for ipv4, for ipv6, the address will be truncated
and then cause a stack overread in inet_ntop.
2026-05-12 09:15:46 +02:00
Niklas Carlsson
a9d7023ec3 filter-graph: add min plugin
Output the lowest sample value of a number of inputs.
2026-05-11 15:39:40 +00:00
Wim Taymans
b72f422f35 rtp: skip header extensions
When the header X bit is set, read the extension size and skip the
extension.
2026-05-11 09:25:31 +02:00
Wim Taymans
08d4e319cf avb: fix stack overflow in MRP parsing
AVB_MRP_VECTOR_GET_NUM_VALUES can be 13 bits and is stored in a
unit16_t. event_len and param_len are however calculated from this and
then truncated to 8 bits (uint8_t) which causes the bounds check to
silently pass and cause an OOB read.

Change the type to uint16_t to avoid overflows.
2026-05-08 18:13:12 +02:00
Wim Taymans
4c8093fa72 combine-stream: clean up some variables
Move the source offs, stride, data and size calculations out of the
destination loop. We only need to clamp the size to copy to the maxsize
of the destination buffer.
2026-05-08 13:10:30 +02:00
Wim Taymans
93b940edef module-combine: limit size to buffer maxsize
Limit the amount of data we write to the destination buffer to its
maxsize.
2026-05-08 13:01:11 +02:00
Wim Taymans
6d3122c1b1 sap: avoid reading past the end of the string
parse_sdp_a_rtpmap used c += strlen(c) + 1 to skip past the MIME type to the
rate/channels part, but if the a=rtpmap: line had no / separator, strcspn
returned the full string length and the +1 advanced past the null terminator.

Fix this by checking if / was actually found, returning -EINVAL if not.
2026-05-08 11:57:07 +02:00
Wim Taymans
7fd3e13a3e netjack2: handle 0 in sync frames
JACK2 only sends -1 as the frames, meaning we should take the value from
the negotiated period as the frames to process.

We however send the actual number of frames and use the sync value to
decide how many frames to process. We need to be careful because a value
of 0 will cause a division by 0 so treat <= 0 frames the negotiated period
size as well.
2026-05-08 11:42:15 +02:00
Wim Taymans
753eae9302 netjack2: check config against MAX_CHANNELS
Check that the params don't include more than MAX_CHANNELS of audio or
else we overflow the position array.

Adapt to the compiled value of SPA_AUDIO_MAX_CHANNELS but allow at least
128 channels.
2026-05-08 11:07:03 +02:00
Wim Taymans
6cee86e509 sendspin: avoid buffer overread
Check that we have enough bytes (>=9) to parse the message type and the
timestamp.
2026-05-08 10:33:39 +02:00
Wim Taymans
22243d5ce9 sendspin: handle parse_player errors
Otherwise, this might leave the stride 0 and cause a division by 0
later.
2026-05-08 10:32:28 +02:00
Wim Taymans
5b37b9cf99 filter-graph: remove the pipe filter
It's a terrible idea, doesn't work so well (locks up the data-loop when
read is blocked) and a security mightmare. If you really need to pipe
samples through some program, do that somewhere else, like from the
command line with pw-cat and pw-record.
2026-05-08 10:16:12 +02:00
Wim Taymans
97c8a0a5ae modules: update docs for the pipe plugin 2026-05-07 14:46:21 +02:00
Wim Taymans
e3f75314be vban: fix timestamp overflows
Like how it is done in RTP.
2026-05-07 14:07:33 +02:00
Wim Taymans
e9aff3040a modules: free the stream and impl on errors 2026-05-07 13:30:12 +02:00