Commit graph

14917 commits

Author SHA1 Message Date
Wim Taymans
f210d93ea6 convolver: remove intermediate convolver
We can simply use the first one with more segments.
2026-04-17 10:39:36 +02:00
Wim Taymans
839e0a4aaf convolver: optimize loops
We can use a single loop with just one memcpy to implement the delay
buffer and feed the different FFTs.
2026-04-17 10:38:38 +02:00
Wim Taymans
37b648a3e0 convolver: convolver1 -> partition 2026-04-17 10:37:13 +02:00
zuozhiwei
d4b472d2e5 tools: fix realloc failure handling in midifile ensure_buffer
On realloc failure, the old mf->buffer pointer should be preserverd to avoid memory leaks.
2026-04-17 10:04:35 +08:00
Chiluka Rohith
61a9c78e1d pw-cat: Fix waveX format endian assign
SF_FORMAT_WAVEX is not supported to SF_ENDIAN_CPU. Due to that, unable
to record in .wav file (for > 2 channels).  Add case for SF_FORMAT_WAVEX
to get assign SF_ENDIAN_FILE.

Fixes #5233
2026-04-16 13:54:24 +02:00
Wim Taymans
c5d8113302 pipewire-jack: also ignore ports with other DSP type
The DSP port type needs to be something else than "other" for it
to become visible. This way we can also remove the IS_VISIBLE check
because we never add invisible ports to the object list.
2026-04-16 13:47:08 +02:00
Wim Taymans
9454c71a58 jack: don't emit "other" ports
When we see a non-dsp port, simply ignore it. This will make sure also
the links are ignored.

See #3512
2026-04-16 13:36:23 +02:00
Masum Reza
f76327e076 alsa: acp: don’t override user-selected port on availability changes
ACP was re-selecting the “best” port on every port availability event,
even when a port was already explicitly selected by the user. This
differs from PulseAudio’s behavior, where port switching decisions are
left to higher-level policy.

This caused issues on devices where Line Out (speakers) and Headphones
share the same analog interface: when headphones are plugged in, ACP
would immediately switch away from the user-selected Line Out, or end up
in a state where no sound is produced despite selecting speakers explicitly from
clients like pwvucontrol.

Fix this by only re-evaluating and switching ports when:
  - no active port is currently selected, or
  - the active port has become unavailable

This preserves manual user choices and prevents ACP from fighting client
port selections during route activation.

Additionally, adjust ALSA mixer paths to better separate Line Out and
Headphones behavior:
  - Disable Line Out controls in the headphones path
  - Add explicit Line Out and Auto-Mute Mode handling in the lineout path

Together, these changes align PipeWire’s behavior more closely with
PulseAudio and fix cases where selecting speakers while headphones are
plugged results in no audio output.

Signed-off-by: John Titor <masumrezarock100@gmail.com>
2026-04-16 10:45:01 +00:00
hackerman-kl
c551acf4d1 milan-avb: lock: make it lockable:
1. The period calls were added to handle timeouts.
2. Handle the case where lock must be unlocked after 60s if the
   controller owning the locked does not release it.
2026-04-16 12:42:23 +02:00
Wim Taymans
adad89dc0e add spa_memcpy to more places
Use spa_memcpy yo where we memcpy data so that when the debug option is
enabled we can see more.
2026-04-16 12:16:06 +02:00
Wim Taymans
54aba261d2 tools: add pw-audioconvert
Takes an input file, processes it with audioconvert and writes to an
output file. Can be used to test all audioconvert features such as
resample, channelmix, filter-graph, format conversion, dither, etc.

Boilerplate written by Claude.
2026-04-16 12:14:21 +02:00
zuozhiwei
b4457b871f core: use %u format specifier for uint32_t IDs
The object, node, client, factory, module, and link IDs are all uint32_t values but were being formatted with %d.
This would produce incorrect negative values if an ID ever exceeded INT_MAX
2026-04-16 08:54:15 +00:00
Wim Taymans
35cbd2e56a audioconvert: don't setup again in suspend
Remove the fallthrough in suspend, we don't want to do the setup that we
do in the paused mode, just reset the node and unset the started state.
2026-04-16 10:12:09 +02:00
Wim Taymans
e490c503fd pulse-server: update initial stream is_paused state
When the stream starts corked, we set the INACTIVE flag and we also need
to set the stream state as PAUSED or else uncork will not unpause
anything.
2026-04-15 18:25:28 +02:00
Wim Taymans
03fd89abea alsa-seq: add : between client and port name
The separator is important for applications to find the client name and
group ports.

Fixes #5229
2026-04-15 11:20:18 +02:00
zuozhiwei
3277f3acfb alsa: fix inverted port validity check in port_reuse_buffer
The CHECK_PORT condition in impl_node_port_reuse_buffer was inverted with a negation operator, causing the function to reject valid output ports and accept invalid ones.

Fixes the logic so that valid ports proceed to buffer recycling and invalid ports are properly rejected.
2026-04-15 09:17:49 +00:00
Wim Taymans
ae723a69f6 filter-graph: allow negative Gain in mixer
To allow for polarity changes.

Fixes #5228
2026-04-15 09:41:55 +02:00
Wim Taymans
823dcd8843 scheduler: make nodes move to IDLE when inactive
When a node is inactive but linked to a driver, the only reason it is
not being scheduled is because it is inactive.

We already set up the links and negotiate the format and buffers to
prepare going to RUNNING. This patch now also make the node go to IDLE,
which makes the adapter negotiate a forma and buffers with the internal
node.

This makes things more symetrical, when linking a node, it becomes IDLE,
when activating it becomes RUNNABLE, when inactive it goes back to IDLE.
The switch to RUNNING will also be faster when things are already set up
in the IDLE state.

The main advantage is that it allows us to implement the startup of
corked streams in pulseaudio better. Before this patch we had to set the
stream to active to make it go through the Format and buffer negotiation
and then quickly set it back to inactive, hopefully without skipping a
cycle. After this patch, the corked stream goes all the way to IDLE,
where it then waits to become active.

See #4991
2026-04-14 14:28:29 +02:00
Wim Taymans
474253719f alsa-seq: remove port from mix_list on destroy
When the port is destroyed we need to remove it from the mix_list or
else the process function will keep trying to use the invalid memory.

This is because the port logic does not want to call any functions on
the port (like clearing the IO or Format) after it emitted the destroy
signal and we need to clean up ourselves.

Fixes #5221
2026-04-14 11:09:29 +02:00
Wim Taymans
0cc3644e55 dlopen: support search path ending in /
When the search path is /usr/lib/, /usr/lib/foo.so fails to load because
there is no / after the search path. Fix this by requiring that either
the search path end with / or the following char is a /.
2026-04-13 10:26:33 +02:00
Julian Bouzas
14b74962d6 tools: connect to the manager socket by default
This gives the tools unrestricted access by default if access.socket is defined
in the configuration access module.
2026-04-13 07:39:45 +00:00
Wim Taymans
b12b7f785e pipewire: check init count before loading plugins
When pw_init() was not called and the init_count is 0, the plugin path
was not set and loading plugins will fail/segfault.

Avoid this and return en error early instead with a message that
pw_init() should be called first.

See !2784
2026-04-13 09:33:05 +02:00
zuozhiwei
11d28c661b Fix spelling errors in comments and log messages
- Fix durring → during in es-builder.c error message
- Fix capabilty → capability in impl-port.c debug log
- Fix supress → suppress in rate-control.h comment

Improve code readability
2026-04-13 07:20:11 +00:00
hackerman-kl
4b886d07f7 milan-avb: pw-avb-virtual: activate only when necessary 2026-04-13 07:15:39 +00:00
Марко М. Костић (Marko M. Kostić)
c3c74257fa
po: Update Serbian and add Serbian Latin translations 2026-04-11 15:14:16 +02:00
Марко М. Костић (Marko M. Kostić)
013bd12592
po: Alpha-sort LINGUAS 2026-04-11 15:14:06 +02:00
Wim Taymans
5075f27ea0 filter-graph: small convolver optimizations
Use FMA when we can, make sure FMA compilation is supported and the CPU
also supports it at runtime.

Avoid divisions by doing the modulo increment more explicitly.
2026-04-10 12:17:25 +02:00
Wim Taymans
c2f85ffc51 filter-chain: improve docs
Add the default values to the docs for some of the convolver config
variables.
2026-04-09 16:35:17 +02:00
Wim Taymans
b1a9bc966b tools: fix compiler error on older compilers
COLS could be very small and the statusbar array might overflow with
strcpy and strcat. Also initializing the variable array seems to cause
problems on older compilers.

Instead use a fixed array that is big enough to hold all possible
values we write into it.
2026-04-09 16:32:16 +02:00
Wim Taymans
1ed1349e7c test: fix some compiler warnings
be64toh returns a uint64_t so there is no need for casts in the test.
2026-04-09 13:04:35 +02:00
Martin Geier
42415eadd9 bluez5: iso-io: don't use streams without tx_latency enabled for fill level calculation
When there is a stream without tx_latency enabled, the fill_count ends
with MIN_FILL value. This causes one buffer of silence to be written to
every stream before the actual data in each iteration.
Consequently, more data is written than consumed in each iteration.
After several iterations, spa_bt_send fails, triggering a
group_latency_check failure in few next iterations and leading to
dropped data.

Skip streams without tx_latency enabled in fill level calculations
to prevent these audio glitches.
2026-04-09 08:00:37 +00:00
lumingzh
eeaddbb385 update Chinese translation 2026-04-09 07:45:56 +00:00
Christian F.K. Schaller
f5259828b6 tools: add pw-avb-virtual for virtual AVB graph nodes
Add a standalone tool that creates virtual AVB talker/listener endpoints
visible in the PipeWire graph (e.g. Helvum). Uses the loopback transport
so no AVB hardware or network access is needed.

The sink node consumes audio silently, the source produces silence.
Supports --milan flag for Milan v1.2 mode and --name for custom node
name prefix.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-09 07:43:19 +00:00
Christian F.K. Schaller
14310e66fe module-avb: extend transport abstraction to stream data path
Add stream_setup_socket and stream_send ops to avb_transport_ops so the
stream data plane can use the same pluggable transport backend as the
control plane. Move the raw AF_PACKET socket setup from stream.c into
avdecc.c as raw_stream_setup_socket(), and add a raw_stream_send()
wrapper around sendmsg().

Add a stream list (spa_list) to struct server so streams can be iterated
after creation, and add stream_activate_virtual() for lightweight
activation without MRP/MAAP network operations.

Implement loopback stream ops: eventfd-based dummy sockets and no-op
send that discards audio data. This enables virtual AVB nodes that work
without network hardware or privileges.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-09 07:43:19 +00:00
Christian F.K. Schaller
ffa855d76e test: add additional AVB protocol coverage tests (phases 7-8)
Add 26 new tests covering protocol areas not yet exercised:

Phase 7 (12 tests):
- MAAP conflict detection: probe/announce conflicts, defend logic
- ACMP disconnect: RX forwarding, TX without stream, pending timeout
- AECP GET_AVB_INFO: success path and wrong descriptor type
- MRP timers: leave-all and periodic timer verification
- MSRP talker-failed: attribute processing with failure info

Phase 8 (14 tests):
- MVRP: attribute lifecycle, VID packet encoding
- MMRP: attribute type verification (MAC + service requirement)
- ADP: duplicate entity, targeted discover, readvertise, departure
- Descriptor lookup: edge cases, data integrity after add
- AECP commands: GET_CONFIGURATION, GET_SAMPLING_RATE, GET_NAME

Total test count: 72 tests across 8 phases.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-09 07:43:19 +00:00
Christian F.K. Schaller
cec53759dd test: add AVTP audio data path tests
Add 10 Phase 6 tests for the AVTP audio data path:
- IEC61883 and AAF packet structure layout validation
- 802.1Q frame header construction
- PDU size calculations for various audio configurations
- Ringbuffer audio data round-trip integrity
- Ringbuffer wrap-around with multiple PDU-sized writes
- IEC61883 receive simulation (packet → ringbuffer)
- IEC61883 transmit PDU construction and field verification
- Ringbuffer overrun detection
- Sequence number and DBC counter wrapping

These tests validate the AVTP packet formats and audio data path
logic without requiring hardware, AF_PACKET sockets, or CLOCK_TAI.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-09 07:43:19 +00:00
Christian F.K. Schaller
fdfede8b96 test: add AECP/AEM entity model tests and document new bugs
Add 12 Phase 5 tests for the AECP/AEM entity model:
- READ_DESCRIPTOR for existing and non-existent descriptors
- AECP packet filtering (wrong EtherType, wrong subtype)
- Unsupported AECP message types (ADDRESS_ACCESS, etc.)
- Unimplemented AEM commands (REBOOT, etc.)
- ACQUIRE_ENTITY and LOCK_ENTITY for legacy mode
- Milan ENTITY_AVAILABLE, LOCK_ENTITY (lock/contention/unlock)
- Milan LOCK_ENTITY for non-entity descriptors
- Milan ACQUIRE_ENTITY returns NOT_SUPPORTED
- Milan READ_DESCRIPTOR

Also adds Milan test server helper with properly sized entity
descriptor for lock state, and AECP/AEM packet builder utility.

Updates avb-bugs.md with 3 new bugs found (bugs #6-#8).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-09 07:43:19 +00:00
Christian F.K. Schaller
e661c72272 test: add ACMP integration tests and bug documentation
Add Phase 4 ACMP integration tests:
- NOT_SUPPORTED response for unimplemented commands
- CONNECT_TX_COMMAND with no streams (error response)
- Entity ID filtering (wrong GUID ignored)
- CONNECT_RX_COMMAND forwarding to talker
- Pending request timeout and retry
- Packet filtering (wrong EtherType/subtype)

Also add avb-bugs.md documenting all bugs found by the test suite.

Total: 24 tests, all passing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-09 07:43:19 +00:00
Christian F.K. Schaller
f5c5c9d7a3 test: add MRP state machine, MSRP, and packet parsing tests
Extend the AVB test suite with Phase 3 tests:

MRP state machine tests:
- Begin/join/TX cycle with NEW attribute
- Join then leave lifecycle
- RX_NEW registrar notification callback
- Registrar leave timer (LV -> MT after timeout)
- Multiple coexisting attributes

MSRP protocol tests:
- All four attribute types (talker, talker-failed, listener, domain)
- Domain and talker transmit via loopback capture
- Talker-failed notification (validates NULL deref fix)

MRP packet parsing tests:
- Single domain value parse
- Leave-all (LVA) flag detection
- Three-value base-6 event decoding

Total: 18 tests, all passing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-09 07:43:19 +00:00
Christian F.K. Schaller
ef4ff8cfd0 test: add AVB protocol test suite with loopback transport
Add a test suite for the AVB (Audio Video Bridging) protocol stack that
runs entirely in software, requiring no hardware, root privileges, or
running PipeWire daemon.

The loopback transport (avb-transport-loopback.h) replaces raw AF_PACKET
sockets with in-memory packet capture, using a synthetic MAC address and
eventfd for protocol handlers that need a valid fd.

Test utilities (test-avb-utils.h) provide helpers for creating test
servers, injecting packets, advancing time, and building ADP packets.

Tests cover:
- ADP entity available/departing/discover/timeout
- MRP attribute lifecycle (create, begin, join)
- Milan v1.2 mode server creation

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-09 07:43:19 +00:00
Christian F.K. Schaller
a73988d38d module-avb: add transport abstraction for pluggable network backends
Introduce struct avb_transport_ops vtable with setup/send_packet/
make_socket/destroy callbacks. The existing raw AF_PACKET socket code
becomes the default "raw" transport. avdecc_server_new() defaults to
avb_transport_raw if no transport is set, and avdecc_server_free()
delegates cleanup through the transport ops.

This enables alternative transports (e.g. loopback for testing) without
modifying protocol handler code.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-09 07:43:19 +00:00
Christian F.K. Schaller
d9821d09c7 module-avb: fix Milan lock entity error response and re-lock timeout
Fix two bugs in handle_cmd_lock_entity_milan_v12():

1. When server_find_descriptor() returns NULL, reply_status() was called
   with the AEM packet pointer instead of the full ethernet frame,
   corrupting the response ethernet header.

2. When refreshing an existing lock, the expire timeout was extended by
   raw seconds (60) instead of nanoseconds (60 * SPA_NSEC_PER_SEC),
   causing the lock to expire almost immediately after re-lock.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-09 07:43:19 +00:00
Christian F.K. Schaller
4e62826e01 module-avb: fix legacy AECP handlers reading payload at wrong offset
handle_acquire_entity_avb_legacy() and handle_lock_entity_avb_legacy()
incorrectly treated the full ethernet frame pointer as the AEM packet
pointer, causing p->payload to read descriptor_type and descriptor_id
from the wrong offset. Fix by properly skipping the ethernet header,
matching the pattern used by all other AEM command handlers.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-09 07:43:19 +00:00
Christian F.K. Schaller
3f386ecd34 module-avb: fix ACMP error responses sent with wrong message type
In handle_connect_tx_command() and handle_disconnect_tx_command(),
AVB_PACKET_ACMP_SET_MESSAGE_TYPE() is called after the goto done
target. When find_stream() fails and jumps to done, the response
is sent with the original command message type (e.g., CONNECT_TX_COMMAND)
instead of the correct response type (CONNECT_TX_RESPONSE).

Move the SET_MESSAGE_TYPE call before find_stream() so error responses
are always sent with the correct response message type.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-09 07:43:19 +00:00
Christian F.K. Schaller
1d0c51f057 module-avb: fix MRP NEW messages never being transmitted
AVB_MRP_SEND_NEW was defined as 0, making it indistinguishable from
"no pending send" in the MSRP and MVRP event handlers which check
`if (!pending_send)`. This meant that when an attribute was first
declared (applicant state VN or AN), the NEW message was silently
dropped instead of being transmitted on the network.

Fix by shifting all AVB_MRP_SEND_* values to start at 1, so that 0
unambiguously means "no send pending". Update the MSRP and MVRP
encoders to subtract 1 when encoding to the IEEE 802.1Q wire format
(which uses 0-based event values).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-09 07:43:19 +00:00
Christian F.K. Schaller
ef8f820d4a module-avb: fix potential NULL pointer dereference in MSRP/MVRP notify
The msrp_notify() and mvrp_notify() functions call dispatch table
notify callbacks without checking for NULL. In MSRP, the
TALKER_FAILED attribute type has a NULL notify callback, which would
crash if a talker-failed attribute received a registrar state change
notification (e.g. RX_NEW triggering NOTIFY_NEW).

Add NULL checks before calling the dispatch notify callbacks, matching
the defensive pattern used in the encode path.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-09 07:43:19 +00:00
Christian F.K. Schaller
bdaecfebb8 module-avb: fix heap corruption in server_destroy_descriptors
server_add_descriptor() allocates the descriptor and its data in a
single calloc (d->ptr = SPA_PTROFF(d, sizeof(struct descriptor))),
so d->ptr points inside the same allocation as d. Calling free(d->ptr)
frees an interior pointer, corrupting the heap. Only free(d) is needed.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-09 07:43:19 +00:00
Wim Taymans
20d648aaad filter-chain: don't corrupt the enumerated properties
When we add a Format property after we dereffed all the other params in
the builder, we might relocate the builder memory and invalidate all
previously dereffed params, causing corruption.

Instead, first add all the params to the builder and then deref the
params.

There is a special case when we have both a capture and playback
stream. The capture stream will receive all filter params and the
playback stream will just receive its Format param.

Fixes #5202
2026-04-08 17:49:41 +02:00
Wim Taymans
dc47f9ea45 filter-graph: return current control value correctly
The control values are only set in the port control_data after the
filter has been activated and the instances are created.

Property enumerations might happen before that and then we can either
return the current_value (when set in a control section or later with a
param property) or the default value.
2026-04-08 17:45:28 +02:00
Wim Taymans
0f00ad19cb tools: clean up the preset filter code 2026-04-08 15:01:11 +02:00