Commit graph

15493 commits

Author SHA1 Message Date
Wim Taymans
707e5e2643 pulse-server: avoid division by 0 in delay calculation
When we are not yet negotiated and the rate is not yet stored in the
stream sample spec, use a 0 delay instead of dividing by 0.
2026-06-04 21:13:09 +02:00
Wim Taymans
d05905f871 alsa: avoid rounding down period_size
Only try to round down the period_size to the lowest power of 2 when we
are resampling and scaling the period_size to match.

In all other cases, we should honour the requested quantum duration.

Fixes #5302
2026-06-04 16:54:37 +02:00
Arun Raghavan
cecdbc034f spa: aec: Fix a spurious warning while parsing args 2026-06-03 09:39:32 -07:00
Wim Taymans
a5c7dd3127 avb: fix compilation
This thing was broken.. mismatched brackets and const missing.
2026-06-03 12:43:15 +02:00
Wang Yu
8c8bd150ad sendspin: reject unsupported receive codecs
Commit b1b565339 ("sendspin: negotiate the first raw format") says that
FLAC and Opus are not supported yet. The receiver also only advertises
PCM formats in its player support.

Reject non-PCM stream/start codecs in the receiver. Otherwise
parse_player() accepts FLAC or Opus without setting client->stride,
while the receive path later uses client->stride as a raw frame size.

Signed-off-by: Wang Yu <wangyu@uniontech.com>
2026-06-03 10:38:50 +00:00
sirmbcode
1a1cd8d743 added zero padding and utf8-validation to entity parser for first test 2026-06-03 10:37:53 +00:00
sirmbcode
925cea5822 fixed spacing issues 2026-06-03 10:37:53 +00:00
sirmbcode
4cacdfcdf9 added calls to entity-parser.h for entity struct 2026-06-03 10:37:53 +00:00
sirmbcode
55172b92f9 added entity fields to avb conf 2026-06-03 10:37:53 +00:00
sirmbcode
8efbdcc022 added entity-parser.h 2026-06-03 10:37:53 +00:00
Wim Taymans
350eb9a041 midi: don't write trailing continuation 0xf0 for SysEx
Because our midi messages already have a size, we don't need the 0xf0
continuation terminator. Also having the terminator optionally requires
you to check and strip it if it's there.

The easiest algorithm is to check the first byte for start (0xf0) or
continuation (0xf7) and the last byte for end (0xf7) and that should be
enough to process the messages without having to ever stip the last
byte.
2026-06-01 13:08:11 +02:00
Wim Taymans
b41d117609 impl-port: make suspend go from INIT -> CONFIGURE
Bring the port to INIT before going to CONFIGURE when we do the suspend
logic.

This is to ensure that there always is a state change to emit the state
change notification. This was, the link can detect the suspend case and
cancel any pending results.

One of the problem with suspend is that the state changes on the ports
are done from different places; the port and link. This causes issues
like:

1. do_negotiate calls pw_port_set_param(Format,..) with the negotiated
   format. This returns async and the link queues a complete_ready
   callback.
2. The node is suspended, pw_impl_port_set_param(Format, NULL) is called
   to clear the port format. This bypasses the link.
3. The reply from step 2 arrives and triggers complete_ready, this
   brings the port state to READY and the link state to ALLOCATING.
4. The link continues allocating and sets buffers on the port. This then
   fails because the last format set was NULL.

Ideally all port states should be managed in one place and the async
port state changes should be kept in the port itself as well but this
will need some more work.

Fixes #3547
2026-06-01 10:34:40 +02:00
Wim Taymans
f22932580f impl-port: add port_suspend()
Move the logic to suspend a port to the port implementation. No
functional change with this.
2026-06-01 10:21:42 +02:00
Wim Taymans
54199d77c6 conf: disable portal.rt for pipewire and pipewire-pulse
Thse should not be portal clients and can go directly to rtkit.

The reason is that there is a locking problem in the portal rt
implementation that cause timeouts for some reason.
2026-06-01 10:00:47 +02:00
hackerman-kl
98ab3d73d4 milan-avb: es-builder: create and flag CRF input streams (fix NULL-server crash on activate) 2026-05-31 18:54:05 +02:00
hackerman-kl
9d08cb87c6 milan-avb: stream: do not wire CRF streams into the PipeWire audio graph 2026-05-31 18:54:05 +02:00
hackerman-kl
fc6245dca3 milan-avb: stream: flag CRF streams and ignore CRF packets by subtype in RX 2026-05-31 18:54:05 +02:00
Arun Raghavan
aef3d02173 module-rt: Use a sane timeout for DBus messages
The default of 30s (* 3 for the 3 lookups), makes the mainloop block for
a very long time if anything is wrong with RTKit.
2026-05-31 15:42:41 +02:00
Wim Taymans
7303a55b50 treewide: replace EBADFD with posix EBADF
EBADF was used in some places already, some other places used EBADFD
(with and without an #ifdef). EBADFD is linux specific.
2026-05-27 13:36:39 +02:00
Siva Mahadevan
db8bb8d489 pipewire: use EBADF in pw_load_spa_handle
This is defined in POSIX and is more portable
than the linux-specific EBADFD.
2026-05-26 12:07:33 -04:00
Wim Taymans
c6bcbab483 test: add tests for pw_conf_match_rules
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-26 17:44:16 +02:00
Wim Taymans
f195140702 conf: recurse into arrays before matching
When the value looks like an array, recurse into it and do the matching
on the array items instead of the whole value.
2026-05-26 17:08:35 +02:00
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
lumingzh
7ce0b0f339 update zh_CN.po 2026-05-26 09:36:49 +08: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
Wim Taymans
3b3b896b4f impl-port: remove unused count variable 2026-05-25 13:59:00 +02:00
Wim Taymans
12ca6f16d2 impl-node: use port_update_state() in suspend_node
Instead of just setting the port state directly, go through the
port_update_state() function. This will make suspend_node() also
emit the port state change event to the links. This then causes
the link to reset to INIT, which cancels pending complete_ready work
items and prevents them from changing the port to READY without a
valid format.

One possible situation where this could happen is when a suspend
happens while the port was waiting for a set_param(Format) reply from
the client-node.

See #3547
2026-05-25 13:22:38 +02:00
Wim Taymans
df32ab9844 tests: don't redefine spa_assert 2026-05-25 11:05:35 +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
George Kiagiadakis
6a0c0d45ff alsa: emit a node "error" event when snd_pcm_start() fails
This is meant to workaround a particular SoF firmware crash that requires the
device to be closed and re-opened to recover. This works in combination
with a WirePlumber monitor function that will destroy the node after
it enters this error state and will re-create it.
2026-05-25 07:51:57 +00:00
Wim Taymans
7f9a00cd94 test-ump-utils: add tests for all remaining conversion paths
Add coverage for channel pressure, system common messages (F1, F2, F3),
system realtime, MIDI 1.0 program change and channel pressure decoding,
sysex continue status, and roundtrip tests for program change, channel
pressure, song position, and system realtime.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-22 17:16:20 +02:00
Wim Taymans
4fbe2ef421 ump-utils: fix MIDI 2.0 pitch bend and mask program number
Fix spa_ump_to_midi() MIDI 2.0 pitch bend (0xE0) to extract both LSB
and MSB from the 32-bit value in word 2, giving full 14-bit resolution.
Previously the LSB came from a reserved field and was always zero.

Mask the program number with 0x7f for consistency with bank byte
masking.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-22 17:13:41 +02:00
Wim Taymans
26635056a4 ump-utils: fix MIDI 2.0 channel pressure and mask bank bytes
Fix spa_ump_to_midi() MIDI 2.0 channel pressure (0xD0) to emit the
status byte before the data byte. The fallthrough from default caused
the status to be missing, producing 1 byte instead of 2.

Mask bank MSB and LSB with 0x7f in MIDI 2.0 program change conversion
to ensure valid MIDI 1.0 data bytes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-22 17:05:42 +02:00
Wim Taymans
552eb1e618 ump-utils: fix sysex encoding and add F7 continuation support
Fix spa_ump_from_midi() to correctly encode short sysex messages as
Complete (0x0) instead of Start (0x1) when the entire message fits in
one UMP packet. Handle bare F7 termination when no data bytes follow.
Support 0xF7 as a sysex continuation marker and optional trailing 0xF0
as a continuation boundary.

Add unit tests for UMP/MIDI conversion covering note on, program change,
sysex complete/multi-packet/continue, system realtime, F7 continuation,
bare F7 end/complete/orphan, and trailing F0 scenarios.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-22 17:00:09 +02:00
Wim Taymans
4e1257a6e6 seq: the training 0xf0 in continuations is optional
This is not strictly required because our control events have a size and
don't need the 0xf0 trailing byte to find the boundary.

It also makes it easier to just use the midifile events directly without
having to add the 0xf0.
2026-05-21 17:51:51 +02:00
Wim Taymans
fdb08f3c60 pw-cat: send midi as-is by default
Don't try to convert midi and ump by default.
2026-05-21 17:13:42 +02:00