Commit graph

2429 commits

Author SHA1 Message Date
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 1c3802bd82 spa: add SPA_ABS helper macro 2021-09-21 12:16:11 +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 43b27002eb tools: add beginnings of DSD player 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 c0d3349849 spa: add DSD format definitions 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
Wim Taymans d04244abb9 audioconvert: add softMute to PropInfo
So that it can be introspected.

Fixes #1613
2021-09-15 20:57:10 +02:00
Georges Basile Stavracas Neto eca2bbb892 v4l2: Pass camera controls and formats in the node itself
Instead of using the Port to do that. This is what audio nodes
do.
2021-09-15 10:25:33 -03:00
Wim Taymans 19a3bf2100 spa: handle last_port correctly
last_port is always 1 more than the highest valid port number.
2021-09-14 21:06:21 +02:00
Wim Taymans d793086174 alsa-seq: fix port delete
We need to first mark the removed port as invalid, and then look for the
last valid port in the port array otherwise last_port becomes 0 and
midi dataflow stops.

Fixes #1601
2021-09-14 18:08:30 +02:00
Wim Taymans 349324b9a6 alsa: pass AES bits to S/PDIF devices
This is the right thing to do and might even fix output to some
devices.
2021-09-14 12:42:03 +02:00
Julian Bouzas 767ac79328 audiomixer: support multiple channels when mixing with AVX, SSE and SSE2 2021-09-10 07:35:55 +00:00
Julian Bouzas 7d0a8b68e8 audiomixer: add support for U8, U16, U24, U32, S24_32 and U24_32 formats 2021-09-08 14:24:31 -04:00
Julian Bouzas 20e64b39da fmtconvert: add support for U16, U24, U32 and U24_32 formats 2021-09-08 14:24:26 -04:00
Wim Taymans 0cf6760ee0 resample: limit the amount of taps
So that we don't allocate too much space but also don't cause an
overflow in the indexes.
2021-09-08 16:28:24 +02:00
Barnabás Pőcze f288a2b77d libcamera: fix compilation error
Upstream libcamera commit 32635054bc76e2ababd8ea2177fca1f88229541a
changed "planes" on `FrameMetadata` to be a function. Adapt
the plugin code accordingly.
2021-09-08 07:32:48 +00:00
Peter Hutterer e55a5441b8 spa: silence two -Wformat-nonliteral warnings
In one we can duplicate the spa_asprintf call without real drawbacks.

The second one can be split up without losing details. Note that there
is another one in backend-native.c where splitting it up will make the
code harder to understand. The warning for that one remains.
2021-09-07 08:26:54 +10:00
Peter Hutterer 6a18272fed spa: mark the gettext wrappers with __attribute__((format_arg))
This removes the -Wformat-literal warnings for all _("some message")
calls. Remaining warnings are those where we pass in a custom buffer.
2021-09-07 08:26:10 +10:00
Pauli Virtanen b5ad37c7ac bluez5: make codec loading compatible with old conf files
Change codec factory names to api.codec.bluez5.*, so that they won't
conflict with old config file lib name rules for api.bluez5.*

Specify the fallback library name when loading the codecs, so that it
works without the rules in config files.
2021-09-06 18:04:35 +03:00
Wim Taymans 435de99428 Increase pod buffer size
The props of a 64 channel node are at least 2048 bytes long so make sure
we can build and filter them.

Fixes #1574
2021-09-06 15:09:28 +02:00
Wim Taymans f9d8bdb9b8 spa: improve param result handling
Check if we actually managed to add the param to the builder before we
try to deref it.
Use a safer deref that checks the sizes of the pod and builder.
2021-09-06 15:09:25 +02:00
Wim Taymans c54f64cd13 alsa: clean up rate matching code
Remove some useless fields.
Use macros for time<->rate conversions.
2021-09-06 12:55:06 +02:00
Pauli Virtanen 18dde01d87 bluez5: minor error handling etc. fixups 2021-09-05 06:26:58 +00:00
Wim Taymans 44f10330e8 alsa: remove AES0 settings
Remove this for now, we should only add this when actually sending
encoded formats.

Fixes #1570
2021-09-05 08:21:07 +02:00
Pauli Virtanen 59d572de09 bluez5: split A2DP codecs to separate SPA plugins
Make easier to package A2DP codecs separately, by splitting each to a
separate SPA plugin.  Adjust the code to not use a global variable for
the codec list.

The A2DP SPA interface API is in the bluez5 private headers, and not
exposed in installed SPA headers, as it's too close to the
implementation.
2021-09-03 20:40:30 +03:00
Pauli Virtanen 987282b376 spa/support: add plugin loader interface
Add a SPA interface for loading SPA plugins, so that plugins can request
the host to load other plugins.
2021-09-03 20:12:28 +03:00
Wim Taymans 034dd00813 alsa-seq: use better clock rate matching
Match the elapsed queue time against the elapsed graph time.
2021-09-02 18:37:27 +02:00
Wim Taymans c2c7dd040a alsa: CLAMP the error just in case something goes wrong.
The calculation of the elapsed time is actually not a good idea because
it becomes larger and larger and a tiny change in the rate could result
in a large difference that would make things fail quickly.

Until that is fixed, this patch will need to do..
2021-09-02 17:31:02 +02:00
Wim Taymans e5886b7bc6 alsa: pass POD_Long as (long) varargs 2021-09-02 15:17:36 +02:00
Wim Taymans 99e6c77525 alsa: improve device name construction
Get the ucm prefix only once, when we open the UCM card and then
use it for all devices using the card.

Construct the device name right before we open it with the ucm prefix
and possibly the AES flags instead of messing with the property.
2021-09-02 12:35:58 +02:00
Wim Taymans 80628f38e7 alsa: move codec config to acp-device
Just like the latency, move the codecs to the device Route param.
This way, it is easier for the session manager to save and restore
the codecs as part of the Route settings.
2021-09-02 10:27:59 +02:00
Julian Bouzas c65ae2f2e6 audiomixer: refactor and add support for more formats
The audiomixer processing logic is now based on mixer-dsp.
2021-09-01 17:35:43 -04:00
Julian Bouzas dddbe289fb audiomixer: add support for more formats in the mix table
The S8, S16, S24 and S32 formats are now supported. The mixing process also
takes into account the number of channels.
2021-09-01 17:08:36 -04:00
Wim Taymans 93e9efc1e4 audioconvert: handle NULL param 2021-09-01 13:23:00 +02:00
Wim Taymans 6c3c88f9d3 audioconvert: handle follower EnumFormat changes as well 2021-09-01 13:22:57 +02:00