Commit graph

3350 commits

Author SHA1 Message Date
Wim Taymans
dd78f3d5f7 alsa: disable htimestamp by default
It seems there are drivers that don't return a good values and we end up
with a lot of delay or automatic disable of htimestamp when the values
look too off.
2023-07-26 10:32:53 +02:00
Wim Taymans
ad1a36a718 audioconvert: add option to disable volume updates
Add channelmix.lock-volumes. When set to true it will disable volume
updates until set back to false.

See #3361
2023-07-25 12:36:23 +02:00
Wim Taymans
8eb1d8f2ac dbus: add some more debug 2023-07-20 10:15:30 +02:00
Wim Taymans
ab1436fb3b audioconvert: improve EMPTY flag on output buffers
Only set the EMPTY flag on output buffers if we don't have any
previously queued samples and the input is EMPTY.

Fixes #3365
2023-07-19 21:39:25 +02:00
Wim Taymans
f99fd7d75a improve some debug 2023-07-19 21:39:12 +02:00
Robert Mader
5bac089229 spa: libcamera: add libcamera version check for properties::SystemDevices 2023-07-19 09:21:03 +00:00
Ashok Sidipotu
6cd29aed05 spa: v4l2: get the device number of the v4l2 device
This value can be used in filtering the camera devices in consultation with
libcamera
2023-07-19 09:21:03 +00:00
Ashok Sidipotu
79518d13ae spa: libcamera: consume the device numbers libcamera property
Pass on the device numbers property of libcamera to session managers, with they
are better equipped to filter the camera/video devices across v4l2 and libcamera.
2023-07-19 09:21:03 +00:00
Barnabás Pőcze
146665893e spa: bluez: upower: keep track of pending call
Keep track of the DBusPendingCall and cancel it when being destroyed,
furthermore, create `update_battery_percentage()` and don't duplicate code.
2023-07-15 01:08:24 +02:00
Barnabás Pőcze
708e5443ae spa: bluez: add steal_reply_and_unref() helper
This function retrieves the reply from a DBusPendingCall and unrefs the call.
2023-07-15 01:04:23 +02:00
Barnabás Pőcze
183270f53c spa: bluez: add cancel_and_unref() dbus helper
This function cancels and unrefs a DBusPendingCall and
resets the pointer to NULL.
2023-07-15 01:04:22 +02:00
Barnabás Pőcze
1025d5c600 spa: bluez: remove some unused DBusErrors 2023-07-15 00:55:31 +02:00
Barnabás Pőcze
10f1b6c13c spa: bluez: backend-hsphfpd: use const char * for string literal 2023-07-14 22:35:36 +02:00
Barnabás Pőcze
667703e27d spa: bluez: backend-native: remove unnecessary array of DBusMessageIter 2023-07-14 22:35:35 +02:00
Barnabás Pőcze
66014e5828 spa: bluez: backend-native: fix DTMF string leak 2023-07-14 18:20:07 +02:00
Barnabás Pőcze
33a5c4ba10 spa: bluez: fix spelling of HAVE_REALLOCARRAY feature macro
It should have two `R`s not three.
2023-07-14 18:20:07 +02:00
Barnabás Pőcze
abe8c3581f spa: bluez: free spa_bt_transport::configuration
`spa_bt_transport_free()` did not free `spa_bt_transport::configuration`,
so fix that.
2023-07-13 21:27:53 +02:00
Wim Taymans
dc07c2321b spa: add spa_ratelimit 2023-07-11 19:25:35 +02:00
Barnabás Pőcze
fe45786a5d treewide: add some examples for the spa_auto* macros 2023-07-11 14:23:53 +02:00
Wim Taymans
baa5497617 spa: warn out of buffers
Running out of buffers is pretty bad and warrants a warning because it
can cause loss of audio.

See #3316
2023-07-07 12:11:02 +02:00
Wim Taymans
b5b01f4dd2 resample-peaks: improve peaks some more
Update the i_count in the loop because we use it to check when we have
completed a chunk.
2023-07-05 14:07:30 +02:00
Wim Taymans
48bf039e25 resample-peaks: fix peaks resampler
Avoid some segfaults in some cases.

fixes #3320
2023-07-05 13:46:08 +02:00
Wim Taymans
159fa7177a alsa: fix threshold sign
Be careful when converting the uint32_t to int64_t, first convert and
then flip the sign.
2023-07-05 12:01:08 +02:00
Wim Taymans
937a13d93f alsa: relax htimestamp threshold a little
Only assume an error when larger than 3 times the expected size. Clamp
to the threshold to not cause excessive delay compensation.
2023-07-05 11:46:19 +02:00
Wim Taymans
42a099381b v4l2: handle ENOTTY
Instead of erroring out, go to the next format when enumerating frame
size or frame interval.

See #3325
2023-07-04 11:36:37 +02:00
Barnabás Pőcze
8c17a6626d treewide: mark some functions static
These were found by enabling the "missing-declarations" warning.
2023-07-03 19:40:31 +02:00
Barnabás Pőcze
ab6ff1bcde spa: libcamera: use init list when calling generateConfiguration()
Pass an initializer list to `Camera::generateConfiguration()` instead
of constructing a vector and adding the single element "manually".
2023-07-03 19:40:31 +02:00
Barnabás Pőcze
6275269f09 spa: bluez: remove some unused variables 2023-07-03 19:40:31 +02:00
Barnabás Pőcze
f6ea5421e6 spa: bluez: do not open-code asprintf() 2023-07-03 19:40:31 +02:00
Barnabás Pőcze
605404c781 spa: bluez: device_stop_timer(): remove redundant decl
Also move the declaration of `media_codec_switch_free()`
up to the beginning of the file, near the other decls.
2023-07-03 19:40:31 +02:00
Barnabás Pőcze
0ed8880489 spa: bluez: modemmanager: do not use old style declaration 2023-07-03 19:40:31 +02:00
Barnabás Pőcze
abbdcf1854 spa: bluez: mark modemmanager stub functions static inline 2023-07-03 19:40:31 +02:00
Wim Taymans
927eb64177 alsa: use get_avail() recover logic
Always use get_avail() and then only fetch the hires timestamp when
enabled to enhance the delay reporting. This way we also recover from
errors from snd_pcm_avail() instead of ignoring them.

This should make the recover after mmap_begin obsolete but we'll leave
that just to be safe.
2023-07-03 17:08:08 +02:00
Pauli Virtanen
ff5f6d908b bluez: allow buffers with maxsize < duration*frame_size
Buffer sizes smaller than one cycle are possible, so don't assert that.
Instead, just provide as much samples as fits to the buffer.

If we are driver when this happens, emit a warning (once).  Similarly to
ALSA, as driver we produce only one buffer at cycle start, and no new
buffers in process. If the whole cycle doesn't fit into the buffer,
recording probably will be broken and we want some debug when there will
be a bug report about that.
2023-07-03 13:56:20 +00:00
Wim Taymans
c13696aca1 filter-chain: simplify biquads 2023-06-30 17:49:29 +02:00
Barnabás Pőcze
4a555ed6ff spa: bluez: backend-native: fix a memory leak
In `_transport_create()`, if `spa_bt_transport_create()` failed
then `pathfd` would be leaked.
2023-06-29 23:57:48 +02:00
Wim Taymans
2963e7fd4c alsa: disable htimestamp when it seems to error too much 2023-06-29 16:40:21 +02:00
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
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
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
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
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
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
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
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
b292e52740 audioadapter: renegotiate when EnumFormat changes
Start renegotiation when EnumFormat changes.
2023-06-21 16:29:45 +02:00
Dmitry Sharshakov
f257c3407d node-driver: allow specifying both PHC and ID 2023-06-20 06:51:30 +00:00
Wim Taymans
f2ba4caaf0 alsa: silence ctl probe errors
ALSA seems to emit some errors to stderr when the ctl can not be opened.
Silence those errors, we handle and log the result ourselves.
2023-06-19 17:20:57 +02:00