Commit graph

11575 commits

Author SHA1 Message Date
Samuel Thibault
c5ff3c8e3c utils.h: Include <errno.h> to get ENODATA 2023-09-24 15:11:52 +00:00
Pauli Virtanen
a9cc3f2813 bluez5: deprioritize audio-gateway if remote is HFP HF + A2DP sink
If remote supports both HFP HF and AG, both may get connected, which
occurs with Pipewire<->Pipewire connection.  In this case, Pipewire on
both sides may pick the audio-gateway profile.

To avoid both sides being audio-gateway, if remote is both A2DP sink and
HF, use lower priority for the audio-gateway profile.  Generally, BlueZ
won't connect both A2DP Source and Sink between same devices at the same
time, so we use that to determine which side should be the receiver.
2023-09-24 15:45:33 +03:00
Pauli Virtanen
5f7afe588c bluez5: backend-native: fix codec handling with simultaneous HF & AG
It may occur that we have RFCOMM connected as both HF and AG.  The codec
switching and support checks should in this case always use the remote
HF RFCOMM.

Fix by finding the RFCOMM with the correct profile, remote as HF.
2023-09-24 15:45:33 +03:00
Wim Taymans
099e2cf27a alsa: silence an error after resync 2023-09-22 11:23:51 +02:00
Wim Taymans
224f1f16f1 pulse-server: emit stream changed after Latency param change
Piggy back on the Latency param change to emit a stream changed event
because we now might have a link between the stream and a device.

We should really watch for new links and emit change events for the
streams that it links to.

Fixes #3522
2023-09-21 16:42:08 +02:00
Wim Taymans
8249fa3cbf node-driver: ensure position doesn't jump
Make sure that the position only advances in the running state.

When we are not following a clock we can simply increment the position
with the duration every time we run.

If we are following a clock. Take the elapsed time of the clock into
account when aligning to the position.

Fixes #3189
2023-09-21 09:52:53 +02:00
Arun Raghavan
e2f343e844 audiomixer: Correctly initialise data_loop
This got missed when it was added in commit
69d431acd4. Causes a crash when linking
passthrough ports.
2023-09-20 21:46:24 -04:00
Wim Taymans
cc0eb1ba0d context: handle force quantum like force_rate
Make sure we don't end looping when doing a reconfigure by using the
same logic as the force rate.
2023-09-20 16:58:12 +02:00
Wim Taymans
9bfe24d62f context: also reconfigure when quantum was forced
This makes the clock.force-quantum setting and node.force-quantum
suspend all drivers and resume them in the new quantum.

This is essential in order to change the quantum on an IRQ based
driver because it will otherwise refuse to change the graph quantum.
2023-09-20 15:46:41 +02:00
Wim Taymans
03840a2a9a alsa: fix recover logic
We can't call spa_alsa functions from the data thread. Iterate ourselves
over the linked devices that we all need to recover as a group.
2023-09-20 15:38:41 +02:00
Wim Taymans
a56ed47c5e alsa: set the driver rate in the clock io
Rename some variables to make it clear that we are dealing with the rate
and duration of the driver.
Set the driver rate in the clock instead of the target_rate, which we
might have rejected.
2023-09-20 11:32:34 +02:00
Wim Taymans
20db9e2d70 alsa: link driver and follower
When we are using the same clock (!matching) try to link the two PCM
devices together. This starts and stops the devices at the same time and
gives better latency.
2023-09-19 13:04:43 +02:00
Wim Taymans
4568d90565 jack: sync after setting metadata
Do a do_sync after setting the metadata to ensure the messages are
flushed to the server and processed. Fixes an issue where jack_property
would exit before the messages are flushed and so nothing happens.
2023-09-19 12:44:59 +02:00
Wim Taymans
ee1bb2362d alsa: sync followers from the driver
Keep track or the follower state and do the sync from the driver
wakeup.

This improves sync between devices because the sync no longer
depends on when the node was woken up in the graph and scheduled. We
would have been able to handle this difference by using the htimestamp
but that doesn't seen to work reliably on some hardware.

This is also essential for the interrupt based scheduling.
2023-09-18 14:53:15 +02:00
Wim Taymans
c51f6ccbd7 alsa: rework the state sync code
Make one function to sync the state with the realtime thread.
2023-09-18 14:46:56 +02:00
Wim Taymans
86f1d14b72 alsa: keep states in global list 2023-09-18 09:40:52 +02:00
Wim Taymans
c915f2a6fd modules: add quotes around hw:0
Because of the : it needs to be surrounded with quotes to be parsed
as a string.

Fixes #3515
2023-09-16 19:39:51 +02:00
Barnabás Pőcze
06ba425378 treewide: use spa_assert_not_reached() instead of assert(false) 2023-09-16 17:50:25 +02:00
Barnabás Pőcze
436787d6ba treewide: try to use const char * for string literals 2023-09-16 17:47:35 +02:00
Barnabás Pőcze
fc72208fa0 spa: alsa: mark spa_alsa_silence() static 2023-09-16 17:38:51 +02:00
Barnabás Pőcze
74419e27b4 spa: utils: cleanup: only have one version of spa_clear_ptr()
Depend on `spa_steal_ptr()` for checking if `ptr` is actually a pointer or not.
2023-09-16 17:21:54 +02:00
Barnabás Pőcze
ea159e7af0 spa: utils: cleanup: remove unnecessary cast
`spa_exchange()` already returns a value with the type of the first
input, so there is no need to cast again.
2023-09-16 17:21:08 +02:00
Barnabás Pőcze
3293e6a8ff pipewire: module-profiler: mark event vtable const 2023-09-16 17:15:32 +02:00
Barnabás Pőcze
7191ccb0b8 spa: utils: cleanup: fix GCC version check
GCC 10 seems to support dereferencing incomplete types in `__typeof__`.
2023-09-16 17:10:07 +02:00
Barnabás Pőcze
3fec887a5f spa: utils: spa_exchange(): try to evaluate argument only once 2023-09-16 17:06:01 +02:00
Wim Taymans
71808454e7 alsa: add and remove sources from data_loop
Add and remove timers and pollfd from the data-loop.
Rework setup_sources.
Start IRQ playback after adding pollfd to make sure we get all events.
2023-09-15 16:31:55 +02:00
Wim Taymans
c6f9cfa220 alsa: IRQ based scheduling wakes up after finishing 1 period
So we need to keep 2 periods of silence to keep 1 period of data inside
the ringbuffer when starting the graph.
2023-09-15 15:36:56 +02:00
Wim Taymans
eac74f6ece alsa: fix warning when compiling without FASTPATH 2023-09-15 15:35:52 +02:00
Wim Taymans
c8db951d61 alsa: some cleanups
Make sure we recycle an old buffer even if we don't have a new buffer to
push.
2023-09-15 13:05:31 +02:00
Wim Taymans
bf5b526464 alsa: small cleanups 2023-09-15 12:40:30 +02:00
Wim Taymans
c6745ed0d0 alsa: refactor read and write functions
Separate the sync logic from the read/write functions so that we can use
it in the wakeup logic as well.
2023-09-15 12:21:18 +02:00
Wim Taymans
cc1d980f0a audioconvert: silence some debug 2023-09-15 12:18:20 +02:00
Wim Taymans
bb10a7cb98 jack: setting the Latency to NULL clears the latency 2023-09-15 11:37:58 +02:00
Wim Taymans
27f6ef119f context: add some more debug
Also debug the currently configured graph target values.
2023-09-15 11:17:40 +02:00
Wim Taymans
e975cb16d3 alsa: add spa_alsa_prepare()
Split the spa_alsa_start() in a prepare and start function. Prepare
will then also reset state and prefill the playback buffer with silence.

This makes it possible to reuse the prepare function in recover().
2023-09-15 11:15:26 +02:00
Wim Taymans
a5d684af8a alsa: make sure we recalculate config when samplerate changes
The threshold depends on the samplerate and even when the graph rate or
quantum didn't change, the driver could be opened in a different
samplerate, which would cause the timeouts to be wrong and cause xruns.
2023-09-15 11:14:10 +02:00
Jan Alexander Steffens (heftig)
fa7cd96b6e pipewire-jack: Disable LD_LIBRARY_PATH when libjack is in libdir
This avoids prepending /usr/lib to the LD_LIBRARY_PATH, which supersedes
DT_RUNPATH and can cause library confusion.
2023-09-15 08:49:36 +00:00
Jan Alexander Steffens (heftig)
43db03909b ci: ShellCheck preprocessed scripts separately
Change the shellcheck job so that we configure the build and check the
preprocessed versions of the scripts, not the bare ones, which might not
be syntactically valid yet.
2023-09-15 08:49:36 +00:00
Wim Taymans
99cf172bc7 alsa: improve debug
Use a new state variable to store the device name and direction so that
we consistently can debug those.
2023-09-15 09:09:04 +02:00
Wim Taymans
3c5da11706 alsa: set_timeout is only called when tsched is enabled.
We don't need to do an extra check.
2023-09-14 17:16:44 +02:00
Wim Taymans
4ffa7860bc alsa: update the clock name when we can
Update the clock name as soon as we get a io_clock. This way we can use
it to compare the clock name against the driver right away.
2023-09-14 17:15:06 +02:00
Wim Taymans
354ee6fd96 alsa: with IRQ we can use avail_update()
It does not need an ioctl because the driver already updated the info
before waking us up from poll.
2023-09-14 16:16:48 +02:00
Wim Taymans
1f1c308c97 aec: support both webrtc versions
Version 1 does not seem to be packaged in many distros and so they would
need to revert the patch or disable AEC. Enabling both allows for things
to move forwards gracefully.
2023-09-14 15:35:40 +02:00
Wim Taymans
a4f3b78dff conf: enable jackdbus support by default
Become a JACK client as soon as jackdbus is started. This is probably
a good thing to do by default.
2023-09-14 13:24:51 +02:00
Wim Taymans
846e732458 pulse-server: remove pending_streams list
We can simply use the pending flag and merge the handling of the new
stream with the stream move logic.
2023-09-14 12:08:48 +02:00
Wim Taymans
35cca08d2b 0.3.80 2023-09-14 11:06:20 +02:00
Wim Taymans
13caae49b5 pulse-server: avoid emitting changes for unused params
Don't emit change events when latency or tag change, for example.
2023-09-14 11:03:39 +02:00
Pauli Virtanen
2804a8f1f6 bluez5: minor BAP broadcast fixups
Don't try to deref NULL if adapter not found. Disable bcast reconnect in
simpler way. Use adapter name as device name. Style fixes.
2023-09-13 15:51:50 +00:00
Pauli Virtanen
186b730c9c bluez5: fix device supported codec checks
Make supported codec checks to use profiles, not "is-a-sink" flag, to
determine which codecs can be used.

Fixes bluez5-device checking only source profiles, even when the local
device is only a sink.
2023-09-13 15:51:50 +00:00
Wim Taymans
6abc6e6693 jack: mark client active a little earlier
So that we get all the notifications queued and emitted when we complete
the activation.
2023-09-13 17:48:28 +02:00