Commit graph

8408 commits

Author SHA1 Message Date
Wim Taymans
56c03c11f8 alsa: resync when quantum changes 2022-02-16 21:30:35 +01:00
Wim Taymans
798228a906 alsa: remove useless code
The resync check can be done in check_position_config.
2022-02-16 21:29:55 +01:00
Wim Taymans
4246961070 alsa: use rewind to remove excess delay
When the delay is too big, rewind a little to reduce it when resync.
2022-02-16 21:10:03 +01:00
George Kiagiadakis
5b9ec53bf8 gitlab-ci: rebuild fedora & coverity images to update coverity
coverity's latest version (2021.12) works fine with fedora's gcc,
so that should fix the failures we are currently observing
2022-02-16 18:13:01 +02:00
Wim Taymans
c5c9ecdd87 spa: improve the AEC interface
Place the methods on the interface so that we can call them.
Rename create to init because that is what it does.
Add support for listener and events so that we can signal property
changes later.
2022-02-16 16:18:18 +01:00
Joakim Olsson
9386c70b3a module-echo-cancel: Move backends to dynamic libaries
Move all backends to dynamic libaries loaded with spa_plugin_loader so
new backends not needs changes in pipewire or pipewire dependency to
external code

Change-Id: I702ce047598d0c318d6dc6ac8248062a5c12f643
2022-02-15 15:45:46 +00:00
Wim Taymans
761199be70 alsa: improve resync
Use the max error to do a resync. Don't reset the dll, there is no
reason for that.
Don't use _rewind, but instead limit the amount of samples we read and
write
Should keep more stable sync in most cases.
2022-02-15 16:32:00 +01:00
Wim Taymans
87f4726164 alsa: protect against impossible timeouts
Check if the new timeout is larger than 1sec in the past or future
and reprogram a timeout with a saner timeout.
2022-02-15 15:35:40 +01:00
Wim Taymans
8b899dbc55 alsa: make sure we always trigger a timeout
If we get an error from get_status() make sure program the timer
for one period or else we would just end up with silence.
2022-02-15 15:32:09 +01:00
Wim Taymans
dc76ab2291 alsa: don't use dll when not rate matching
Only use the DLL when we are driver or rate matching with
another driver.
2022-02-15 15:29:40 +01:00
Barnabás Pőcze
762a523098 pipewire: conf: initialize return value
In some cases it is possible for `pw_context_conf_section_for_each()`
to not set `res` at all, which leads to an indeterminate value being returned.

Fix that by setting `res` to 0 initially.
2022-02-15 10:06:26 +01:00
Pauli Virtanen
2e3c749a01 pulse-server/combine-sink: mark loaded after streams appear
module-combine-sink should become loaded only after its input stream,
and all explicitly specified output sink stream nodes appear.  Since
output sinks may appear on the manager after a delay, wait for them only
up to a timeout, and fail load after that.

Fail load if there are errors in input stream, or in an explicitly
specified output.

This is needed for Zoom sound sharing to work. Pulseaudio additionally
fails the module load if streams fail to connect, but we do not do that
here at the moment.
2022-02-15 06:28:54 +00:00
Pauli Virtanen
77e50d2dfe pulse-server: sync manager before module unload completion
Operations sync manager, so use that.

On Pulseaudio, module unload is async procedure. However, this race
condition may be hard to hit in practice, whereas on pipewire-pulse it's
not hard. E.g. Zoom appears to assume that modules are unloaded
synchronously.
2022-02-15 06:28:54 +00:00
Pauli Virtanen
e737e14e8b pulse-server: sync client manager before returning from LOAD_MODULE
Sync client's manager, before returning from module load, also for async
module loads.  This is because the module load may have its own core, so
even though it has made changes on server, the client manager might not
see them yet.

Fix this by syncing client->manager before operation return.
2022-02-15 06:28:54 +00:00
Anders Jonsson
8205bd811a po: Update Swedish translation 2022-02-14 23:02:39 +01:00
Pauli Virtanen
bae2cc0a6e spa/alsa-udev: ignore all errors in card busy check
If card busy check fails due to error, just log info message and
consider the card not busy.

For kernels with CONFIG_SND_PROCFS=n, /proc/asound is not present, and
we have to handle that.  It's also better to fail open here, rather than
end up with missing devices.
2022-02-14 20:50:53 +02:00
Wim Taymans
fa484f346e raop-sink: use default latency of 2 seconds
See #2131
2022-02-13 18:41:01 +01:00
Pauli Virtanen
01a83a1362 pulse-server: make some modules load-once
Add mechanism for allowing some modules to be loaded only once.

Mark always-sink, raop-discover, switch-on-connect, zeroconf-discover as
such.
2022-02-13 17:50:54 +02:00
Pauli Virtanen
f5d47c079e conf: fix fork/execvp/waitpid usage
In context.exec after forking, if execvp returns we have to exit since
we're in the child process.

To avoid zombies, either SIGCHLD need to be handled/ignored, or
double-fork to create orphan processes. This is in library code, so it
seems best to just double-fork.
2022-02-13 16:48:26 +02:00
Pauli Virtanen
0b40d36a14 pulse-server: load module-always-sink on startup
Load fallback sink on startup as a Pulseaudio module, so that it is
easier to disable when necessary.
2022-02-13 14:17:48 +02:00
Pauli Virtanen
04cff777af pulse-server: add module-always-sink
It just loads/unloads libpipewire-module-fallback-sink.
2022-02-13 13:45:17 +02:00
Pauli Virtanen
8e63aa3d10 pulse-server: fix some error checks in modules
These should check if the previous pw_manager_new failed.
2022-02-13 13:40:31 +02:00
Pauli Virtanen
02e6f9fbca module-fallback-sink: add dynamically appearing fallback sink
Add a module for a fallback dummy sink, which appears dynamically when
no other sinks are present.

Enable it for pipewire-pulse, because Pulseaudio will also show
dynamically a dummy sink.
2022-02-13 09:54:55 +00:00
Wim Taymans
a6035dc4c0 pulse-server: convert node id to index in sample reply
See #2129
2022-02-13 09:56:43 +01:00
Wim Taymans
0bca352241 alsa: fill with silence when underrun
Also try to resync when the follower buffer is running empty.
Fill the buffer with silence instead of doing _pcm_forward.
2022-02-12 12:09:25 +01:00
Wim Taymans
9855e2b303 alsa: tweak capture follower
If the follower does not have enough data to capture, skip a cycle
instead of trying to capture and get an XRUN.

Tweak some limits a little.
2022-02-11 18:07:44 +01:00
Wim Taymans
db6b7f6848 profiler: add force rate and quantum to latency
Overrite the node.latency with their forced values when available.

This will show the forced values in pw-top
2022-02-11 12:24:16 +01:00
Wim Taymans
d3f879e4ed jack: only set force-latency property
There is no point in setting a node.latency property when we also set a
force-quantum.
2022-02-11 12:22:02 +01:00
Barnabás Pőcze
2c71282f16 spa: bluez: remove unused function
The `add_dict` function has not been used since
9785d99821. Remove it.
2022-02-10 23:20:47 +01:00
Julian Bouzas
e34d9d209a alsa: try to resume after suspend before recovering
Fixes no audio after suspending with some audio drivers.

See #2001
2022-02-10 16:57:58 -05:00
Wim Taymans
f123b58f1f jack: release lock when doing do_sync from data thread
If we do_sync from the data thread, release the rt_lock so that any
callbacks that may happen while waiting can grab the rt_lock.

We could also temporarily disable the rt_lock grabbing before the
callbacks.

In any case the callbacks will need to be called while we execute
the blocking function in the process callback.
2022-02-10 17:13:48 +01:00
Wim Taymans
f636603844 alsa: pass current_time around in get_status()
Pass the current time around in various functions.
Make a higher precission htimestamp based get_delay() function. Seems to
work fine for playback but not for capturee.
2022-02-10 15:31:29 +01:00
Luis Correia
3cba294b65 Update texas-instruments-pcm2902.conf, add info about Behringer U-Phoria UM2 2022-02-09 20:58:20 +00:00
Wim Taymans
613c0a2558 proxy: emit a warning when listener was not removed
Emit a warning when the listener was not removed now that most places
are fixed. Not removing a listener might fail to call the removed
callback and leave things in a broken state.
2022-02-09 16:34:06 +01:00
Wim Taymans
e82f775fb3 tools: remove listeners 2022-02-09 16:30:13 +01:00
Wim Taymans
cd361cb1b3 client-node: remove MAX_MIX limit
There is no limit anymore
2022-02-09 16:12:17 +01:00
Wim Taymans
f1788d0552 filter: remove unused define for MAX_PORTS 2022-02-09 16:10:32 +01:00
Wim Taymans
4e1e9aa8e7 filter: remove port limit
Use a map to allocate and keep track of port numbers.
2022-02-09 16:04:57 +01:00
Wim Taymans
104f0c766a jack: remove some listeners 2022-02-09 15:52:14 +01:00
Wim Taymans
78a7370bc6 jack: remove some more limits
Remove limit on max results from _get_ports() and _get_all_connections()
by using a dynamic array.
Keep the limit on the max number of midi inputs we can mix.
2022-02-09 15:40:45 +01:00
Wim Taymans
4353fa83d6 pipewire-jack: there is no port max anymore 2022-02-09 15:21:49 +01:00
Wim Taymans
f743aecd23 map: scale extend with the item size as well 2022-02-09 15:17:37 +01:00
Wim Taymans
9bebad6ed3 client-node: remove limit on ports
Use a pw_map to keep track of the ports by index so that we don't
have an upper limit on the node ports anymore.
2022-02-09 15:11:47 +01:00
Wim Taymans
d0d924c33c client-node: improve port handling
Index the ports by using the direction and port id instead of doing
conditional lookups in 2 arrays.
2022-02-09 12:41:49 +01:00
Wim Taymans
3db14600b2 remove some listeners 2022-02-09 12:33:52 +01:00
Wim Taymans
50c5485efc proxy: don't remove the hooks, but report them leaking
When a client forgets to remove a hook, report them leaked in
the debug log. This is not a problem because we don't usually
add our own removed hook for proxies.

The problem is that we can't forcibly remove them with _clean()
from _destroy() because the hooks might be emitting the removed event
or the object listener. We could try to remove them in the final
unref but it seems some apps free their data before that and then
we unref invalid memory.
2022-02-09 12:22:14 +01:00
Wim Taymans
5fd427b86a client-node: remove preallocated mix entries
Just allocate the dynamically, which allows us to remove the limit.
2022-02-09 09:23:52 +01:00
Wim Taymans
a868122c40 client-node: don't remove mix twice
The mix is added to a list in pw_impl_port_init_mix() and removed
again in pw_impl_port_release_mix().
2022-02-09 09:21:46 +01:00
Wim Taymans
231cc88cad test: don't leak the two objects 2022-02-08 19:04:08 +01:00
Wim Taymans
fae7a1f592 jack: use node.lock-quantum by default
As soon as a JACK app is started, the automatic quantum change is
disabled. This means no pulse/alsa app can change the quantum.

The only way to change the quantum is with node.force-quantum or
with the settings metadata.

This means only a JACK buffersize change (usually controlled from the
JACK app, such as in ardour) or a metadata change (from the command
line) can modify things. Both of those are usually caused by a user
action.

For JACK apps where the quantum is allowed to change automatically,
explicit rules need to be placed in the config.
2022-02-08 18:35:12 +01:00