Commit graph

13195 commits

Author SHA1 Message Date
Wim Taymans
f7e97ab157 examples: update the examples with new lazy scheduling flags
The src can listen to RequestProcess commands and so gets the
node.supports-request = 1 property.

The play-pull example can both be a driver that listens to
RequestProcess or a lazy driver so set this in properties as well.
We can now remove the priority.driver property because automatic
priority selection will make us a driver or not.

With this change, video-src to video-play-pull will use lazy scheduling
with play-pull as the driver. video-play-pull to v4l2src will use
normal scheduling and video-src to video-play will also use normal
scheduling.
2024-11-06 12:57:48 +01:00
Wim Taymans
7abf11210d stream: expose the lazy flag with pw_stream_is_lazy()
Together with the is_driver() status, this can be used to check if the
stream is using lazy scheduling or not.
2024-11-06 12:57:48 +01:00
Wim Taymans
f16f074725 context: set lazy scheduling flags in clock
Collect the request scheduling flags and when there is a lazy driver,
set the lazy scheduling flag in its clock. This means that the driver
can expect RequestProcess commands to start the scheduling.

Pass the lazy scheduling clock flag to the node.

Make sure lazy scheduling driver have a higher priority than their
request drivers.
2024-11-06 12:57:48 +01:00
Wim Taymans
9c49bffc22 keys: add lazy scheduling flags and docs 2024-11-06 12:57:48 +01:00
Wim Taymans
ae0dd9195a modules: add ratelimit to xrun warnings in jack-tunnel
Take the current cycle times early and in all cases. We can use this to
get the current frame time for debugging purposes instead of the more
heavy jack_frame_time().

Rate limit the xrun warnings.
2024-11-06 12:29:21 +01:00
Wim Taymans
68877dcee7 audioconvert: only output when there is something to output
Or else we get 0 sized output buffers.
2024-11-06 09:28:09 +01:00
Robert Mader
2ab11d0f6c filter-chain: Fix build error without FFTW
And some style changes while on it.

Fixes: c67232718 ("filter-chain: move fft mem function to dsp_ops")
2024-11-05 18:25:21 +01:00
Wim Taymans
c672327181 filter-chain: move fft mem function to dsp_ops
So that we can have different versions per FFT.

One possible optimization would be to split the complex number in
separate real and imag arrays. This would speed up the multiply
operations.
2024-11-05 16:12:28 +01:00
Wim Taymans
79baeb8d18 modules: handle stream trigger errors
When we get a process callback from the capture stream but we can't
trigger the playback stream, simply consume the buffers from the capture
stream.

This can happen when the playback stream is not ready yet, for example.
If we don't consume the buffers that are ready, the converter might run
out of buffers and complain.
2024-11-05 15:59:01 +01:00
Wim Taymans
bc57b9ec86 impl-node: return a result from pw_impl_node_trigger()
Return 0 when the peer was not triggered, 1 when it was triggered and
an error when there was an error.
2024-11-05 15:53:12 +01:00
George Kiagiadakis
f12d37a421 pw-dot: fix information on the link labels 2024-11-05 12:09:43 +02:00
Wim Taymans
c0fcc9b83f videoconvert: add more ffmpeg format mappings 2024-11-05 10:40:14 +01:00
Pauli Virtanen
1b5c244ee0 bluez5: clean up route/profile building
Clean up route/profile building a bit so that it is easier to add new
device profiles.

Use names instead of magic numbers for the routes.

Fix marking BAP set input route unavailable by error due to magic number
off by one.
2024-11-04 21:54:29 +02:00
Pauli Virtanen
8504e58120 bluez5: reduce quirks logspam
There's no need to log quirks every time they are used, it's enough to
log them once when a device connects.
2024-11-04 21:41:24 +02:00
George Kiagiadakis
726234c82f audioconvert: always push out data when the out_offset reaches max_out
No matter if the input data (n_samples) is > 0, the code here should
flush out existing data if the output buffer is full
2024-11-04 20:36:12 +02:00
Elliot Chen
d5e2a0df6c libcamera: update buffers datas information according to plane info 2024-11-04 17:00:18 +00:00
Andika Triwidada
359b70e2ba Update Indonesian translation 2024-11-04 16:59:03 +00:00
Niklas Carlsson
08af555e90 filter-chain: use Q value for biquad shelving filters
The current implementation uses the slope variable S to define the
filter slope. Setting S = 1 results in a constant Q value of
sqrt(2)/2, or 0.7071, which is a good default value.

However, calculating alpha from the Q value instead, as done in
RBJ's cookbook [1], the filter shape can be changed which might
be desired for certain applications and provides flexibility.

Since the current implementation always defaulted to using S = 1,
make sure that configurations missing Q uses the same slope value.

[1] = https://www.w3.org/TR/audio-eq-cookbook/
2024-11-04 16:54:55 +00:00
Christian K
74fed1d208 Update German translation - from https://l10n.gnome.org/vertimus/PipeWire/master/po/de/ 2024-11-04 16:52:34 +00:00
Pauli Virtanen
0d80a13771 modules: support config overrides for access & protocol-native
These modules are loaded in default config, but to configure sockets and
their permissions, the args need to be overridden.
2024-11-04 16:50:30 +00:00
Pauli Virtanen
5e8a7f434b doc: suggest fragment file name in example configs 2024-11-04 16:50:30 +00:00
Wim Taymans
9c19284f7f support: make the loop queue handling lockfree
Don't use TSS to store per-thread queues but keep a lockfree stack of
queues. We can then pick off a queue and write to that one and place it
back after use.

We need to keep the queues indexed by id in the stack because otherwise
we would need to compare-and-swap 128 bits (pointer + tag), which is
more problematic.

Because we keep the queues in an array and no queue is ever removed and
the array can only grow, we can quite easily just iterate the array
without a lock. Without the lock we also fix one of the potential
problems with ardour where the queue_flush thread is canceled while
flushing and the queue_mutex remains locked.

Because we end up with all queues in the array now, we can overflow the
fixed max amount of queues we can manage. When that happens, sleep for a
while and try again. This is a case where more than QUEUES_MAX (128) threads
are invoking at the same time and is rather unlikely.

There is also the queue overflow case which we now also must handle with
a retry. This potentially uses more eventfds but again this should be
unlikely and cause no further problems.

See #4356
2024-11-04 17:41:14 +01:00
Wim Taymans
9ed57c1dba impl-node: improve property parsing
Use pw_properties_get_uint32() and friends to parse properties and have
a fallback when the property is not there.
2024-11-04 16:52:09 +01:00
Niklas Carlsson
18148e7add filter-chain: fix unmap indexing for LV2 plugins
The index returned to the LV2 plugin starts from 1, but the array
index starts from 0.
2024-10-31 13:07:04 +01:00
Pauli Virtanen
c9acdd2f1f bluez5: backend-native: update HFP SDP records
Advertise SWB since we implement it.  Update HFP version to 1.9
accordingly.
2024-10-31 08:18:45 +00:00
Pauli Virtanen
8d019c5689 pulse-server: more specific error message when too many connections
This appears to be encountered often enough so a clearer message is
maybe useful.
2024-10-30 19:55:39 +02:00
Elliot
d67882fa10 libcamera: allocate memory according to the number of discontiguous memory 2024-10-30 15:20:21 +00:00
Wim Taymans
fb2b314660 audioconvert: interchange the resampler loops
Iterate the channels in the inner loop instead of the outer loop. This
makes it handle with 0 channels better but also does the more
complicated phase increment code only once for all channels. Also the
filters might stay in the cache for each channel now.
2024-10-30 13:31:24 +01:00
Wim Taymans
3f41b93aa5 filter-chain: fix cmuladd
We need to add the result to src and store in dst. Also use the right
len in C fallback.
2024-10-29 11:55:03 +01:00
Iulia Tanasescu
b2a70f5933 bluez5: Add support for Broadcast links
This adds support for BAP Broadcast transport links.

Unlike unicast, broadcast links are used by a BAP Broadcast Sink
device to link together multiple transports in the same BIG that
the user wants to start receiving audio from. Each transport is
associated with a different BIS, so each one has a different fd.
Thus, each link needs to be acquired and released separately.
2024-10-28 17:57:44 +00:00
Pauli Virtanen
7f885a2e94 proxy: invalidate proxy id when removed from map
Client-side bugs calling methods on destroyed proxies like

    pw_proxy_ref(p);
    pw_proxy_destroy(p);
    ...
    wait for server to ack the remove
    ...
    pw_core_destroy(p->core, p); /* p already removed & destroyed */

should not send messages with the stale proxy id to server.

Set id to SPA_ID_INVALID when removing a proxy from the id map, so that
such client bugs only result to ENOENT.
2024-10-24 13:46:09 +00:00
Wim Taymans
24e1603f81 filter-chain: improve debug
So that it matches the instantiate debug line.
2024-10-24 11:04:15 +02:00
Wim Taymans
66942e5654 filter-chain: add example upmix filter
Add an example filter of PSD upmixing, using filters, convolver and
delay to simulate the upmixing logic in audioconvert.
2024-10-24 10:57:54 +02:00
Wim Taymans
42b994204d filter-chain: first create instances and then link port
First make instances of all the plugins and then try to link them up.

Otherwise, depending on the order the plugins are defined in the config,
a link will try to create port data and set it on the instance, which is
still NULL and we crash.
2024-10-24 10:55:50 +02:00
Wim Taymans
7be69f38d8 filter-chain: keep port data per instance
We can't share the memory between ports of different instances...
2024-10-24 10:47:32 +02:00
Jonas Holmberg
6223715918 module-rtp: Fix rtp timestamps
Because of operator precedence the timestamps where set to 0 if
set_timestamp was 0.
2024-10-23 16:12:55 +02:00
Wim Taymans
7906dc854a json: improve infinite checks
Avoid compiler errors like this:

 /usr/include/spa-0.2/spa/utils/json-core.h:417:25: error: comparing floating-point with '==' or '!=' is unsafe [-Werror=float-equal]
|   417 |                 if (val == INFINITY)
|       |                         ^~
2024-10-23 15:37:07 +02:00
Arun Raghavan
c3e5371053 meson: Use correct git head for wireplumber subprojects
Without this, `meson subprojects update` does not work.
2024-10-23 08:37:51 -04:00
Arun Raghavan
f0b81a4628 spa: audiotestsrc: Validate loop and system before using them
Makes sure we don't crash if those are not available (like with
DataSystem under spa-inspect).

Fixes: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/4365
2024-10-23 08:25:30 -04:00
Wim Taymans
2c132be626 audioconvert: align some buffers
so that we can use aligned read and writes in SSE.
2024-10-23 12:54:23 +02:00
Wim Taymans
662bf68122 audioconvert: handle odd writes in delay
Add some padding to the delay buffer. If we wrap around, copy the
spilled samples to the front of the buffer. This makes it possible to
use the more optimized sse delay function in more cases.
2024-10-23 12:34:04 +02:00
Wim Taymans
3309e0b244 audioconvert: don't unroll when unaligned write pointer
We require the write pointer to be a multiple of 4 for our unrolled SSE
loop to work, so enforce this to avoid segfaults.
2024-10-23 11:40:34 +02:00
Wim Taymans
da86026b7a latency: handle negative latency correctly
In our current world, it is possible to have a negative delay. This
means that the stream should be delayed to sync with other streams.

The pulse-server sets negative delay and the Latency message can hold
those negative values so make sure we handle them in the helper
functions as well.

Do the delay calculations in pw_stream and JACK with signed values to
correctly handle negative values. Clamp JACK latency range to 0 because
negative latency is not supported in JACK.

We should also probably make sure we never end up with negative
latency, mostly in ALSA when we set a Latency offset, but that is
another detail.
2024-10-23 10:47:58 +02:00
Wim Taymans
9243ed0cbd pulse-server: add condition support in pulse.cmd
So that a config override can disable the execution of the command by
setting the property to false in the pulse.properties config override.

Expose some conf.c method for this purpose.
2024-10-23 09:08:50 +02:00
Ola Fornander
12c8cdf69b gst: deviceprovider: fix memory leak in do_add_nodes
Use `g_autoptr()` to free the new_devices GList that is allocated in
do_add_nodes.
2024-10-22 21:53:57 +00:00
Wim Taymans
ec972d4fdf modules: support overriding default module arguments
Add support for some modules to use a module.$NAME.args config section
to override the arguments of the module. Update the docs.

Add more conditions to the module loading, use !false to also load the
module when the condition is not set and so that we don't have to
explicitly set each condition to true.

Improve module-profiler example config.
2024-10-22 18:04:42 +02:00
Wim Taymans
4cf4bd210f client-node: don't send mix_info to destroyed ports 2024-10-22 15:55:47 +02:00
Wim Taymans
82b9f76b0d impl-node: lower the xrun debug level
Make the xrun reporting as info. This can generate a lot of logging if
the error is persistent and the errors are also reported in pw-top etc.

Fixes #4361
2024-10-22 09:59:15 +02:00
Wim Taymans
0dfd6d997f protocol-pulse: implement readiness notification
Write a newline to the fd in the PIPEWIRE_PULSE_NOTIFICATION_FD env
variable when set.

This is to implement readiness notification as suggested in
https://skarnet.org/software/s6/notifywhenup.html

Fixes #4347
2024-10-22 09:50:27 +02:00
Wim Taymans
7af43d87b3 protocol-native: write socket address after adding
Only write the socket address after we managed to add the fd to the main
loop.

Only log a warning when this fails.
2024-10-22 09:33:40 +02:00