Commit graph

9469 commits

Author SHA1 Message Date
Barnabás Pőcze 0f6c5a04c7 spa: libcamera: fix CameraManager event handling
libcamera's CameraManager runs the event handlers on its own thread,
thus synchronization is needed to ensure correct functionality.
Implement that by collecting hotplug events into a mutex protected queue
and signalling the main loop where they can be processed and the
"object_info" event can be safely emitted.
2022-09-15 11:17:47 +00:00
Barnabás Pőcze f9796fc024 spa: libcamera: remove unnecessary typedef 2022-09-15 11:17:47 +00:00
Barnabás Pőcze 02f2d6b48d spa: libcamera: remove unnecessary have_config member
An extra flag is not needed because the `config` pointer can be
checked to determine if a configuration has already been retrieved.
2022-09-15 11:17:47 +00:00
Barnabás Pőcze 9374c15c3d spa: libcamera: use std::optional intead of separate bool flag + value
`std::optional` conveniently encapsulates a value and a bool flag,
so use that instead of manually replicating it.
2022-09-15 11:17:47 +00:00
Barnabás Pőcze 13357fec20 spa: libcamera: manage libcamera::CameraManager via a shared_ptr
Using a shared_ptr removes the need for manually calling
`libcamera_manager_release()` to drop the reference as it is done
automatically whenever the shared_ptr is destroyed or reset.
2022-09-15 11:17:47 +00:00
Barnabás Pőcze 330686d3aa spa: libcamera: rework construction/destruction of libcamera source impl
Move some things into constructors and try not to depend on the
fact that the storage is zero initialized, try to initialize
everything properly.
2022-09-15 11:17:47 +00:00
Barnabás Pőcze 98193f7d67 spa: libcamera: remove two unused members from libcamera source
Neither `next_fmt`, nor `next_size` were actually used, remove them.
2022-09-15 11:17:47 +00:00
Barnabás Pőcze 222368e562 spa: libcamera: properly construct/destruct libcamera manager impl
Previously, the libcamera manager `impl` object was neither properly
constructed neither properly destructed. As a consequence, for example,
the shared pointers in the `devices` array weren't properly destructed,
although this has been somewhat mitigated by a previous change
that modifed `clear_devices()`.
2022-09-15 11:17:47 +00:00
Barnabás Pőcze cc229d4b05 spa: libcamera: properly construct/deconstruct libcamera device impl
Previously, the "impl" object was never properly constructed or
destructed, but it more or less worked out since the memory was initialized
to zero bytes and each member had trivial constructors. Except std::shared_ptr,
but an all zero storage happened to be equivalent to a default constructed
shared_ptr.

However, there was the still the problem that the shared_ptr was never
destructed, so it kept the referenced `Camera` object alive, which lead
to memory leaks.

An additional, somewhat unrelated change is that the "props" struct
is removed, and the device identifier is now stored in an `std::string`.
The reason is that `CameraManager::get()` already takes a const std::string reference,
so an std::string must be constructed in any case, so we might as well
take advantage of that and use `std::string` in the "impl" object as well.

Furthermore, wrap the `impl` struct in an anonymous namespace
to avoid name resolution problems.
2022-09-15 11:17:47 +00:00
Barnabás Pőcze f699fa698e spa: libcamera: remove main loop from manager
The libcamera manager does not actually use the event loop
that it acquires during initialization. Remove it.
2022-09-15 11:17:47 +00:00
Barnabás Pőcze 13208220d8 spa: libcamera: print camera id when it appears/disappears 2022-09-15 11:17:47 +00:00
Barnabás Pőcze 086de7dcac spa: libcamera: properly dispose of shared_ptr
Previously, in `remove_device()`, the last device would be copied into
the slot of the to-be-remove device. The problem with this is that it
left the shared_ptr untouched in the previously last slot, and hence
creating an extra reference. Fix this by moving instead of copying.

A similar problem is present in `clear_devices()` which also
did not properly dispose of the shared_ptrs. Fix that by
calling `reset()` on each device's camera pointer.
2022-09-15 11:17:47 +00:00
Barnabás Pőcze 442a0c54ea spa: libcamera: move shared_ptr to avoid copy 2022-09-15 11:17:47 +00:00
Barnabás Pőcze ba04a0f936 spa: libcamera: take raw pointer to avoid shared_ptr copy 2022-09-15 11:17:47 +00:00
Barnabás Pőcze 9370fbee3d spa: libcamera: indent with tabs instead of spaces 2022-09-15 11:17:47 +00:00
Frédéric Danis fdccc10bc7 bluez5: Use SelectProperties Endpoint property to detect device role
BlueZ adds the Endpoint property to the Properties dictionary of
SelectProperties.
This allows to know which remote Endpoint is an acceptor, and so which
local transport should be used as an initiator.
2022-09-15 11:17:20 +00:00
Frédéric Danis d4b639419a bluez5: Init BAP LC3 coder/decoder depending on direction
For LE Audio, sink and source have their own media transport endpoint.
Media sink or source only needs the coder or decoder respectively.
2022-09-15 11:17:20 +00:00
Frédéric Danis 28b4fbecfb bluez5: Manage BAP linked transports
Multiple transport from the same device may share the same stream (CIS)
and group (CIG) but for different direction, e.g. a speaker and a
microphone. In this case they are linked.
In this case:
- On acquire, if another transport has already been acquired, the new
  transport should not call Acquire or TryAcquire but re-use values from
  the previously acquired transport,
- on release, the closing of transport fd and call to Release should be
  done only for the last transport.
2022-09-15 11:17:20 +00:00
Frédéric Danis 81f70aa1ec bluez5: Allow media source connection for BAP 2022-09-15 11:17:20 +00:00
Frédéric Danis cd50188787 bluez5: Fix node creation depending on device role
We can't determine which remote endpoint or device the
SelectConfiguration() call is associated with. For LE Audio BAP, as this
method is called only for the Initiator we set the whole instance as a
Central/Initiator.
This flag is unset on BAP media endpoint removal.
2022-09-15 11:17:20 +00:00
Frédéric Danis e0c79959fc bluez5: Add stereo support to LE Audio LC3 codec 2022-09-15 11:17:20 +00:00
Frédéric Danis fd1b331353 bluez5: Fix sink timeout for BAP
Data should be written to the ISO Stream fd every 10ms or 7.5ms depending
on the configuration selected.
2022-09-15 11:17:20 +00:00
Frédéric Danis 071730ecab bluez5: Use delay from QoS for BAP 2022-09-15 11:17:20 +00:00
Frédéric Danis 39ef812ed5 bluez5: Complete BAP audio location mapping 2022-09-15 11:17:20 +00:00
Frédéric Danis f428b13d06 bluez5: Set BAP QoS depending on selected configuration
This move the QoS setup to be codec specific and fills it depending on the
selected codec configuration.
2022-09-15 11:17:20 +00:00
Frédéric Danis 284da66deb bluez5: Add BAP_SINK/SOURCE from PACS UUID to adapter profiles
BAP sink/source are characteristics of the PACS profile, but we're more
interested by those characteristics then the more generic profile.
2022-09-15 11:17:20 +00:00
Frédéric Danis 496dda1bcc bluez5: Check if BlueZ daemon support LE Audio
Legacy BlueZ 5 API doesn't support to register BAP codecs, which prevents
to register A2DP enhanced codecs.
2022-09-15 11:17:20 +00:00
Frédéric Danis b7ad1d1869 bluez5: Add SelectProperties DBus method support 2022-09-15 11:17:20 +00:00
Frédéric Danis 96acc5a79a bluez5: Add LE Audio BAP support to bluez5-device 2022-09-15 11:17:20 +00:00
Frédéric Danis 201fd7755d bluez5: Add LC3 codec support to LE Audio BAP
By default this codec is disabled as the BlueZ support for LE Audio is
still experimental.
2022-09-15 11:17:20 +00:00
Frédéric Danis fd0bcb1699 bluez5: Add LE Audio BAP support to media-codecs 2022-09-15 11:17:20 +00:00
Frédéric Danis 00d51c3d31 bluez5: Rename codec API from *a2dp* to *media*
The BlueZ Media1 interface will not only be used for A2DP but also for
LE Audio and code related can be shared.
2022-09-15 11:17:20 +00:00
Wim Taymans 64a3edf89e 0.3.58 2022-09-14 17:02:17 +02:00
Wim Taymans 565bb2c493 resample: fix peaks sse code
Fix the shuffle arguments.
Use another way of making 0x80000000 and use andnot to remove the
sign bit.
2022-09-14 16:58:41 +02:00
Wim Taymans 3ad1a5d4dc alsa: rework eventfd handling
Make one function that updates the eventfd based on the state of
the plugin.

Do this check before getting the desciptors. The functional difference
is that the eventfd could become blocking now as well when getting the
descriptors. This fixes a problem where the poll would wake up without
any work to do.

See #1697
2022-09-13 17:20:02 +02:00
Wim Taymans 4b16eee27a module-raop-sink: add more docs 2022-09-13 12:10:48 +02:00
Dmitry Sharshakov 3b89e6f369 alsa-seq: add an option to disable longname in MIDI ports
Untested yet

Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>
2022-09-13 07:46:40 +00:00
Dmitry Sharshakov ea646c2d98 alsa-seq: set card long name or number in port names
Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>
2022-09-13 07:46:40 +00:00
Wim Taymans 5e890925a0 module-echo-cancel: don't load newer modules
Add some version comments for the new AEC methods
2022-09-13 09:44:36 +02:00
Jonas Holmberg 70471989e5 module-echo-cancel: Add activate/deactivate methods
Add methods activate() that is called before first call to run() when
stream starts and deactivate() that is called after last call to run()
when stream stops. This makes it possible for aec-plugins to reset their
state between streams.
2022-09-12 18:24:07 +00:00
Wim Taymans 0862e8c2ef alsa: add more debug
Debug the hw and sw params to the debug log
2022-09-12 13:29:39 +02:00
Wim Taymans 634d7107a4 v4l2: use the device name to open in BeginParams 2022-09-12 09:51:55 +02:00
Wim Taymans c00e0e3467 filter-chain: handle port names with :
When a port name contains a ':' we will try to split it and use the part
before the colon as the node name, which will then fail.

If we can't find a node name after splitting, try again by assuming the
colon is part of the port name.

Fixes control port names such as "Ratio (1:n)" in #2685
2022-09-12 09:51:28 +02:00
Wim Taymans fcff48f1f1 filter-chain: warn when control contains unknown port name
When the config control entry contains an unknown port name, log
a warning instead of silently ignoring it,

See #2685
2022-09-12 09:51:28 +02:00
Wim Taymans 56b03cb3a8 pulse-server: update requested for relative seek only
PulseAudio only updates the requested amount of bytes for relative
seeks, do the same.

See #2680
2022-09-10 16:06:45 +02:00
Wim Taymans 0d08f41c28 alsa: calculate elapsed time only when running 2022-09-09 18:13:02 +02:00
Wim Taymans ca228003c4 alsa: only calculate elapsed time when known 2022-09-09 18:11:23 +02:00
Wim Taymans 5fb361724c alsa: rework timings
Collect all timing info in the process function. When doing delay
reporting, get a consistent snapshot of all the pipewire side state to
calculate the result.

This should result in more correct timing results.
2022-09-09 17:59:07 +02:00
Wim Taymans da9a5cfa5d alsa: subtract elapsed time from server delay only
Only subtract the elapsed time from the server delay. Our reported
delay should always at least still include the data that we have
buffered or else read and write operations might think they can read
or write more than they actually can.
2022-09-09 16:36:33 +02:00
Wim Taymans f58021ed45 alsa: improve elapsed time correction
There is no need to patch the pw_time values with the io->rate just so
we can use it to convert the elapsed time to samples. Use the io->rate
directly instead.
2022-09-09 16:34:18 +02:00