The kernel-provided SCO write MTU is currently never the correct packet
size for writing, so don't try to use it. Some adapter firmware (eg.
BCM20702A0 0b05:17cb) appears in practice sensitive to the alignment of
the msbc frames, and writes with wrong packet size break things but only
on certain headsets. For other adapters, this doesn't appear to matter.
This is a bitfield, but it's unclear what it achieves since this is the
only member of a bitfield, so it may be more efficient to just make it a
bool.
Fixes a LGTM warning:
Bit field started of type int should have explicitly unsigned integral, explicitly signed integral, or enumeration type.
`sizes` members participate in multiplication and subsequent assignment
into port->bpf, which has size_t. So LGTM rightfully complains, there's
a chance the multiplication will overflow before the assignment happens.
Should have no influence on performance since 64 bit multiplication is
as fast, and since the struct is constified, a wise compiler should make
sure it doesn't take excess space either.
Fixes LGTM warning:
Multiplication result may overflow 'unsigned int' before it is converted to 'size_t'.
That was found by GCC fanalyze pass. Fixes warning:
../spa/plugins/audioconvert/resample-native.c: In function ‘resample_native_init’:
../spa/plugins/audioconvert/resample-native.c:385:9: warning: dereference of NULL ‘0B’ [CWE-476] [-Wanalyzer-null-dereference]
385 | spa_log_debug(r->log, "native %p: q:%d in:%d out:%d n_taps:%d n_phases:%d features:%08x:%08x",
Check if we are driving or following and only start the timers when we
are the driver of the graph.
Ready events from non-drivers are not really a problem because they are
ignored. They only cause unnecessary wakeups in the graph.
Mark some structures, arrays static/const at various places.
In some cases this prevents unnecessary initialization
when a function is entered.
All in all, the text segments across all shared
libraries are reduced by about 2 KiB. However,
the total size increases by about 2 KiB as well.
Instead of spa_aprintf(), convert `rfcomm_send_{cmd,query}`
to take a printf-style format string.
Furthermore, handle overflows and return errors from
`rfcomm_send_{cmd,reply}`. And make those functions
take an rfcomm as argument instead of any spa_source.
And match conversion specifiers to the actual types
in format strings.
Strip the alibpref from the device string in the mapping name. This
name is used to generate the node name eventually and we don't want
this random identifier in it.
Fixes#1362
To iterate over an array of `T`, the iterator must be `(const) T *`,
so that the types are compatible when `T[]` decays into `T *`.
In the example when `struct foo *[]` decays, it becomes `struct foo **`,
which is not compatible with the the type of iterator, `struct foo *`.
Fix that by changing the type of the array to `struct foo[]`.
If the caller asks for MemFd, pass a DmaBuf because it is mostly
the same for v4l2.
Not very correct but it's not yet trivial to fall back to memfd.
And this way we have something to give to the clients that will work
when the client asks for MemFd or MemPtr.
libcamera commit ec7afef665a87eb389a5a4cb9ff35e9c24bbcc29 (2021-06-24)
changed the name of the generated pkg-config file from 'camera.pc'
to 'libcamera.pc'.
First look for the libcamera dependency under the new name 'libcamera',
and if that's not found, look for it under the older name 'camera'.
Fixes#1355
Several places in the code don't handle reconnecting DBus connections
yet. In those cases, a ref to the DBusConnection handle needs to be
kept, so that there's no use-after-free if it gets freed by spa_dbus
if the connection is broken.
Adjust spa_dbus so that others keeping additional refs is safe.
Until now the 'v4l2' feature was not actually checking that its
required header has been found, this commit adds a check for
<linux/videodev2.h> and correctly reports both header status and whether
the feature itself ends up enabled (depends on libudev).
As suggested by George Kiagiadakis, adds calls to summary() function
for each feature that is by default set to auto, so that an overview
of their effective state is printed at the end of meson setup or
meson --reconfigure command.
Currently ordering is a bit messy but tidying it up would detach
the summary() functions from the dependencies they rely on and could
be done later along with meson_options.txt re-ordering so that the
two match as much as possible.
Add more info to the main SPA page and split the design vs plugin pages up,
together with some more documentation to ideally lower make this easier to
understand on a glance.
Most of the actual plugin loading documentation are unmodified.
When setting the Latency parameter on one side of the converter, set
it also on the other size. We should actually implement propagating
the latency through all the elements of the converter later.
Implement latency handling on fmtconvert.
merger and splitter change latency on all ports when on port changes.
All this makes the configured and exposed latencies visible on all
ports from adapter.
Fixes a number of warnings that look like this:
In file included from ../spa/include/spa/utils/result.h:37,
from ../spa/plugins/alsa/alsa-seq.c:35:
In function ‘set_timers’,
inlined from ‘do_reassign_follower’ at ../spa/plugins/alsa/alsa-seq.c:909:2:
../spa/include/spa/utils/defs.h:191:39: warning: ‘now.tv_sec’ may be used uninitialized [-Wmaybe-uninitialized]
191 | #define SPA_TIMESPEC_TO_NSEC(ts) ((ts)->tv_sec * SPA_NSEC_PER_SEC + (ts)->tv_nsec)
| ~~~~^~~~~~~~
../spa/plugins/alsa/alsa-seq.c:840:28: note: in expansion of macro ‘SPA_TIMESPEC_TO_NSEC’
840 | state->next_time = SPA_TIMESPEC_TO_NSEC(&now);
| ^~~~~~~~~~~~~~~~~~~~
../spa/plugins/alsa/alsa-seq.c: In function ‘do_reassign_follower’:
../spa/plugins/alsa/alsa-seq.c:836:25: note: ‘now’ declared here
836 | struct timespec now;
| ^~~
The reason for these warnings is that spa_system_clock_gettime() may
fail if a version check fails, but the code in question didn't check for
the possible fail. If it failed, then execution would continue, and the
arguments that were passed to the macro will be used uninitialized.
Fix this by checking whether function succeeded.