Commit graph

15460 commits

Author SHA1 Message Date
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
Wim Taymans
2ee3d3e16b midifile: correctly write sysex chunks
In midifile we can write sysex continuation chunks starting with
0xf7 but we should not write the trailing 0xf0 byte, if any.
2026-05-21 16:47:22 +02:00
Wim Taymans
981613075f tools: pass maxsize to the fill function
Pass the max size of the buffer to the fill function.

Use this for writing midi events in the buffer. We can use the total
buffer size for midi events.

The n_frames is to limit the amount of midi events *in time*, not in
bytes.
2026-05-21 16:44:29 +02:00
Wim Taymans
a3bea5d586 impl-port: warn when loading a mixer fails 2026-05-21 16:43:38 +02:00
Wim Taymans
0fcaf1ccb2 conf: set the default mixer path correctly 2026-05-21 16:41:37 +02:00
Wim Taymans
7614a2a5d6 midifile: fix header writes on close
When writing a midifile, update the pos with each write so that the seek
back to 0 when updating the headers actually does something.
2026-05-21 14:04:19 +02:00
Wim Taymans
26a2467e7b alsa-seq: handle SysEx without snd_midi_event_t
When writing sysex, bypass the encoder and simply place the sysex
message in the seq queue. Make sure strip off the 0xf7 and 0xf0
continuation bytes.

When reading sysex, bypass the decoder and append/prepend the
continuation bytes.

This way, we can make the decoder buffer size back to something small
(large enough for one simple midi event) and we can handle arbitrary
sysex message lengths.
2026-05-21 12:45:43 +02:00
Wim Taymans
87a2ae2f15 pw-cat: split SysEx over multiple packets
Use the same method as RTP Midi to split long SysEx messages into chunks
that we can then put into buffers and reassemble again later.
2026-05-21 12:11:59 +02:00
Wim Taymans
4e389940e8 midifile: correctly write SysEx events
We need to place the sysex length in the message as well.
2026-05-21 12:11:59 +02:00
Arun Raghavan
f2de48f1e7 spa: aec: Expose more AGC modes as configuration 2026-05-20 17:57:19 +00:00
Arun Raghavan
9808a4baa0 spa: aec: webrtc: Allow enabling AGC1 and AGC2 independently 2026-05-20 17:57:19 +00:00
Arun Raghavan
3e5f072e11 spa: aec: webrtc: Actually enable adaptive analog control in AGC2
Without this, we only get a fixed 0dB gain + compressor.
2026-05-20 17:57:19 +00:00
Wim Taymans
e36d724d04 alsa-seq: increase MAX_EVENT_SIZE to 1024
This is also what a2jmidid has, so let's do the same.

See #5254
2026-05-20 13:25:20 +02:00
Wim Taymans
6e6fb1207d filter-graph: sync_volume initializes the control ports
Setting the volume control ports with a volume param also initializes
the controls. This ensures the controls are not restored to their
default value when the graph is activated.

Fixes #5192
2026-05-20 11:32:39 +02: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
a9f62579ba support: make sure loop_add_io is closes the fd when asked
When the close argument is true, loop_add_io is supposed to close the fd
even when an error occurs.

This makes it possible to have spa_steal_fd() work even in the case
of errors.
2026-05-15 13:21:55 +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
af151b088d pw-dump: also dump client permissions 2026-05-14 15:05:08 +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
61431dcbc0 audioconvert: add dither noise even on empty input
When we are asked to add noise bits, don't call the clear function.

Make the passthrough and clear-on-empty flags available with a new flag
field to make it more extensible.

Fixes #5260
2026-05-14 11:19:02 +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
b53ec3bceb impl-metadata: check PW_PERM_M permission on subject
To set a metadata on a subject, the subject must be visible (R) and we
must have the M permission on the subject.
2026-05-13 11:08:37 +02:00
Wim Taymans
a74109eef3 settings: clamp the clock rate to avoid 0 division
Setting the rate to 0 could in some cases result in a division by zero,
avoid that by clamping to a min value.
2026-05-13 10:47:52 +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
Pauli Virtanen
a5a3eaf2cb ci: bump bluez version to fix failing bluez_tests
Bump bluez to current master to fix bluez_tests failures.
Also bump pytest-bluezenv version to current.
2026-05-12 23:56:27 +03:00
Jonas Holmberg
a7994882b9 channelmix: Convert matrices to float arrays
Convert matrix_orig and matrix to float arrays and use variable size 2d
arrays to access the elements of the matrices. This removes the need for
storing pointers to matrix rows.
2026-05-12 14:47:57 +02:00