Commit graph

13743 commits

Author SHA1 Message Date
Wim Taymans
a78e97a53b filter-chain: document ffmpeg plugin 2025-06-10 10:55:45 +02:00
Wim Taymans
8c68537446 filter-graph: clean up descriptor memory 2025-06-10 10:55:45 +02:00
Wim Taymans
41cafb4d2f filter-graph: add avfilter multichannel support
Use the port name extension to set the channel layout on the ports.

Add latency measurement and reporting.
2025-06-10 10:55:45 +02:00
Wim Taymans
2f51b9a5d9 filter-graph: add multiple in/out support for avfilter
Make one buffersrc for each input and configure it to mono. Try to guess
the channel position from the port name or use the config option and
fall back to FC (MONO) if unspecified.

Make one buffersink for each output and place a format converter in
front of it. Configure the converter to produce 1 channel with a layout
guessed from the port name or from the config.

With this we can use channelsplit and amerge to create multichannel
streams for avfilter plugins.
2025-06-10 10:55:45 +02:00
Wim Taymans
94116901ce filter-graph: add an ffmpeg plugin
Allows for using an ffmpeg filter-graph as a filter-graph node.
2025-06-10 10:55:45 +02:00
Wim Taymans
9b36e576cb alsa: handle NULL io
It is possible that the port io is set to NULL when the node is
negotiating or destroying.

Fixes #4734
2025-06-10 10:54:36 +02:00
Jonas Holmberg
930f2f3e2d gst: deviceprovider: take a ref to devices
When _probe() is called, take a ref to the newly created devices instead
if sinking the floating ref, since gst_clear_object() is called when
core is disconnected. Otherwise the devices will be freed before the
caller gets them.

Fixes the following assert in the caller:

g_object_is_floating: assertion 'G_IS_OBJECT (object)' failed

Or sometimes a segfault with the backtrace:

0  g_type_check_instance_is_fundamentally_a (type_instance=type_instance@entry=0x116c1b0, fundamental_type=fundamental_type@entry=80) at /usr/src/debug/glib-2.0/2.84.0/gobject/gtype.c:3918
1  0xb6d40cc6 in g_object_is_floating (_object=0x116c1b0) at /usr/src/debug/glib-2.0/2.84.0/gobject/gobject.c:3843
2  0xb6bc4c74 in gst_device_provider_get_devices (provider=0x109ba00) at /usr/src/debug/gstreamer1.0/1.24.12/gst/gstdeviceprovider.c:426
2025-06-09 16:50:18 +02:00
Wim Taymans
b51d3d7e8b filter-graph: ignore ports without descriptor
Ports without a descriptor are to be ignored. They also don't have
a node associated with them so don't try to get its latency.

Fixes #4700
2025-06-09 11:44:06 +02:00
Wim Taymans
4f3a2d723b filter-graph: add a pipe filter 2025-06-06 13:00:29 +02:00
Arun Raghavan
420c510d47 spa: loop: Fix potential uninitialised result 2025-06-06 12:50:56 +05:30
Wim Taymans
e43324a186 filter-graph: remove a memcpy and some cleanups
We don't need to memcpy if we swap between 2 buffers for overlap.

Remove a duplicate variable.
2025-06-05 11:35:32 +02:00
Wim Taymans
7ef8dc4dee filter-graph: a 64 tap hilbert function is a better default
1024 taps for the default hilbert functions seems excessive, use 64
instead.
2025-06-05 11:21:56 +02:00
Wim Taymans
efb1208b97 filter-graph: use spa_memcpy to make it instrumentable 2025-06-05 11:21:28 +02:00
Christian Glombek
113e22cb72 raop: don't set improper media.format 2025-06-03 19:39:43 +02:00
Christian Glombek
6e64d5da47 raop: set mtu to 1448 by default 2025-06-03 19:39:41 +02:00
Wim Taymans
457b1c2e1e filter-graph: run when both in and out != NULL
The check got reverted in 8ee51cd88f
2025-06-03 17:54:06 +02:00
Arun Raghavan
56c6e19f99 Revert "spa: loop: Change get_time() timeout to unsigned"
This reverts commit c515f9bf8e. The PW
APIs use int64_t (partly because SPA_NSEC_PER_SEC is an LL), and we
don't want to change already public API.
2025-06-03 15:20:15 +05:30
Arun Raghavan
c515f9bf8e spa: loop: Change get_time() timeout to unsigned
A signed value doesn't really make sense in this context, so let's keep
it unsigned so the semantics are clear. This does break the interface,
but should be okay since it's not in a release yet.
2025-06-03 09:39:30 +00:00
ValdikSS
187df01b5e bluez5: aac: disable Perceptual Noise Substitution for MPEG-2 profile
When the Bluetooth earphones claim to support AAC `MPEG-2 AAC LC` type only,
PipeWire encodes audio using MPEG-4 FDK-AAC profile which enables unsupported
Perceptual Noise Substitution (PNS) encoder feature.

Use AOT_MP2_AAC_LC pseudo-profile which is AOT_AAC_LC with PNS disabled.
2025-06-03 09:38:28 +00:00
Wim Taymans
38a3ebdca1 adapter: use the right default when filtering default
We should prefer the value of the follower when fixating to the
PortConfig format.

To make this actually work we need to be able to check if the value is
within the configured ranges. Implement the check for all types by
simply comparing the memory. This should then work also for checking
arrays, such as channel positions.
2025-06-03 11:35:59 +02:00
Wim Taymans
a5e63102d9 alsa: unlock pending drain in drop
When we set activated=false, signal the thread because it might be
waiting in drain.

See #4728
2025-06-02 19:14:45 +02:00
Wim Taymans
f65f5cf866 stream: make ticks continuous on DISCONT
A discont of the clock does not mean a discont in the stream, so keep
the ticks continuous.
2025-06-02 12:23:53 +02:00
Carlos Rafael Giani
abb55697c1 spa: Add SPA_IO_CLOCK_FLAG_DISCONT 2025-06-02 10:04:13 +00:00
Carlos Rafael Giani
5dd65dccf3 spa: Improve spa_io_clock flags documentation 2025-06-02 10:04:13 +00:00
Wim Taymans
13105a8e64 pulse-server: Implement record PA_STREAM_DONT_INHIBIT_AUTO_SUSPEND
Also implement the flag for record streams, where it is more usually
used, like in pavucontrol to disable starting a network source.
2025-06-02 11:48:01 +02:00
Arun Raghavan
60669920f0 pulse-server: Implement PA_STREAM_DONT_INHIBIT_AUTO_SUSPEND
We do this by setting the node as passive.

Fixes: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/4255
Fixes: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/4726
2025-06-02 14:38:22 +05:30
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