Commit graph

12396 commits

Author SHA1 Message Date
Barnabás Pőcze
8b35b00d82 meson.build: add -Werror=incompatible-pointer-types 2024-04-23 14:49:34 +02:00
Stefan Ursella
65e8bec8dd module-protocol-simple: handle 'node.name' property 2024-04-23 11:11:30 +00:00
Pauli Virtanen
29614a2c46 doc: fix workaround for old doxygen versions
Fix workaround for old doxygen versions, and put a version requirement
for Doxygen.
2024-04-23 10:59:24 +00:00
Wim Taymans
8633729a15 context: only use FNM_EXTMATCH when defined
alpine does not seen to have this.
2024-04-23 12:57:00 +02:00
Wim Taymans
2eb9a7543a thread: use pthread_setaffinity_np
The attribute version does not seem to be supported on alpine.
2024-04-23 12:12:33 +02:00
Wim Taymans
20b52d2082 keys: add and use some loop keys 2024-04-23 11:49:12 +02:00
Wim Taymans
0e13d088e7 module-ffado: only start after ports are configured
Don't start yet when the ports are pending configuration.

See #3968
2024-04-22 17:43:04 +02:00
Wim Taymans
64695a8611 stream: add functions to get the assigned data loop 2024-04-22 16:32:03 +02:00
Wim Taymans
c3d4abd7f1 modules: use acquire/release loop
Expose the acquire_loop/release_loop functions and use them in the
modules.

Make sure the nodes created from the module use the same data loop as
the module. We need to ensure this because otherwise, the nodes might
be scheduled on different data loops and the invoke or timer logic will
fail.
2024-04-22 16:19:02 +02:00
Wim Taymans
c12cf748b6 loop: move the loop name to pw_loop
That way, all loops have a name and we can move nodes to specific loops
even if they are not a data loop.
2024-04-22 15:18:26 +02:00
Wim Taymans
fbafaff31b context: reuse logic for pw_context_get_data_loop
Use the same logic for _get_data_loop() as _acquire_loop().
2024-04-22 11:16:53 +02:00
Wim Taymans
8459f6d25c data-loop: add functions to get name and class
This can be used to force nodes in the same class or data-loop.
2024-04-22 11:00:22 +02:00
Wim Taymans
4f352ca46b context: fill basic properties early
So that we can use them in match rules, such as the application.name
etc.
2024-04-22 10:48:23 +02:00
Wim Taymans
8dce124720 impl-port: only go through mixer for IO
Since we don't follow updates of the params on the mixer but only on the
port, we might get out of sync and fail to negotiate.

Going through the mixers for everything needs some more work.

Fixes #3971
2024-04-22 10:01:39 +02:00
Pauli Virtanen
ac95f796bf combine-stream: fix latency-compensate with resample.disabled=true
When resample.disabled=true, which is now the default, Format has zero
rate, so latency buffers get zero size. The rate in this case is the
graph rate.

Fix by just using the delay in samples, as all streams must in any case
run at same rate for the combining to work.

Fixes: bff252ce60 ("combine-stream: actually make use of resample.disable")
2024-04-19 18:39:52 +03:00
Wim Taymans
04bda2c28c spa: proxy tag and latency to peer of the mixer
We can probably do this better later but right now we do all of the tag
and latency handling bypassing the mixers.

Fixes #3970
2024-04-19 15:32:08 +02:00
Wim Taymans
a4bfdd7f82 context: add support for multiple data loops
Add config options to create and start multiple data loops, each with
their own priority and thread affinity if requested.

Make it possible to assign loop.classes to the data-loops. Use the
node.loop.class to find a data-loop for the node of the same class. Try
to evenly spread the nodes over the available matching loops.

With this, it is possible to separate the processing of the nodes
depending on the classes, like audio/video and improve concurency on
the server.

No attempt is done yet to move nodes between loops or to move
independent nodes to separate data loops.

Fixes #3969
2024-04-19 14:57:53 +02:00
Wim Taymans
e85bb7194b profiler: remove unused data-loop 2024-04-19 12:16:39 +02:00
Wim Taymans
a97a9b737c data-loop: support custom name and affinity 2024-04-18 17:46:22 +02:00
Wim Taymans
2d87310b60 thread: add support for thread affinity 2024-04-18 17:45:35 +02:00
Wim Taymans
696cd8977a context: remove redundant variable 2024-04-18 16:00:25 +02:00
Wim Taymans
e1e0a886d5 stream: improve async handling
We can remove most of the special async handling in adapter, filter and
stream because this is now handled in the core.

Add a node.data-loop property to assign the node to a named data-loop.

Assign the non-rt stream and filter to the main loop. This means that
the node fd will be added to the main-loop and will be woken up directly
without having to wake up the RT thread and invoke the process callback
in the main-loop first. Because non-RT implies async, we can do all of
this like we do our rt processing because the output will only be used
in the next cycle.
2024-04-18 15:20:07 +02:00
Wim Taymans
34be6c76a6 v4l2: fix printf format 2024-04-18 12:48:09 +02:00
Ashok Sidipotu
9062182985 spa: v4l2: encode device id into a json array 2024-04-18 14:02:55 +05:30
Ashok Sidipotu
4d3d15aebe spa: libcamera: encode device ids into a json array 2024-04-18 14:02:54 +05:30
Wim Taymans
68916e062b impl-node: implement async scheduling
When node.async is set, make the node async.

Advertize SPA_IO_AsyncBuffers on mixer ports when supported. Set a new
port flag when AsyncBuffer is supported on the port.

When making a link and if one of the nodes is async and the linked ports
support AsyncBuffer, make the link async and set this as a property on
the link. For async nodes we will use SPA_IO_AsyncBuffers on the mixer
ports.

Nodes that are async will not increment the peer required counters. This
ensures that the peer can start immediately before the async node is
ready.

On an async link, writers will write to the (cycle+1 & 1) async buffers
entry and readers will read from (cycle & 1). This makes the readers read
from the previously filled area.

We need to have two very controlled areas with specific rules for who
reads and who writes where because the two nodes will run concurrently
and no special synchronization is possible otherwise.

These async nodes can be paused and blocked without blocking or xrunning
the rest of graph. If the node didn't produce anything when the next
cycle starts, the graph will run with silence.

See #3509
2024-04-18 10:31:29 +02:00
Wim Taymans
e8ac4e6a34 spa: add SPA_IO_AsyncBuffers
This structure has 2 io_buffers. Readers and writers operate on different
io_buffers to implement an asynchronous transfer.
2024-04-17 16:18:04 +02:00
Wim Taymans
84ed9c0fe9 impl-port: query all params through the mixer
Go through the mixers of the port to get the params.

This makes it possible to let the mixer decide on formats, buffers and
io areas.

Currently, the format is the same on all mixer input and output ports
and the buffers are shared on the output port but the idea is to make it
possible to have different formats and buffers per link.
2024-04-17 16:18:04 +02:00
Wim Taymans
abb28e5255 impl-link: log error when activate fails 2024-04-17 16:18:04 +02:00
Wim Taymans
271f2d855d impl-port: implement port_enum_param on mixers
Implement the IO areas the default mixers support and proxy all other
queries to the peer port with the new node event.
2024-04-17 16:18:04 +02:00
Wim Taymans
67aafec8ab node: add an event to enumerate the peer port params
This can be used by nodes to filter or proxy the peer params.

Add test for new peer_enum_params event
2024-04-17 16:17:50 +02:00
Wim Taymans
af6638251d impl-port: set position io on the mixer nodes
When adding the node, set the current node position IO. We don't need to
set the IO_Buffers because we did that when we set the mixer on the port.
2024-04-17 13:17:51 +02:00
Wim Taymans
77ed5ccb31 spa: give meaning to port_enum_params with SPA_ID_INVALID port_id
This is to iterate params that are common to all ports, such as
EnumFormat or the supported IO areas. Mostly interesting for mixer and
splitter nodes so that we don't have to create a new port just to query
things.
2024-04-17 12:49:13 +02:00
Wim Taymans
bf273690fd impl-node: add cycle to debug
Emit rt_start after incrementing the cycle so that it can use the new
cycle value.
2024-04-17 11:24:56 +02:00
Wim Taymans
ec13e9148b impl-port: avoid doing work when the port is destroyed 2024-04-17 11:18:15 +02:00
Wim Taymans
f8831f84d5 impl-port: refactor check_params
Make a new function to iterate the port params and update the flags etc.
Make sure we clear the cache first and reset the flags. This makes it
possible to call check_params later again.
2024-04-17 11:12:22 +02:00
Wim Taymans
4d01fa34fa impl-port: use 0 size when clearing IO 2024-04-17 11:07:03 +02:00
Wim Taymans
40b8ff187b stream: log a warning when media.class and direction mismatch
Fixes #2493
2024-04-17 09:53:54 +02:00
Jonas Holmberg
09088b376f rtp_stream: Use the log topic of the module
Set log topic to the topic of the module linked with stream instead of
logging with "default" topic.
2024-04-17 07:13:53 +00:00
Wim Taymans
24478b9128 module-loopback: only enable delay with valid rate and channels
Or else we can't calculate the required delay buffer size and we might
even end up with a double free.

Fixes #3748
2024-04-16 11:16:00 +02:00
Wim Taymans
0e45836c36 properties: only count valid property updates
Log warnings when some property update failed. Only add valid property
updates to the total update count.
2024-04-16 11:05:39 +02:00
Jonas Holmberg
64d75b6b2e module-rtp-sink: Send all remaining packets when stopping
Don't close rtp_fd until all packets have been sent by the timer, if
the timer is running when the stream is stopped.
2024-04-16 07:50:33 +00:00
Barnabás Pőcze
4cea8eb01f pulse-server: use memcpy() to write string into message
The length of the string is already known, so use `memcpy()`
instead of `strcpy()` to copy the string into the message buffer.
2024-04-16 07:37:12 +00:00
Barnabás Pőcze
150211a3f8 pulse-server: message_dump(): fix format_info memory leak 2024-04-16 07:37:12 +00:00
Barnabás Pőcze
3fa92bbd15 pulse-server: ignore unsaveable values when deserializing property list
PulseAudio's property list can store arbitrary data, but
pw_properties can only store null-terminated strings.
So for the time being, ignore those values that don't
have null-terminators or have zero bytes inside.
2024-04-16 07:37:12 +00:00
Barnabás Pőcze
12bddf6521 pulse-server: stricter length checking when deserializing property list
The length of the value for each value in a property list is serialized
twice. Both the reference implementation and pipewire-pulse send
the same length, so be stricter and only accept a property list
if both lengths are the same.
2024-04-16 07:37:12 +00:00
Wim Taymans
2b11efdf3b alsa: fix race when updating the eventfd
The eventfd is read/written from/to the data thread and the main thread
concurrently with the update_active() function.

Use an atomic compare and swap to make this update atomic and avoid an
inconsistency between the active boolean and the eventfd. This could
result in the eventfd being unsignaled while the active flag was true
and the application receiving a timeout and XRun in its poll loop.

Fixes #3711
2024-04-16 09:30:23 +02:00
Wim Taymans
232f4f01e4 protocol-native: fail when security context init fails 2024-04-15 16:43:46 +02:00
Wim Taymans
6499b8572e tests: don't crash when security context is not available
Fixes #3952
2024-04-15 16:41:03 +02:00
Wim Taymans
b97c6e2eac audioconvert: also clamp monitor volume to min/max
When we set a min/max value, also clamp the monitor volume to it.

Fixes #3962
2024-04-15 16:28:24 +02:00