Commit graph

13667 commits

Author SHA1 Message Date
Sam James
2cec77e7df *: unify config.h handling
config.h needs to be consistently included before any standard headers
if we ever want to set feature test macros (like _GNU_SOURCE or whatever)
inside. It can lead to hard-to-debug issues without that.

It can also be problematic just for our own HAVE_* that it may define
if it's not consistently made available before our own headers. Just
always include it first, before everything.

We already did this in many files, just not consistently.
2025-05-30 10:24:13 +00:00
Wim Taymans
50fe63ea76 examples: exit early when no longer running
When we are no longer running after the eventfd was signaled, stop
producing samples.
2025-05-30 12:17:41 +02:00
Wim Taymans
fecf1bcba4 thread-loop: remove the event
We don't need the event to wake up and stop the thread loop, we can
simply use _invoke() of the loop implementation, like we do for the
data loop.
2025-05-30 12:12:03 +02:00
Wim Taymans
820e0fccb1 loop: we can't actually use locked to stop the loop
We need to signal the event and wake up the loop to actually make it
stop and joinable.
2025-05-30 12:07:47 +02:00
Wim Taymans
c45d667934 loop: spa_loop_invoke -> spa_loop_locked where possible
When we simply need to change some state for the code executed in the
loop, we can use locked() instead of invoke(). This is more efficient
and avoids some context switches in the normal case.
2025-05-30 11:59:35 +02:00
Sam James
b943c31fd8
*: don't include standard C headers inside of extern "C"
Including C headers inside of `extern "C"` breaks use from C++. Hoist
the includes of standard C headers above the block so we don't try
to mangle the stdlib.

I initially tried to scope this with a targeted change but it's too
hard to do correctly that way. This way, we avoid whack-a-mole.

Firefox is working around this in their e21461b7b8b39cc31ba53c47d4f6f310c673ff2f
commit.

Bug: https://bugzilla.mozilla.org/1953080
2025-05-30 09:48:28 +01:00
Carlos Rafael Giani
e2731914ad pw-cat: Document numeric WMA constants 2025-05-29 22:24:31 +02:00
Carlos Rafael Giani
7341cc401b pw-cat: Add support for AC3, EAC3, TrueHD, DTS, MPEG-H 2025-05-29 22:24:07 +02:00
Carlos Rafael Giani
5db9bca75c spa: add AC3, EAC3, TrueHD, DTS, MPEG-H formats 2025-05-29 21:41:51 +02:00
Carlos Rafael Giani
bd25614cb9 spa: Include Opus in compressed.h header
Opus is a compressed format.
2025-05-29 20:51:49 +02:00
Carlos Rafael Giani
cef14695b6 spa: Fix iec958 docs 2025-05-29 20:47:36 +02:00
Carlos Rafael Giani
6f197484fc spa: Fix AAC stream format docs 2025-05-29 20:47:02 +02:00
Carlos Rafael Giani
592c7c404c spa: Add channel mode to mp3 audio info and add channel mode docs 2025-05-29 20:46:46 +02:00
Arun Raghavan
2042a0483b ci: Add an x86 build
Fairly minimal for now to save time, but we can add more deps and cover
more code as needed. We don't test or install as this isn't a native
build and we just want to make sure it builds for now.
2025-05-29 08:29:34 +00:00
Wim Taymans
34796d5bb8 loop: keep a free_list of sources
When a source is destroyed, move it to a free_list and reuse the memory
when a new source is made. This way we can avoid doing a free() from
the epoll thread.
2025-05-29 10:17:16 +02:00
Wim Taymans
f2452a6af7 spa: some more invoke -> locked calls 2025-05-29 10:17:16 +02:00
Wim Taymans
f7fdafc203 loop: add method to run a function with the lock
Convert some _invoke to _locked
2025-05-29 10:17:16 +02:00
Wim Taymans
fb49e0795c loop: move thread-loop to support loop
Add more synchronization primitives to spa loop so that we can replace
the thread-loop with it.
2025-05-29 10:17:16 +02:00
Wim Taymans
cd1d9ceff1 context: make data loop prio-inherit 2025-05-29 10:17:16 +02:00
Wim Taymans
65cbbf1a02 spa: add locking to the loop
We can add a PTHREAD_PRIO_INHERIT lock to the loop to protect the
callbacks and then use this to update shared data in an RT-safe way.

This can avoid some invoke calls that require a context switch but
also due to the nature of epoll cause locking in the kernel with non-RT
guarantees.

Because we use PRIO_INHERIT, the code executed in the lock must not use
any RT-unsafe functions.
2025-05-29 10:17:16 +02:00
Carlos Rafael Giani
d258892392 module-rtp: Retry starting stream if this failed with ENODEV errno
ENODEV is not a fatal error, and trying again later to set up the
socket usually succeeds. Do such retries with a timer.
2025-05-28 17:19:57 +02:00
Carlos Rafael Giani
71c0c8e34c module-rtp: Rename timer to standby timer in rtp source
This results in clearer code, and makes it easier to add more timers
to the module in the future.
2025-05-28 17:19:57 +02:00
Carlos Rafael Giani
023525eca2 rtp: aes67: Document sess.ts-direct property and set it to true for AES67 2025-05-28 17:19:57 +02:00
Carlos Rafael Giani
2fe77c47e1 spa: tools: spa-inspect: Output more detailed dlopen and dlsym errors
When writing a custom SPA plugin, it is very useful to get more detailed
errors related to libdl. One common error is that a symbol is not present
because a related library was not properly linked into the plugin. With
this change, the error will tell the user about the exact missing symbol.
2025-05-28 17:19:57 +02:00
Wim Taymans
d9b742cfda bluez: avoid some compiler warnings 2025-05-28 15:15:25 +02:00
Wim Taymans
a1be639894 filter-graph: add log feature to lv2 plugins 2025-05-28 15:02:53 +02:00
Wim Taymans
3f99c6f259 filter-graph: use new map/unmap URIs
Don't use the legacy ones.
2025-05-28 15:02:53 +02:00
Jonas Holmberg
51d9bdd9cb pod: declare offset as unused in spa_pod_builder_bytes_end()
Fixes compiler warning:

/usr/include/spa-0.2/spa/pod/builder.h:357:69: error: unused parameter 'offset'
[-Werror=unused-parameter]
2025-05-28 09:56:11 +02:00
Wim Taymans
e126f9bcbf adapter: only clear the NEED_CONFIGURE flag when mode != none
As long as we are in the 'none' PortConfig mode, we set the NEED_CONFIGURE
flag.

This fixes early start in audioadpter nodes because PortConfig is set to
none at init time and this used to clear the NEED_CONFIGURE flag, which
would start the node before the session manager could to a PortConfig
and cause a -22 error.
2025-05-27 15:38:51 +02:00
Wim Taymans
548fa0ec48 adapter:handle -ENOENT when enumerating buffers
When the follower has no buffer suggestion, it can return -ENOENT, which
should not generate an error but simply use the converter buffer
suggestion instead.
2025-05-27 15:00:43 +02:00
Wim Taymans
417a72365e adapter: negotiate from target to follower
Now that the filter functions prefer the filter default value, use the
target object as a filter for buffer allocation as well.
2025-05-27 09:30:52 +02:00
Wim Taymans
96007dc576 pw-cat: mode SYSEX mode out of ffmpeg define 2025-05-26 19:24:23 +02:00
Robert Mader
e81fb77322 gst: src: Change DEFAULT_MIN_BUFFERS back to 1
The change from 1 to 8 was done without justification in the commit
message and possibly for debug purposes. Unfortunately it breaks
negotiation with the libcamera virtual pipeline, which defaults to
4 buffers.

Set the the value to 1 again as successful negotiation - even with an
unusually low number of buffers - is usually more desirable than an
error.

Fixes: 98b7dc7c0 ("gst: don't do set_caps from the pipewire callback")
2025-05-25 04:03:06 +02:00
Wim Taymans
737ca4ee7b tools: add sysex play option in pw-cat
This makes it possible to upload raw midi (sysex) into the graph.
2025-05-23 16:52:22 +02:00
Wim Taymans
564c9b1ba5 Use "8 bit raw midi" for control ports again
There is no need to encode the potential format in the format.dsp of
control ports, this is just for legacy compatibility with JACK apps. The
actual format can be negotiated with the types field.

Fixes midi port visibility with apps compiled against 1.2, such as JACK
apps in flatpaks.
2025-05-23 16:46:13 +02:00
Wim Taymans
617f1b8a38 pod: add bytes start/append/end functions
Add functions to dynamically start and build a bytes pod.
2025-05-23 16:41:00 +02:00
Wim Taymans
d37f213236 docs: fix some typos 2025-05-23 16:40:20 +02:00
Wim Taymans
5e81ff8ede filter-chain: manage graph from source only
Only react to the capture stream state change and format changes. The
playback and capture streams change state somewhat concurrently and so
the graph state might not be consistent.

Because only the capture stream will trigger the playback stream and
start the processing, we can safely react to capture stream changes
only.
2025-05-21 15:23:00 +02:00
Wim Taymans
ccb7a51c3a filter-graph: add support for lv2 State
If the lv2 plugin supports State restore, use it to load state from the
config section in the lv2 plugin definition.
2025-05-21 15:19:23 +02:00
Wim Taymans
f7eab4172e client-node: let all events go to the node
Just pass all events to the node and only error out when they return an
error value.

Make sure we pass the result values of the command around.
2025-05-20 11:47:10 +02:00
Wim Taymans
12f8ca664b adapter: log command errors when no converter 2025-05-20 10:42:59 +02:00
Wim Taymans
7dc1d28b2c node: add User command and event
Add a User command and event id with a String property called 'extra' to
make it possible to send arbitrary User defined commands and events.
Also makes it possible to make User commands in pw-cli.

pw-cli c 86 User '{ extra="{ test: foo }" }'
2025-05-20 10:32:10 +02:00
Christian Glombek
5a54ecd8df daemon/pipewire.conf.avail: Add snippet enabling module-raop 2025-05-19 18:28:10 +02:00
Wim Taymans
b80189c3dd adapter: handle -ENOTSUP for commands
When using custom commands, the converter might return -ENOTSUP and
we should ignore this.
2025-05-19 17:23:30 +02:00
Wim Taymans
b9a8bb15a4 impl-link: fix feedback handling
If a link is a feedback link, we just need to swap the input/output
scheduling dependency.

Don't swap input/output nodes (without swapping ports) because then we
will be querying the wrong node/port pair when negotiating and cause
errors.

See #4706
2025-05-19 09:45:05 +02:00
Arun Raghavan
9ff1c93ab1 media-sink: Set up ASHA source after setting transport state
We need to make sure the state is available when the source starts, so
that it does not assert in flush_data()
2025-05-17 10:25:37 -04:00
Wim Taymans
e5afc939e8 libcemara: take care of index offset when enumerating controls
Add an index offset when enumerating controls. We insert 2 properties
before enumerating the controls so the index of the first control needs
to have an offset of 2.
2025-05-17 14:05:23 +02:00
Robert Mader
e387772dc2 v4l2: Re-enable first buffer skip for jpeg types
The workaround is typically needed with usb-cameras using jpeg streams.
Re-enabling the skip shouldn't affect what the commit was trying to do,
i.e. fix encoded streams like h264 etc.

Fixes: bcf0c0cf8 (v4l2: only skip buffer for raw formats)
2025-05-17 10:53:08 +00:00
Pauli Virtanen
1e18cded75 bluez5: iso-io: improve latency logic
If kernel socket queues for different streams get out of sync, it will
mess up time alignment of different streams. If that happens, flush to
resync.

If total latency becomes too large, flush queue.

Get accurate queue sizes from tx timestamping.
2025-05-17 10:51:37 +00:00
Pauli Virtanen
489e4b6bd2 bluez5: latency tracking also for A2DP, use it for unsent size
Use TX timestamping to figure out the accurate amount of unsent data,
including controller buffers.  SIOCOUTQ does not report accurate data
size as it includes overheads.
2025-05-17 10:51:37 +00:00