Commit graph

2296 commits

Author SHA1 Message Date
Peter Hutterer
257fd83f65 Replace Pipewire with PipeWire for consistency
And set up a CI job to check for that.
2021-07-14 16:56:54 +10:00
Julian Bouzas
4732aea0c6 spa: clear all devices when udev monitor stops
Otherwise the udev device leaks when restarting the monitor
2021-07-13 17:03:30 +00:00
Julian Bouzas
7bf50fd8ed spa: alsa: acp: free device name in add_pro_profile 2021-07-13 17:03:30 +00:00
Pauli Virtanen
0c9f0210ed bluez5: sco-io: start writing only after the packet size is known
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.
2021-07-11 16:14:03 +00:00
lsde
579481ab70 Use correct RTP payload type for aptX, LDAC,SBC
According to the A2DP spec, the payload type should be
set to a number between 96 and 127.
This is fixed for AAC codec, but not the rest.

Original PulseAudio issue: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/issues/591
2021-07-11 16:10:20 +00:00
Julian Bouzas
2dcdc80030 spa: alsa: acp: fix memleak when destroying card profles 2021-07-08 11:08:00 -04:00
Wim Taymans
8184d4576a handle snprintf errors better 2021-07-06 17:56:04 +02:00
Wim Taymans
d88e8edd11 avoid shadowing arguments 2021-07-06 17:55:16 +02:00
Wim Taymans
acad6b8f2b audioconvert: use the right variable
Keep the result of the follower in res2, fail if we could not set the
properties on both the follower and the converter.
2021-07-06 16:28:57 +02:00
Wim Taymans
9fa72f22cb thread: fix compilation 2021-07-06 16:20:05 +02:00
Wim Taymans
1ff535e6eb spa: move thread to SPA support
It can be more generally useful eventually.
2021-07-06 15:48:20 +02:00
Wim Taymans
3a879e8b1a audioconvert: fix s24_32 to float
s24_32 needs to be sign extended before converting to float because the
upper bits are undefined and might be anything.

Fixes #1393
2021-07-06 12:42:39 +02:00
Konstantin Kharlamov
252816f757 bluez5: fix wrongly typed started field in spa_bt_sco_io
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.
2021-07-06 00:07:21 +03:00
Konstantin Kharlamov
dea1a0bee2 audiotestsrc: convert sizes to const size_t
`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'.
2021-07-05 23:30:45 +03:00
Konstantin Kharlamov
ab71d2c3cb audioconvert: fix potential NULL reference in resample_native_init
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",
2021-07-05 19:35:06 +03:00
Wim Taymans
0b758a2301 alsa-seq: fix off-by-one for event offset
The event offsets need to go from 0 to quantum-1 to be valid to the
current midi event buffer.

Fixes #1395
2021-07-05 16:25:11 +02:00
Wim Taymans
35194d6de0 node-driver: remove timers when not a driver 2021-07-01 12:28:18 +02:00
Wim Taymans
620b34cd6b null-audio-sink: only start timers when driving
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.
2021-07-01 11:33:21 +02:00
George Kiagiadakis
36c7e820d8 test nodes: make the timerfd non-blocking
Relates to #1377
2021-07-01 11:52:35 +03:00
George Kiagiadakis
5aa9c95390 node-driver: make the timerfd non-blocking
Relates to #1377
2021-07-01 11:52:28 +03:00
George Kiagiadakis
c633004bf3 null-sink: make the timerfd non-blocking
Fixes #1377
2021-07-01 11:37:01 +03:00
Barnabás Pőcze
f5d51162c4 treewide: mark things static and const
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.
2021-06-30 14:44:08 +02:00
Barnabás Pőcze
48dbb4da3c spa: bluez: native: do not use spa_aprintf()
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.
2021-06-30 14:44:08 +02:00
Niklāvs Koļesņikovs
e062c4d8de meson.build: adds summary() to optional programs 2021-06-29 17:23:37 +00:00
Wim Taymans
ae89ae093e acp: strip UCM alibpref from mapping
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
2021-06-29 17:43:00 +02:00
Wim Taymans
82f2e85a0f fmt-ops: fix neon stereo resample 2021-06-28 17:20:50 +02:00
Barnabás Pőcze
84b9644ee3 spa: utils: defs: fix SPA_FOR_EACH_ELEMENT usage example
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[]`.
2021-06-28 15:07:02 +02:00
Wim Taymans
d6a569620c v4l2: DmaBuf and MemFd are mostly the same
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.
2021-06-28 14:55:05 +02:00
Barnabás Pőcze
d06a2e2140 spa: meson.build: look for libcamera under another name
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
2021-06-27 18:24:15 +00:00
Pauli Virtanen
2b515b5e50 dbus: keep a ref to DBusConnection if reconnecting is not handled
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.
2021-06-26 16:11:40 +03:00
Niklāvs Koļesņikovs
de72ed5590
meson.build: adds V4L2 header and enablement reporting via summary()
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).
2021-06-25 15:13:07 +03:00
Niklāvs Koļesņikovs
b55bafae09
meson.build: move libcamera and libdrm summary() to 'Backend' section 2021-06-25 15:13:07 +03:00
Niklāvs Koļesņikovs
38d5de789d
meson_options.txt: disable vulkan option since it's not ready for use
According to George Kiagiadakis it being set to auto is an accident,
because the Vulkan support does not [yet] provide anything useful.
2021-06-25 15:12:27 +03:00
Ivan
0a02396995 meson: Make summary() respect vulkan headers detection
Fix false positive that caused by summary() checking only for vulkan
library but not headers.
2021-06-25 11:27:31 +00:00
Peter Hutterer
0880ff9a84 spa: add spa_strendswith (copy from protocol-pulse)
Useful function, let's make it generally available.
2021-06-25 08:42:24 +00:00
Niklāvs Koļesņikovs
71d39e90ed meson: adds post meson setup/--reconfigure summary for auto features
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.
2021-06-25 08:31:12 +00:00
Stefano Ragni
243d534476 dbus: fix bus type reported in logs 2021-06-25 08:26:00 +00:00
Wim Taymans
016f02616b json: don't escape / 2021-06-24 16:18:59 +02:00
Wim Taymans
2acf29a86c Revert "json: also escape '/' as required by JSON"
This reverts commit eb8546a682.

We don't need to escape the / according to  RFC7159
2021-06-24 16:12:47 +02:00
Wim Taymans
679df3f9d9 v4l2: implement latency get and set 2021-06-24 16:05:31 +02:00
Peter Hutterer
0f0565175e doc: rework the SPA plugin documentation
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.
2021-06-24 10:54:13 +00:00
Wim Taymans
48e6e41d95 audioconvert: improve latency handling
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.
2021-06-24 12:20:44 +02:00
Wim Taymans
22fe0b293a audioconvert: add some more debug 2021-06-24 12:11:38 +02:00
Wim Taymans
8ee9a7b5e5 audioadapter: latency is writable 2021-06-24 12:07:06 +02:00
Wim Taymans
f03f1926e3 seq: track port latency 2021-06-24 10:04:19 +02:00
Wim Taymans
4c09eb227f alsa: rename indexes into port and node params 2021-06-24 10:03:41 +02:00
Wim Taymans
8cf5927e95 alsa: keep track of input and output latency
track and report both input and output latency.
2021-06-24 09:59:48 +02:00
Konstantin Kharlamov
ed9560fb03 alsa: fix "now.tv_sec maybe used uninitialized" warnings
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.
2021-06-22 22:42:25 +03:00
Konstantin Kharlamov
252e798ece alsa: remove unused res variable in alsa_on_timeout_event 2021-06-22 22:42:25 +03:00
Wim Taymans
79866a93cd Param: add process latency param and info 2021-06-22 16:29:29 +02:00