Commit graph

12752 commits

Author SHA1 Message Date
Wim Taymans
c57f2345f3 keys: add lazy scheduling flags and docs 2024-11-11 15:03:43 +01:00
Wim Taymans
d57e20b0e9 gst: take the thread lock before calling pw_stream functions 2024-11-08 13:10:40 +01:00
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
5759a88f27 v4l2: first probe and then update port flags
The probe is to decide it we can use EXPBUF or not and this is used to
decide on the flags.

This got broken with 842ac9e110
2024-11-07 11:20:32 +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
Wim Taymans
92c7c56e15 audioconvert: only output when there is something to output
Or else we get 0 sized output buffers.
2024-11-06 11:19:27 +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
Wim Taymans
00057d211f 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-11-06 10:58:31 +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
Wim Taymans
cdb3c64753 json: improve infinite checks
Avoid compiler errors like this:

/usr/include/spa-0.2/spa/utils/json.h:417:25: error: comparing floating-point with '==' or '!=' is unsafe [-Werror=float-equal]
|   417 |                 if (val == INFINITY)
|       |                         ^~
2024-11-06 10:52:05 +01:00
Arun Raghavan
41b5c50c86 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-11-06 10:49:51 +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
79eebcb724 1.2.6 2024-10-23 09:44:10 +02:00
Wim Taymans
b38ef63028 client-node: don't send mix_info to destroyed ports 2024-10-22 15:46:42 +02:00
Wim Taymans
96a73414d9 jack: improve error reporting
Report the function that failed.
2024-10-22 15:32:30 +02:00
Wim Taymans
2e9c1debdf jack: make stray debug warn to trace 2024-10-22 15:31:22 +02:00
Wim Taymans
9a5bbbee00 alsa: clean up followers and our driver link in _clear
When we are going to be freed, make sure we remove ourself from the
driver list and also remove all the followers that we might still have.

Fixes #4355
2024-10-22 10:17:30 +02:00
Pauli Virtanen
5e47838f24 bluez5: don't exit if system DBus goes down
Similarly as in spa_dbus, don't exit if bus goes down.  Neither the
audio or midi Bluetooth backend reconnects to DBus, but they shouldn't
exit the process.
2024-10-21 10:30:56 +02:00
Wim Taymans
868ac6f9df filter-chain: initialize NULL data for each node 2024-10-21 10:29:38 +02:00
Pauli Virtanen
fb54fb94cc bluez5: add quirk for Phonak hearing aids 2024-10-21 10:26:36 +02:00
Pauli Virtanen
abfec78c51 bluez5: fix crash with broadcast sinks 2024-10-21 10:26:25 +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
Pauli Virtanen
5e0899b29e doc: backport docs from master branch to 1.2
Pick commits

doc: drop the links to configuration wiki pages
doc: rename pipewire-devices.7 and move stream properties into it
doc: document some more device properties
doc: move configuration index to a separate page
doc: document node/device disabled property
doc: add some small docs updates
docs: document negotiation of explicit sync
doc: remove duplicated entries, link to wireplumber docs
2024-10-12 11:35:56 +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
c132a67c7d adapter: increase max-retry to 64
When the follower doesn't produce enough data for this many attempts,
bail and cause an xrun to avoid an infinite loop.

The limit of 8 cause real-life problems and should be larger. It should
probably depend on the expected size per cycle (node.latency) and the
current quantum but we don't always have this information.

See #4334
2024-10-07 18:36:03 +02:00
Wim Taymans
885f8ab517 jack: actually clear the mix io
When we are asked to clear the mix io areas, actually do it, otherwise
the process thread might still be accessing the old memory and crash.

Also check that we have set io on the port before we decrement the
counter with active io or else we have a negative value and cause
problems later. This can happen when we susupend and set io to NULL but
there was never any io set on the port.

Fixes #4337
2024-10-06 12:44:34 +02:00
Arun Raghavan
0cc6ac2769 acp: Trim trailing whitespace in monitor name from HDMI ELD
The ELD ends with a \n and spaces to pad the length, but most drivers
except NVidia trim that out while presenting to userspace. While this is
being tracked upstream [1], let's deal with this locally.

[1] https://github.com/NVIDIA/open-gpu-kernel-modules/pull/715

Fixes: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/4332
2024-10-06 12:44:20 +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
Barnabás Pőcze
0a631d61e6 acp: do not overwrite properties of PCM with that of the card
The properties of the card might overwrite those of the PCM.
For example, the cards's `alsa.id` will be set on the PCM too
since 37a51533e0 ("acp: add more properties for the card").

To avoid that, call `pa_alsa_init_proplist_card()` first
in `pa_alsa_init_proplist_pcm_info()` instead of last.

See #4135
2024-10-06 12:41:55 +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
546acfc006 spa: fix event pod type 2024-10-02 16:24:55 +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
71fac7fa81 1.2.5 2024-09-27 12:02:20 +02:00
Wim Taymans
59525b43e6 jack: take the right locks when modifying globals. 2024-09-27 11:50:07 +02:00
Wim Taymans
4d7f9c3208 jack: free ports and cached objects
Free the client ports when closing.

Move the per client cached objects to the global cache.

Free the per-client cached mix and ports.

Add a destructor that frees the cached global objects.
2024-09-27 11:50:02 +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
497c2b7bc5 jack: use the CPU max_alignment
Instead of aligning the buffers to 16 bytes, use the CPU max_align
value (32 on intel).

Move the mix function from a static global variable to a per client
member because this could change per client.
2024-09-27 09:49:18 +02:00
Wim Taymans
3ef6acdfb1 spa: avoid C23 empty initializers in the headers
Patch by Petar Popovic to avoid using empty initializers in headers.

Fixes #4317
2024-09-25 10:56:30 +02:00
Alper Nebi Yasak
351bc9ac3c acp: sync the mixer after selecting the port
Otherwise we might sync the wrong port and end up muted.

Fixes #4084
2024-09-25 10:18:33 +02:00
Wim Taymans
5bed12569d jack: Improve transport BBT handling
The bar can start from 0 in JACK.

Add bar_start_tick and ticks_per_beat to the io_segment_bar so that we
can losslesly store the complete jack BBT values.

See #4314
2024-09-25 10:18:15 +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
Wim Taymans
77649f560c docs: update pw-cli docs for do_link
Fixes #4272
2024-09-25 10:17:32 +02:00
Gleb Popov
7e789d05ec Fix test-functional compilation by including necessary header 2024-09-25 10:16:39 +02:00