Commit graph

11055 commits

Author SHA1 Message Date
Wim Taymans f76191c792 alsa: add option to disable htimestamps
Add api.alsa.htimestamp to disable the use of hires timestamps.
2023-06-29 16:23:39 +02:00
Wim Taymans 3dab0091bb alsa: warn when the htimestamp seems wrong
The htimestamp should be close to the current_time, if it is further
away that the threshold, something is wrong.
2023-06-29 15:56:43 +02:00
Wim Taymans 98f138dbe0 filter-chain: move sofa and lv2 to external modules
dlopen lv2 and sofa plugin modules instead of hardcoding them into the+
filter-chain. This also makes it possible to add more plugin module
types externally.
2023-06-29 14:04:40 +02:00
Wim Taymans 5d177acc53 meson: clean up echo-cancel sources 2023-06-29 12:12:10 +02:00
Wim Taymans ab8e67e885 filter-chain: improve error reporting 2023-06-28 17:07:14 +02:00
Wim Taymans b065899859 filter-chain: only reset rate when suspended
Otherwire we can continue with the graph configuration if the rates
still match.
2023-06-28 16:52:11 +02:00
Wim Taymans f9efc63a04 pulse-server: make sure we have a card_name
Clients crash if the card name is NULL so make sure we generate
a backup name.
2023-06-28 16:18:44 +02:00
Wim Taymans bddfc8c46e filter-chain: support notify to control links as well
If we can't find data ports to link, try to find notify/control ports
when making a link.

When applying the link, place the output of the notify as the control
data.
2023-06-28 15:15:07 +02:00
Wim Taymans c671c46b87 module-loopback: recalc delay when starting
So that we can use the graph rate in case we are configured to follow
the graph rate.
2023-06-28 12:36:42 +02:00
Wim Taymans e3a41b2c49 filter-chain: instantiate graph when starting
Don't instantiate the graph when negotiated but when starting. This
allows us to get to the target graph rate in case the format rate is
supposed to follow the graph rate.

See #2969
2023-06-28 12:36:19 +02:00
Wim Taymans e03c3311eb filtet-chain: instatiate only once 2023-06-28 11:53:26 +02:00
Wim Taymans b160a72018 stream: don't emit process when disconnecting
As part of the disconnect, we will flush out pending process calls. Make
sure we don't emit them because they are quite pointless.

Fixes #3314
2023-06-27 15:08:24 +02:00
Wim Taymans 4b32b1fef0 modules: add example filter 2023-06-27 14:02:38 +02:00
Wim Taymans b32715ba41 alsa: try to recover when mmap_begin fails
In case the get_avail call did not catch the device error, handle the
error and try to recover in the mmap_begin call instead.

See #3315
2023-06-27 13:25:47 +02:00
Wim Taymans 39165a8471 modules: add ASYNC flag
Add ASYNC flags for the streams that don't dequeue/queue in the realtime
process function so that an extra buffer is allocated.
2023-06-27 13:11:13 +02:00
Wim Taymans 1466982c60 stream: add ASYNC flag
Add ASYNC flag that sets SPA_NODE_FLAG_ASYNC.

This ensure we allocate at least 2 buffers. We need 2 buffers at least
because we don't dequeue/queue a buffer in the process function when
async and we run out of buffers if we have only 1 buffer.
2023-06-27 13:11:13 +02:00
Guido Günther 88bb0bd7cc alsa: Allow to augment ucm port properties
Since UCM doesn't perform the path lookups of alsa-mixer all UCM devices
fall back to the card's properties for e.g. icons and hence usually show
the `audio-card` icon for all ports giving a confusing UI to users as
all ports show the same icon.

As ucm names are pretty standard augment some common port names with
icons.
2023-06-26 19:39:31 +00:00
Niklāvs Koļesņikovs e4cc63a6dc src/modules/meson: ensure Opus libs were actually found, too
The old way fails, if a distro has the header but not the library,
which can happen on at least Gentoo with multilib deployments,
where the shared header is present but non-native libraries might not.

This could still fail, if a distro had some but not all libraries for
some architectures but hopefully no one did that. In that case, a compile
test would likely be required via cc.check_header() instead but let's try
the faster fix first.

Reported-by: Sam James <sam@gentoo.org>
Thanks-to: Barnabás Pőcze <pobrn@protonmail.com>
Thanks-to: Xavier Claessens <xavier.claessens@collabora.com>
Signed-off-by: Niklāvs Koļesņikovs <89q1r14hd@relay.firefox.com>
2023-06-26 15:21:49 +00:00
Niklāvs Koļesņikovs 15ddbfd037 spa/plugins/bluez5/meson: removed some unneeded redefines
As far as I can tell, the code in question was not doing anything there
and was also breaking the new code elsewhere, so it was put on the
chopping block. Don't mind the squirming tentacles.

Signed-off-by: Niklāvs Koļesņikovs <89q1r14hd@relay.firefox.com>
2023-06-26 15:21:49 +00:00
Wim Taymans 4df753d0d7 context: avoid segfault when no fallback driver
In some cases, there might not be a fallback driver. Handle this without
segfaulting.
2023-06-26 16:11:33 +02:00
Dorinda Bassey 98ac13a03e cleanup unused variables
added cleanup of unused variables to resolve build warnings in pipewire-rs

Signed-off-by: Dorinda Bassey <dbassey@redhat.com>
2023-06-26 10:51:09 +00:00
Wim Taymans 0156d63109 audioconvert: don't negottiate rate when resample is disabled
This will leave the negotiated rate 0 when parsed and instructs the
stream to follow the graph rate.
2023-06-26 11:23:29 +02:00
Wim Taymans 4cc22d60d2 0.3.72 2023-06-26 09:42:21 +02:00
Carlos Rafael Giani d20fc2a8ec alsa-compress-offload-sink: Fix format renegotation
The have_format flag was not being properly processed, leading to
incorrect behavior when the format param was enumerated.
2023-06-24 16:54:15 +02:00
Arun Raghavan de2d7a583b alsa: Actually write out pitch elem value during initial reset
Without this, we were assuming our inital rate of 1.0 was also what was
applied to the feedback endpoint, but that was not actually true.
2023-06-23 16:45:36 +00:00
Wim Taymans 5a30d82d7e impl-port: avoid doing port calls when destroying
When we are destroying a port, don't try to clear io and format, the
port is already gone.
2023-06-23 15:05:39 +02:00
Wim Taymans 5578afa7de stream: don't call process when we have no buffers 2023-06-23 11:43:05 +02:00
Wim Taymans 0fb99d4421 impl-port: clear port Format when no mixers
Bring the state to CONFIGURE by actually setting the FORMAT to NULL when
we remove the last mixer. Otherwise the buffers and formats are still on
the port and we might try to use them while negotiating a new format
later.

Avoids some crashes.
2023-06-23 11:13:45 +02:00
Wim Taymans b464d2145d pulse-server: don't override initial volume/mute
When we are asked to apply the initial volume/mute, don't overwrite it
with the default volume.

Fixes #3306
2023-06-23 09:51:09 +02:00
Wim Taymans 20434e8669 module-jack: init latency correctly 2023-06-22 17:57:49 +02:00
Wim Taymans 34077187db impl-port: renegotiate format after a port was unused
Bring the port to the CONFIGURE state after all the mixer ports are
removed.

Fixes #3266
2023-06-22 15:37:09 +02:00
Wim Taymans 1ce94628ee client-node: rework mix_info
Use the port_set_mix_info to add and remove mix info information to the
client.

Previously it was impossible to clean up mix_info.

With this change we can also simplify the jack peer port detection.
Because the mix info is always sent before the link appears we can
simply look up the info when the link appears.
2023-06-22 11:59:39 +02:00
Wim Taymans a6ebcc62db jack: set peer_port to NULL in mix 2023-06-22 11:59:19 +02:00
Michael Olbrich e808875d60 alsa: improve audio output to multiple devices
There are currently several issues when multiple alsa devices are
involved.

For alsa devices that are followers, all data is written via
impl_node_process(). Currently spa_alsa_write() is only called if a new
buffer was queued.
It can happen that all buffers are in the ready list (queued by previous
calls but not yet written because there was no free space in the kernel
ring buffer). In this case writing stalls indefinitely.
To fix this, also call spa_alsa_write() if no new buffer is queued but
there are still buffers in the ready list.

If the ready list of the primary device is not empty then only this
device is handled because spa_alsa_write() is called directly. The other
devices make no progress during this interval.
The clock drift calculation works by comparing the alsa delay with the
expected delay since the last wakeup. This only work if the alsa
ringbuffer was filled completly. If the ready list contains a partial
buffer then the ringbuffer is not filled and the timing calculation
during the next wakeup is incorrect.

To fix all this, remove the special case for the non-empty ready list
and just call spa_node_call_ready() every time.
2023-06-22 09:28:44 +00:00
Wim Taymans ad5ac964af module: disable resample when following graph rate
When we don't set a rate, assume both input and output streams are
following the graph rate and so disable the resampler.

This mostly works around an issue where the input and output could
negotiate to different rates in some cases. With the resampler disabled
this would still result in the same amount of samples going in as
comming out instead of a stuttering mismatch.

See #2969
2023-06-22 11:18:04 +02:00
Wim Taymans 3db3e6dacf Revert "module-loopback: request renegotiation when suspended"
This reverts commit 2c5a3e9593.

Causes problems when switching devices because it doesn't renegotiate
properly.
2023-06-22 10:09:16 +02:00
Wim Taymans 774af1487a Revert "audioadapter: renegotiate when EnumFormat changes"
This reverts commit b292e52740.

It is probably not a good idea to renegotiate right away, we should at
least wait until the node is started again.
2023-06-22 10:01:02 +02:00
Wim Taymans 74b6ab4288 remote-node: remove IO_Buffers before releasing the mix
This is usually done by the link but because we are a remote node, we
manage the links ourselves.
2023-06-21 18:38:21 +02:00
Wim Taymans 2c5a3e9593 module-loopback: request renegotiation when suspended
When one side of the loopback suspends, do a EnumFormat params to force
renegotiation on the other side as well.

Suppose this:

1. sink/filter/pw-play plays at 48000Hz
2. pw-play goes away, sink and filter-sink suspend, filter-playback
   idles
3. pw-play starts with 44100Hz
4. sink/filter-sink renegotiate to 44100Hz, filter-playback is still
   at 48000Hz and pitch shifted.

We might want to manually suspend the IDLE nodes instead but for now
this is a good workaround.

Fixes #2969
2023-06-21 16:29:45 +02:00
Wim Taymans b292e52740 audioadapter: renegotiate when EnumFormat changes
Start renegotiation when EnumFormat changes.
2023-06-21 16:29:45 +02:00
Wim Taymans c4c6a3fd1b Revert "module-loopback: request renegotiation when suspended"
This reverts commit bbf8f1a0c8.

This causes all kinds of things to go wrong, mostly failure to
renegotiate buffers. Needs more testing.
2023-06-21 15:58:49 +02:00
Wim Taymans d24c8da5d2 stream: keep calling process when there is data
Don't only call the process function when we have a new buffer but also
when we still have something in the queue to process.
2023-06-21 15:34:16 +02:00
Wim Taymans 7a629fa378 impl-link: block some actions when destroyed
When we destroy a port, make sure we don't start to reactivate it
again.
2023-06-21 10:25:30 +02:00
Wim Taymans 1e4adff3fa impl-port: only add and remove the mix info once
Or we might crash.
2023-06-21 10:24:57 +02:00
Wim Taymans 265e6ca352 client-node: rename confusing id to mix_id
There is already an id in the port_mix structure that can be used to
index the mix structures in map if needed, the mix_id is the port_id of
the mixer and should not be confused.
2023-06-21 10:23:07 +02:00
Wim Taymans 85af2bdef2 jack: set peer_id correctly 2023-06-20 20:59:27 +02:00
Wim Taymans 44d2ba5276 impl-node: make node not-runnable when destroying
This avoid some links that are activated again when the node is
destroyed.
2023-06-20 20:46:20 +02:00
Wim Taymans fd358c511d context: a node is runnable only when active
Also check if the node is active to decide if the node is runnable.
2023-06-20 20:45:42 +02:00
Wim Taymans 001f0656d4 remote-node: refactor init/create/ensure mix
Make a create_mix function that also takes the peer_id.
2023-06-20 19:24:38 +02:00
Wim Taymans 6806af954e impl-port: improve debug
Debug the mix port id as well.
2023-06-20 19:00:23 +02:00