Commit graph

1964 commits

Author SHA1 Message Date
Pauli Virtanen
a86ff85444 bluez5: tolerate devices sending incorrect AAC caps
There is a report (#1342) of a device setting multiple bits for AAC
object type in SetConfiguration, although this appears to be forbidden.

It's not completely clear if this was due to e.g. some BlueZ bug, but it
should be safe to be lax and try to guess what is wanted in such case,
instead of being strict, in case it was due to device bug.
2021-10-02 10:29:48 +00:00
Pauli Virtanen
3092e4a7be bluez5: implement validate_config for AAC
Allows bailing out earlier on invalid config, and setting transport
channel info.
2021-10-02 10:29:48 +00:00
Pauli Virtanen
58c7caf1bc bluez5: use log topics
Use log topics instead of prepending NAME: to log messages.
2021-10-02 12:46:02 +03:00
Wim Taymans
9a76feb913 libcamera: handle MemFd buffers
Use EXPBUF when requesting MemFd buffers because it is mostly correct
for v4l2.
2021-10-01 13:19:14 +02:00
Wim Taymans
487792941d libcamera: remove \n in log lines 2021-10-01 12:28:53 +02:00
Pauli Virtanen
d6509a243d bluez5: fix device.profile setting
Only keys with names starting with "bluez" are passed on to device
settings dict. Rename device.profile to match this.

Also add some debug.
2021-09-30 22:39:34 +03:00
Pauli Virtanen
e84f1c6eed bluez5: update bluez-hardware.conf
Closes #1592
2021-09-30 20:01:06 +03:00
Wim Taymans
d71a10b7fa libcamera: handle failure gracefully
Don't try to access NULL pointers
2021-09-30 12:54:29 +02:00
Wim Taymans
f8817b4394 cpu: fix compilation on ARM 2021-09-30 11:12:27 +02:00
Peter Hutterer
abd5f9fbe8 Remove remaining tabs from meson.build files
No changes, just tab-to-space replacement and a little bit of manual
twiddling.
2021-09-30 00:08:27 +00:00
Wim Taymans
013567524a support: res might be used uninitialized 2021-09-29 17:08:46 +02:00
Barnabás Pőcze
184e80d753 spa: support: use spa_list_consume()
Use `spa_list_consume()` when freeing entities in the pattern
list instead of `spa_list_for_each_safe()`.
2021-09-29 15:07:36 +00:00
Barnabás Pőcze
25a0e3beb4 spa: support: do not include C source file
Previously, `log-patterns.c` was included in two other source files
(`journal.c` and `logger.c`). It was also specified in the sources
list for the libspa-support library, which resulted in the unnecessary
independent compilation of the file, generating "defined but not used"
warnings.

Extract the function definitions into `log-patterns.h` and
use that in `journal.c` and `logger.c`, and remove the inclusion
of `log-patterns.c` from both.
2021-09-29 15:07:36 +00:00
Barnabás Pőcze
b292a71220 spa: support: use flexible array member
Use a flexible array member directly to store the pattern.
2021-09-29 15:07:36 +00:00
Wim Taymans
a9c64e1609 fix versions of the log interface 2021-09-29 17:03:26 +02:00
Wim Taymans
88d7ea3d88 spa-resample: add some verbose info messages 2021-09-29 10:16:25 +02:00
Wim Taymans
4d85e6aead resample: fix off-by-one
Don't use the previously skipped sample to calculate the remaining
amount of samples or else we remove one sample too much in some cases
and cause distortion, mostly when downsampling.

Fixes #1646
2021-09-28 15:31:07 +02:00
Peter Hutterer
b3646743c1 spa: sprinkle more log topics into spa 2021-09-28 09:35:39 +02:00
Peter Hutterer
e9d869b46f spa: implement a log topic for alsa 2021-09-28 09:35:39 +02:00
Peter Hutterer
59a5791d41 spa: implement the new topic logging for the provided loggers
Both simple log implementation now support the new topic-based
functions, and so does the journal logger too.
2021-09-28 09:35:38 +02:00
Peter Hutterer
9eda834417 spa: use the spa_log_logv macro to chain the log calls
No need to use the interface call directly here, let's just use the
macro.
2021-09-28 09:35:38 +02:00
George Kiagiadakis
becd76de58 bluez5: sco-sink: Add follower mode 2021-09-27 17:31:16 +00:00
Pauli Virtanen
dc7b88e1da bluez5: fix CVSD recording on Intel AX200
Intel 8087:0029 at Firmware revision 0.0 build 191 week 21 2021 on
kernel 5.13.19 produces CVSD data stream that consists of 96-byte data
packets interleaved with 96-byte zero packets.

This seems to not occur on other adapters, which usually produce only
48-byte data packets.
2021-09-26 17:58:06 +03:00
Pauli Virtanen
9e94aafaec bluez5: fix FastStream microphone support on some devices
Some devices require the source direction bit to be selected, in order
to send data.
2021-09-25 16:27:57 +00:00
Pauli Virtanen
65f881c222 bluez5: fix kernel version regexps
5.14.x kernels do support msbc-alt1, and should not be rejected.
2021-09-25 16:27:34 +00:00
Pauli Virtanen
0af3c85806 bluez5: don't probe native backend presence
Don't do a blocking probe of native backend presence, because it may
trigger DBus activation for Bluez.  If the DBus activation fails, it
ends up blocking until timeout.

ofono/hsphfpd usually don't have DBus activation configured, so they
fail instantly (which is why this problem was not encountered, even
though they do blocking calls on startup in previous pipewire versions
too).

Instead, select the backend once we have Bluez objects listed.
2021-09-25 16:24:10 +00:00
Wim Taymans
f1f5cbc0a6 support: return completion from process
HAVE_DATA|NEED_DATA signals that the graph can continue processing.
OK means that the node will continue asynchronously later. This
is needed to make the dummy driver work as a follower.
2021-09-23 16:36:32 +02:00
Wim Taymans
21616a25ad alsa: sync with pulseaudio
Fixes #1642
2021-09-23 15:02:08 +02:00
Pauli Virtanen
717004334b bluez5: backend-native: don't use libbluetooth hci commands
BlueZ 6 is planning to make most of libbluetooth private.  In
particular, the direct hci access is planned to be removed.  This is
currently used for determining adapter msbc support.

Instead of using libbluetooth API, try to determine msbc support by
a connect() attempt, which the kernel should reject when not supported.
2021-09-22 20:18:50 +03:00
Javier Martinez Canillas
310e6009ca
libcamera: fix a segfault caused by queueing no longer valid requests
The requests_ vector contains the requests created for a camera on start()
but the vector elements are not removed on camera stop(). This leads to a
segfault, when these requests that are no longer valid are queued again.

Also move the streamName_ map clear to LibCamera::stop() where it should
be, since its elements are added in the LibCamera::start() function.
2021-09-21 14:49:08 +02:00
Javier Martinez Canillas
439dc8eb2a
libcamera: disconnect camera in spa_libcamera_stream_off()
The camera is connected in the spa_libcamera_stream_on() function but the
disconnect happen in LibCamera::stop(). It makes more sense to have this
two operations separated as it's done for the connection and start, since
the camera then can be stopped/started without needing to do a reconnect.

Move the camera disconnect to spa_libcamera_stream_off() for the reason
mentioned above but also to make the code more consistent and symmetric.
2021-09-21 14:49:08 +02:00
Javier Martinez Canillas
ce9f75abaa
libcamera: free the FrameBufferAllocator buffers before deleting it
The libcamera application developer guide mentions that buffers allocated
by the FrameBufferAllocator must be explicitly freed before deleting it.
2021-09-21 14:49:08 +02:00
Javier Martinez Canillas
21c412dc49
libcamera: fix a use-after-free due an attempt to stop the camera twice
Camera is currently stopped and started in the spa_libcamera_set_format()
function, but this leads to a segfault due attempting to access a buffers
field of an already freed libcamera::FrameBufferAllocator instance.

The FrameBufferAllocator instance is freed in LibCamera::stop(), that is
called by spa_libcamera_stream_off() as handler of the node commands
SPA_NODE_COMMAND_Pause and SPA_NODE_COMMAND_Suspend.

Since the camera was already stopped, there's no need to attempt to stop
it again. In fact, the camera shouldn't be stopped/started at all in the
spa_libcamera_set_format() function but instead only as an action of the
SPA_NODE_COMMAND_{Pause,Suspend} and SPA_NODE_COMMAND_Start commands.

And same for the stop that's done in the LibCamera::close() function, it
shouldn't be needed because the camera is already stopped before closing.

Fixes #1513
2021-09-21 14:49:08 +02:00
Javier Martinez Canillas
a7a6f19815
libcamera: don't set camera configuration in LibCamera::start()
There is no need to set and validate the configuration when the camera
is started, since this was already made when the camera was opened.

The configuration only needs to be set again if the port format changes
due a SPA_PARAM_Format parameter.
2021-09-21 14:49:08 +02:00
Javier Martinez Canillas
2d69f775de
libcamera: add a libcamera_set_config() helper function to the wrapper
The libcamera wrapper provides a set of C functions that wraps libcamera's
C++ interface. But there isn't a function to call LibCamera::set_config().
2021-09-21 14:49:08 +02:00
Wim Taymans
7c11dcf808 alsa: enumerate all passthrough formats
Don't use the audio.channels and audio.rate settings influence the
passthrough formats.

See #93
2021-09-21 13:02:48 +02:00
Wim Taymans
0ec77ab09c dsd: show rate in bytes per seconds. 2021-09-21 12:25:42 +02:00
Wim Taymans
670efe2811 alsa: implement set_format for DSD formats 2021-09-21 10:50:45 +02:00
Wim Taymans
af6e887077 spa: add interleave DSD param
And make alsa report the interleaving.
2021-09-21 10:50:45 +02:00
Wim Taymans
25d39a5ea1 alsa: only expose DSD format when DSD_U32_BE is supported 2021-09-21 10:50:44 +02:00
Wim Taymans
1b5d02dd31 alsa: add enumeration of DSD formats 2021-09-21 10:50:44 +02:00
Wim Taymans
143f233be3 audioconvert: increase buffer size
64 channels with the new format support needs more space.

See #1620
2021-09-20 20:11:50 +02:00
Wim Taymans
92f35b99a0 alsa: don't mix process return and alsa err
Use a separate error field for the alsa errors, we already use the res
field for the process result.
2021-09-20 12:24:09 +02:00
Peter Hutterer
dfb40fb714 test: implement a test for the journal logger 2021-09-20 07:29:03 +00:00
Peter Hutterer
0cbd56f0cd spa: declare a dependency for each used library in meson.build
For SPA libraries that we link against elsewhere in the tree, declare a
declare a dependency "foo_dep" for that library that specifies how to
link to it. Then use that dependency in the various targets.

This removes the knowledge of how to link with the library from the
target which can treat it as just another dependency.

In the case of optional libraries (e.g. the journal support lib) we can
then use declare_dependency() to declare an empty dependencies and thus
link them unconditionally in the target.
2021-09-20 07:29:03 +00:00
Peter Hutterer
56193d474c spa/bluez: correct a library name variable in meson.build
Unused, so no functional change here
2021-09-20 07:29:03 +00:00
Peter Hutterer
ebda71d489 spa: fix the indentation in the various meson.build files
Was all over the place using tabs and spaces, let's make this more
consistent.
2021-09-20 07:29:03 +00:00
Pauli Virtanen
def45adaec bluez5: fix behavior on HSP/HFP backends with no codec switching
Fix HSP/HFP profile not showing correctly when using hsphfpd/ofono
backends, which don't support codec switching and have no HFP codec
profiles.
2021-09-19 17:41:19 +00:00
Pauli Virtanen
90b4efd98d bluez5: cleanup hfp/hsp backend handling + config file option
It seems not uncommon that people have not properly configured ofono
running, which results to loss of HFP/HSP functionality. It's less
surprising if the backend selection is fixed in the configuration file,
and (by default) does not depend on running services.

Add a configuration file option for selecting HFP/HSP backend, and set
the default value to the native backend. Emit warnings if conflicting
backend services are detected to be running.

Also cleanup hfp/hsp backend handling a bit, now that it's mostly
abstracted behind an interface.
2021-09-19 17:33:32 +00:00
Pauli Virtanen
cae1554449 bluez5: move bluez-hardware.conf loading to the plugin
It's not really the responsibility of the session manager to load the
bluez5 device quirks, and it's easier for eg. Wireplumber if it doesn't
need to do it.

Move loading bluez-hardware.conf to be the responsibility of the bluez5
spa plugin, similarly as the alsa plugin deals with the ACP database.

Put the configuration to share/spa-0.2/bluez5, mirroring the plugin
directory structure in lib/spa-0.2/bluez5.
2021-09-19 17:28:17 +00:00