Commit graph

6625 commits

Author SHA1 Message Date
Wim Taymans
3a167d4be1 filter-chain: pass dict in plugin load function
So that we can pass some more properties around and remove the
quantum_limit hardcoded value.
2024-11-08 13:10:35 +01:00
George Kiagiadakis
270669be0d filter-chain: move dsp_ops pointers to dynamically allocated memory
Make a plugin structure that is dynamically allocated for each plugin
and pass it around to the descriptor instance structures, so that they
all have access to dsp_ops without sharing a static pointer.

The problem with the static pointer is that the dsp_ops structure is
actually allocated in module-filter-chain's instance structure,
so it always points to the instance of the last filter-chain that was
loaded in the process. When this is unloaded, the other filter-chains
crash.
2024-11-08 13:09:14 +01:00
Wim Taymans
af69f15dc2 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:26:40 +01:00
George Kiagiadakis
b0de2a9b7a pw-dot: fix information on the link labels 2024-11-06 11:02:24 +01:00
Niklas Carlsson
cbbc9a718e 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-11-06 10:59:14 +01:00
Pauli Virtanen
926d567c4c 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-11-06 10:58:47 +01:00
Pauli Virtanen
77f71f2b58 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-11-06 10:56:45 +01:00
Wim Taymans
9697b67802 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-11-06 10:55:46 +01:00
Ola Fornander
f40bfb587d 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-11-06 10:49:15 +01:00
Wim Taymans
b38ef63028 client-node: don't send mix_info to destroyed ports 2024-10-22 15:46:42 +02:00
Wim Taymans
868ac6f9df filter-chain: initialize NULL data for each node 2024-10-21 10:29:38 +02:00
Pauli Virtanen
c63ae35034 doc: in user-facing config examples, indicate which file it goes into
Add suggestions for config fragments in config file examples, as
applicable.

(cherry picked from commit ec5684302c)
2024-10-12 11:36:04 +03:00
Wim Taymans
9bf04c7c4c stream: improve the flush handling and docs
Flush with drain calls the drained callback for each cycle until paused
or resumed. Setting the stream to active again, clears the drained state
and makes things resume.

Flush without drain does not set the state to PAUSED but simply clears
the queued data. This is mostly useful when pausing or stopping.

At no point should the flush operation result in a PAUSED state change.
2024-10-07 18:36:11 +02:00
Wim Taymans
8cca14005b keys: improve comments and indentation 2024-10-06 12:43:46 +02:00
Wim Taymans
c95ed37d17 filter-chain: improve sofa plugin debug 2024-10-06 12:43:40 +02:00
Wim Taymans
e82a02bd89 filter-chain: accumulate node param changes
Don't just look at the last set parameter to decide if the node
parameters changed but or all results together.

Fixes #4331
2024-10-06 12:41:37 +02:00
Wim Taymans
800a25a01f impl-node: make exported nodes complete state change sync
Don't queue an async state change completion for exported nodes. The
server sends a ping to check for completion and we want this ping reply
to happen after the state completion.

Consider the case where we have a follower and a driver, the follower is
sent the Start/Ping commands and replies to the ping but is still
processing the state change async. The server can then Start the driver,
which will then try to schedule the (still starting) follower and fail.

We could add the ping to the work queue as well but that creates
complications because modules (clients) and server share the same work
queues right now and block each other completions.

We could also make a method to process the work queue immediately but
that would be dangerous as well because it could contain a BUSY item
from some module that would block things.
2024-10-01 10:55:19 +02:00
Wim Taymans
9f7c481742 stream: update state based on node
Follow the state of the node and update the stream state accordingly.

The most important part is that Start is async and so it's better to
wait for completion from the node before emiting the STREAMING state.

Don't wait for the completion of the Pause command of the node but send
it to the stream immediately. Delaying it might make it come after the
set_param calls are done and confuse the stream.
2024-09-30 10:12:33 +02:00
Wim Taymans
05b6ce8e76 module-rt: first join and then free memory
First join the thread and then free the memory or else we might free the
memory while the thread is starting up and we crash.
2024-09-27 09:50:02 +02:00
Wim Taymans
5566e2614b connection: fix fd leaks and confusion
When we receive a message with fds and we are at the end of the
buffer, we will call clear_buffer, which moves the next fds over the
fds of this message before we copy the fds into the message. This
results in the fd being leaked and the message using the fd of the next
message instead.

Avoid this by first copying the fds into the message and then move the
new ones over the old ones.

This fixes some wrong fds being used by clients.
2024-09-27 09:49:56 +02:00
Wim Taymans
b34a97017d impl-link: also handle unprepared active links
An ACTIVE link going to < PAUSED is unprepared.
2024-09-25 10:17:45 +02:00
Gleb Popov
bdbf3c563b Use if_indextoname() instead of less portable ioctl(SIOCGIFNAME) 2024-09-25 10:16:16 +02:00
Gleb Popov
49246d44e3 Move the ifr_ifindex FreeBSD definition into a header file to reduce code duplication 2024-09-25 10:16:08 +02:00
Gleb Popov
1a73424f13 Include <pthread_np.h> on FreeBSD to access pthread_setaffinity 2024-09-25 10:15:49 +02:00
Wim Taymans
2113425b8e modules: don't assume network addresses are numeric
There is no reason to disallow hostnames.

Fixes #4292
2024-09-25 10:08:41 +02:00
Wim Taymans
3937f03f04 impl-node: only process RequestProcess after state change
Wait until we are in the RUNNING state before sending
RequestProcess.
2024-09-20 09:39:55 +02:00
Robert Mader
a1418589a7 gst: Stop trying to use DMA_DRM with MOD_INVALID
GSTs DMA_DRM API does explicitely not support implicit modifiers and
trying to use it would result in assertions like
```
gst_video_dma_drm_fourcc_to_string: assertion 'modifier != DRM_FORMAT_MOD_INVALID' failed
```

Fixes: f1b75fc6f ("gst: Add support for DMA_DRM / explicit modifiers")
2024-09-17 12:07:24 +02:00
Wim Taymans
1e7aef5600 impl-node: only let the server send RequestProcess commands
When we emit the RequestProcess event from an exported node, don't
send the RequestProcess command to ourselves but let the server
decide where to send it to.
2024-09-17 12:07:09 +02:00
Arun Raghavan
eb7be3331f module-rtp-sap: Make sure we don't publish a null refclk
If the PTP refclk is not readable, we fallback to the stored ts_refclk,
which might be NULL. Make sure we check for this case.
2024-09-17 11:58:12 +02:00
Wim Taymans
0377a3797a global: avoid recursive destroy calls
Fixes #4250
2024-09-17 11:55:54 +02:00
Wim Taymans
16a7467815 tools: try to parse float values better
First try to parse the float value as a JSON number and then fall
back to atof to get the locale dependent variant.

This transparently makes things work with values such as 0.5 and 0,5.

Fixes #4234
2024-08-30 18:35:45 +02:00
Barnabás Pőcze
98c9d13973 impl-link: fix error message memory leak
`pw_link_info::error` was previously not cleared when a link was destroyed,
leading to a memory leak if an error message had been set. For example,
if format negotiation fails, and as a result the link is destroyed.
2024-08-21 11:50:48 +02:00
William Wedler
20529edf82 pw-top: Limit length of formatted shortname to resolve build error
Resolves:

"error: ‘%s’ directive output may be truncated writing likely 33 or more bytes into a region of size 10 [-Werror=format-truncation=]""
2024-08-21 11:50:48 +02:00
Wim Taymans
074ad04f16 impl-node: Do xrun check a bit better
Check if the node is FINISHED instead of checking the refcounts. It's
possible that the refcounts are 0 but the node was not scheduled or
finished yet.

If the node is not FINISHED but TRIGGERED, we can run the recover
without reporting an error.

Any other state is an error and we need to log this and recover.

See #4182
2024-08-21 11:50:44 +02:00
Wim Taymans
f1b6a62d8b impl-node: always INACTIVATE a node when stopping
Set the node state INACTIVE on the client and server side in all cases
when stopping to ensure nothing tries to schedule the node anymore.
2024-08-21 11:44:10 +02:00
Wim Taymans
1bd4d21142 impl-node: improve debug
Use ATOMIC_LOAD to get status.
Debug the pending state after decrementing so we debug the value we
are actually going to test.
Add node id to debug lines to better track things.
2024-08-21 11:43:53 +02:00
Wim Taymans
647237b955 impl-node: improve xrun debug
Debug the xrun state before we change things and run the recovery
process.
2024-08-21 11:43:14 +02:00
Wim Taymans
50e14194c0 impl-node: don't overwrite node state when finished
Don't just overwrite the state with FINISHED but only do this when the
state was AWAKE.

The server might already have started a new cycle and placed
NOT_TRIGGERED as the state. Or, it might have changed the state to
INACTIVE. In all cases, we should not overwrite the state unless it was
AWAKE and we should only trigger peers when we were AWAKE.

This fixes some spurious xruns and glitches.

See #4182
2024-08-21 11:43:04 +02:00
Wim Taymans
2f3276f6bb loop: don't usleep when queue is full
When the queue is full, before this patch we used to go into usleep in
the hope that the other thread will run and empty the queue and that we
can retry after the usleep.

This however does not always work because the other thread might be waiting
for the thread that does the invoke call and we lock forever.

Therefore we should always try to make progress in some way. Instead of
waiting, allocate an (or use the previously allocated) overflow queue and
write to that one. We can chain multiple overflow queues together as many
as we need (but we might want to bound that as well).

The loop.retry-timeout property is now deprecated.

See #4114
2024-08-06 17:50:58 +02:00
Wim Taymans
32956efbf7 spa-node: always set clock.quantum-limit property
Set the clock.quantum-limit property on the node also when it was
created without properties.

Fixes clock.quantum-limit on the Midi-Bridge.

See #4005
2024-08-06 17:50:19 +02:00
Wim Taymans
d5298eee2c module-ffado: implement freewheeling
When freewheeling starts, pause the streaming and resume when
freewheeling stops. Also make sure we don't try to do any IO or
timeouts.
2024-08-06 17:49:54 +02:00
Wim Taymans
d6d08997bb module-ffado: separate rt booleans from non-rt 2024-08-06 17:49:47 +02:00
Wim Taymans
bcd2062dcf conf: increase priority of dummy and freewheel driver
We have various modules that set the priority higher than the dummy and
freewheel driver (ffado, netjack,...). This makes it impossible to use
the freewheel driver on them.
2024-08-06 17:49:29 +02:00
Wim Taymans
dee3fd2037 modules: use the right module name in the docs
Fixes #4172
2024-08-01 12:35:06 +02:00
Wim Taymans
7ceca29970 pw-cli: support arbitrary large params and commands
Use a memstream to collect the arguments so that it can dynamically
allocate as much memory as necessary.

Use a dynamic pod builder to construct the pods so that they can be of
arbitrary size.

Fixes #4166
2024-08-01 12:34:41 +02:00
Wim Taymans
86287760a0 module-ffado: add some docs 2024-08-01 12:34:32 +02:00
Wim Taymans
afc0e6e69d module-ffado: keep the configured rate in sync with params
When we reconfigure rate, make sure we update the EnumFormat and Format
params with the new value.
2024-08-01 12:34:24 +02:00
Wim Taymans
270470987d module-ffado: Improve samplerate and periodsize handling
Only set use the graph rate and duration when the ffado.sample-rate
and ffado.period-size properties are set to 0. Othersize use the
configure values.

Without this patch, it would just ignore the settings and always use the
graph rate.
2024-08-01 12:34:16 +02:00
Wim Taymans
8d0c7c6e67 impl-node: include config.h to define HAVE_MALLOC_TRIM
It was previously not used..
2024-07-30 18:01:10 +02:00
Wim Taymans
7392e4df1b impl-node: reset pending state when moving driving node
Commit d04a28daef moved the configuration
of the IO_Position after we removed the node from the old driver but
forgot to move the code that updates the pending_state.

See #4094
2024-07-30 18:01:08 +02:00