So that we can reuse optimized versions in unoptimized noise
functions.
Do allocation a little different so that we can align everything
from the start.
Loop though coefficients, when all are 0, clear the destination.
When only one coefficient is used, simply copy with volume.
Otherwise run the complete convolution.
Don't count the sum for unused matrix coefficients. When doing pairing,
we set the mask to ~0 and so we would otherwise count too much.
Apply normalization to the active matrix coefficients, not whatever the
loop variables end up being at the end of the loops.
A flush command is not supposed to stop playback but just clear the
current state. Normally, to avoid complications, an application will
Pause, Flush and optionally Start to do things smoothly without
interfering with the process loop, but things should not crash if that's
not the case.
Fixes#2726
HFP 1.8 states in 4.35.1:
Due to the small inconsistency between the GSM standard [2]) and the current
Headset specification ([3]), the HF shall also accept the “=” symbol,
in place of “:”, as a valid separator for this unsolicited result code.
iOS seems to use "=", so accept that as well.
See #2463
Both HFP and HSP require an AT command from HF/HS to AG to
be terminated by CR, not LF. (HFP 1.8, 4.34.1; HSP 1.2, 4.8.1)
See #2463
Fixes: 0b2d3730b6 ("bluez5: Add HFP HF support")
`strsep()` is simpler to use than `strtok()` or `strtok_r()`
while being thread-safe and reentrant.
Although it is an extension, it is available in both glibc and musl.
A Suspend should clear all the negotiated state and start a new
negotiation in Start. Use a flag to control this.
This avoids recalculation of state for each pause/play state change.
See #2701
Add a resampler option to prefill the resampler with 0. This then
results in the resampler always outputing and consuming the same
amount of data instead of a short buffer in the beginning.
When rfcomm_hfp_ag() returns false, an "ERROR" reply is sent.
When testing if the SLC is configured, 2 "ERROR" replies are sent, which
should not be done.
For backward compatibility with old Wireplumber releases, support the
old api.bluez5.a2dp.sink/source names, and use them in object events
instead of the media.sink/source names.
Previously, if "add_listener" was called on the monitor device, then it
did not necessarily emit events about all devices because it called
`enum_devices()` which does not emit events about already existing
devices. So the very first listener would get all existing devices,
but subsequent ones would not get events about the existence of devices
that have already been seen by the monitor. Fix that by simply emitting
events about all existing devices if the current listener is not the first.
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.
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.
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()`.
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.