Commit graph

2580 commits

Author SHA1 Message Date
Javier Martinez Canillas ce9f75abaa
libcamera: free the FrameBufferAllocator buffers before deleting it
The libcamera application developer guide mentions that buffers allocated
by the FrameBufferAllocator must be explicitly freed before deleting it.
2021-09-21 14:49:08 +02:00
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
Wim Taymans 774db99d12 alsa: emit params using the user flags
Use the user field to tag changes in params, toggle the serial flag when
emiting the port or node info.
2021-09-01 13:22:52 +02:00
Wim Taymans ab3e265b2c alsa: emit param changes correctly
Use the param user field to tag changes in the params.
codec changes emits an EnumFormat and Props change.
Accumulate various param changes and emit them together.
2021-09-01 13:22:47 +02:00
Wim Taymans 01f640709e alsa: always list PCM as iec958 codec
Always put PCM as the supported format for iec958.
Only accept iec958codecs for iec958 capable nodes.
2021-09-01 13:22:39 +02:00
Wim Taymans 71055dce73 alsa: handle excessive delay values gracefully
When we read an excessively large delay value, clamp it to twice the
delay so that we don't set our timeout to something too far in the
future.
2021-08-31 12:38:18 +02:00
Wim Taymans 09ee977141 alsa: cache UCM config
ALSA has problems with creating more than 8 configs per card so cache
the config per card and reuse it.

Fixes problems with no devices after logging out and in again because
ALSA can't create UCM profiles anymore.

See #1553
2021-08-30 17:36:11 +02:00
Pauli Virtanen b057c9166d bluez5: don't try to autoconnect same device via multiple adapters
If you use multiple BT adapters, it's annoying that PW tries to
autoconnect to the device via all available adapters, and you end up
with multiple connections to the same device (which does not necessarily
work).

Avoid this by autoconnecting with only the first adapter that sees the
device.
2021-08-29 16:34:41 +03:00
Pauli Virtanen 63ba9f98ba bluez5: don't create aptx-ll/faststream sink endpoints
We don't currently implement encoding for the duplex channel
for these codecs, so they are not fully functional as A2DP sinks,
and their main use is anyway with headphones.

Also, the number of endpoints in BlueZ appears to be limited, and
appears to be counted across all adapters.  Unclear whether this comes
from AVDTP limitation, but currently plugging in a second BT adapter
causes the second media application registration to fail.  This change
reduces the number of endpoints enough so that registration succeeds for
two adapters.
2021-08-25 20:58:15 +03:00
Wim Taymans 743aaa3dbd audioconvert: don't just copy the converter flags
We need to manage our own flags based on the direction of the follower.

We also need to make sure we only clear the NEED_CONFIGURE flag
after we are actually configured, not just when we configured our
internal converter.

See #1548
2021-08-25 15:11:54 +02:00
Wim Taymans 9dbfa63193 audioconvert: silence an info debug message 2021-08-23 17:44:56 +02:00
Wim Taymans b0a9945ed0 alsa: only enable PCM iec958 codec when configured
Rework the codec enumeration a little and don't automatically enable PCM
as the code unless requested by the user.
2021-08-23 17:07:17 +02:00
Wim Taymans 2e6f80f808 alsa: only list IEC958 codecs when iec958 or hdmi device. 2021-08-23 11:58:29 +02:00
Wim Taymans 437275460c alsa: add set_format for iec958 formats 2021-08-23 11:31:52 +02:00
Wim Taymans 5feb88575c spa: add helpers to parse and create iec958 formats 2021-08-23 11:31:52 +02:00
Wim Taymans 9dfe35b17c alsa: add enumeration of iec958 format
For hdmi and iec958 devices, enumerate the iec958 formats and
codecs. Initially only PCM is supported as a codec but with
a property or an init option, the list of codecs can be dynamically
configured.
2021-08-23 11:31:52 +02:00
Wim Taymans 8147772cf5 spa: add definitions for IEC958 (S/PDIF)
Add Format subtype and codec property.
Add codecs to include in the format codec property.
Add property to configure elements with supported codecs.
Add type info.
2021-08-23 11:31:52 +02:00
Wim Taymans 0af0cceca2 audioadapter: use format directly when reconfiguring
There is no need to parse and then recreate the format.
2021-08-23 11:20:52 +02:00
Wim Taymans 2427eeae2b audioconvert: reset converter format as well
Reset the format of the converter so that when we go back to DSP mode,
we don't expose the old ports again.
.
2021-08-23 11:20:52 +02:00
Wim Taymans 8f7a972a48 audioadapter: fix passthrough switching some more
Remove the follower ports when leaving passthrough, add the DSP
ports.
Set up the link_io between follower and convert again when leaving
passthrough.
2021-08-23 11:20:40 +02:00
Wim Taymans 9090f19b0a audioconvert: improve passthrough mode
When in passthrough mode, use the position io to update the
io_rate_match fields for the follower. This makes it possible for the
follower to also provide the right amount of data when the converter
is not selected in passthrough.

Add an option to configure the converter in None port config where it
removes all the ports. We can use this when removing the converter to
make sure all it's ports are removed.

When we remove the converter, make sure we expose the follower ports
directly so we can use them for passthrough.
2021-08-23 11:11:11 +02:00
Pauli Virtanen ab5fcf4a66 bluez5: boost A2DP duplex microphone volume by 20 dB
There doesn't seem to be a way to control the A2DP duplex microphone
HW volume gain, and devices sometimes have very low mic volumes.

Work around this by boosting the software volume scale by +20 dB.  If it
causes clipping, the user can just reduce the volume to bring SW gain
below 1.0.
2021-08-23 08:17:46 +00:00
Pauli Virtanen e08cdf27d5 bluez5: add FastStream codec
A2DP codec that uses SBC.  Has a duplex channel, which sends an SBC
stream back.
2021-08-23 08:17:46 +00:00
Pauli Virtanen c628975a75 bluez5: update fastream caps from bluez 2021-08-23 08:17:46 +00:00
Julian Bouzas b368bea98c audioconvert: do _port_set_param on fmtconvert if convert mode
The fmtconvert plugin does not support SPA_PARAM_PortConfig. Instead, we need to
set the format in the specific port with SPA_PARAM_Format.
2021-08-23 08:11:21 +00:00
Pauli Virtanen dedc08cdf8 bluez5: enable duplex for aptx-ll
aptX-LL sink devices may send back mSBC encoded data corresponding to
microphone input.  It appears to be enabled when the bidirectional link
is set in the caps, and the device also supports this.

Implement mSBC decoding in the duplex channel.

Tested to be working on Avantree Aria Pro.
2021-08-22 17:41:50 +03:00
Pauli Virtanen 623b6df8a2 bluez5: work around obscure issue with a2dp-source with duplex
For unknown reason the BT socket when working with A2DP "duplex" stream,
sometimes stops waking up poll when data arrives. Regardless, recv() can
read data packets from it.

To work around this, when A2DP source is in duplex mode, instead of
polling on data, we poll on a timer.
2021-08-21 20:00:52 +03:00
Pauli Virtanen eca37b58a6 bluez5: make room for a2dp duplex channel
Some non-standard A2DP codecs (FastStream/aptX-LL) have "voice duplex
channel" that can be used to provide an A2DP duplex mode.

Add support for duplex channels, accounting for the fact that the two
directions may be encoded with different actual codecs.
2021-08-21 20:00:52 +03:00
Pauli Virtanen f00ec34787 bluez5: use lower latency for aptx-ll codec
This pushes the latency to 256 samples, which still seems to work
Latency of 128 seems to be too small. (NB. the number of input samples
is also the size of packets sent in bytes)

Since pipewire clients usually use powers of two, this may be the
smallest value that makes sense.
2021-08-18 19:55:22 +00:00
Pauli Virtanen 90b62ba2b3 bluez5: add aptx-LL codec
Support the low-latency variant of the aptx codec.

The magic mostly seems to be on the device side, since the stream is the
same as standard aptx, but latency is smaller even if stream/packet
sizes are the same.

Sound output latency is noticeably less than with the standard aptx.
Tested on Sennheiser HD 250 / Avantree Aria Pro.

The codec in principle also supports bidirectional duplex streams,
but that is not implemented here.
2021-08-18 19:55:22 +00:00
Pauli Virtanen 73994feda9 bluez5: allow same codec ID to correspond to multiple endpoints
The codec IDs are user-visible properties.

Some codecs can have multiple endpoints (e.g. different caps struct, or
multiple possible vendor ids), so this detail should not leak to the
user.
2021-08-18 19:55:22 +00:00
Pauli Virtanen fc2fe12794 bluez5: update a2dp-codecs.h from bluez with aptx-ll caps 2021-08-18 19:55:22 +00:00
Julian Bouzas cad64bc992 audioadapter: add support for passthrough mode
Allows audioadapter to behave as its follower
2021-08-17 16:01:10 +00:00
Wim Taymans 49c1c0386f pw-cat: fix raw read
raw read needs bytes, so use the stride to calculate it from frames.
Move ulaw/alaw to packed formats.
2021-08-17 17:56:31 +02:00
Wim Taymans e9679afb12 audioconvert: support alaw/ulaw conversion 2021-08-17 17:33:29 +02:00
Wim Taymans df9f79d869 audioconvert: add converstion to and from alaw/ulaw 2021-08-17 17:32:25 +02:00
Wim Taymans d0d7f2f20b spa: add alaw and ulaw defines
Add alaw and ulaw as raw formats.
2021-08-17 17:31:03 +02:00
Wim Taymans fd82da938a audioconvert: add more format support
Add support to endian conversion as well.
2021-08-17 15:03:03 +02:00
Wim Taymans a5e2e955d2 audioconvert: add more conversions
Add the other endian conversions.
2021-08-17 14:45:00 +02:00
Wim Taymans c39d374ca8 alsa: hook up latencyOffsetNsec in ALSA sink/source
This property is exposed on the device Route and forwarded to the
nodes. It then configured the process_latency.ns field, which
influences the reported port latency.

This makes it possible to change the internal port latency on the
sink and source with pavucontrol and tweak the synchronization to
compensate for internal latencies in the device.
2021-08-17 11:57:12 +02:00
Wim Taymans 391465d1cd audioadapter: emit Latency param changed when follower changed
When the follower port Emits a latency param changed, our reported
latency also changes so we need to emit the changed notify.
2021-08-17 10:49:05 +02:00
Wim Taymans a2083d12d4 alsa: add params to set default internal latency 2021-08-17 10:15:40 +02:00
Wim Taymans 6d196b1d11 alsa: use ProcessLatency param to get and set internal latency 2021-08-17 10:04:12 +02:00
Anukul 6c9f342775 Update 90-pipewire-alsa.rules --> add rule for gsx 1200 2021-08-16 10:04:49 +00:00
Pauli Virtanen 672223d055 bluez5: avoid poll busy loop in a2dp-sink
Disable flush polling when we don't have data ready to write to the
socket (or socket send failed). This avoids entering into a poll busy
loop, which may result to rtkit killing the process.
2021-08-13 23:37:48 +03:00
Pauli Virtanen 5071589aea bluez5: enable SBC-XQ codec by default, if allowed by quirks
Enable SBC-XQ by default, and move it at the end of the codecs list, so
that bluez does not connect to it automatically except when it is the
codec used previously.

When the codec is disabled by quirks, it won't appear in the codecs
list, and so can't be selected by user (and so won't be connected
automatically).

However, since SelectConfiguration does not carry information which
device is in question, we cannot prevent BlueZ connecting to the codec
even if it's disabled for a specific device. If the "impossible" occurs
regardless, we won't reject the connection and the profile will be shown
as the generic "A2DP" one.  If the sound is garbled, the user can select
some other profile that works.
2021-08-13 18:45:16 +00:00
Zsombor Welker f5850af4d8 bluez5: handle XAPL battery level per Apple Guidelines
Corrects the handling of AT+XAPL Apple extensions to send
`+XAPL=iPhone,2` instead of `+XAPL: iPhone,2` based on Apple's
documentation.

Replaces magic numbers with enum values.

[Accessory Design Guidelines](https://developer.apple.com/accessories/Accessory-Design-Guidelines.pdf)
2021-08-13 10:30:36 +02:00
Zsombor Welker a1777d00e3 bluez5: correct parsing order for HF indicator 2 based battery status
Since "AT+BIND=" was before "AT+BIND=?", the seconds statement was never
matched.
2021-08-12 21:13:22 +02:00
Sanchayan Maity be6824cb15 bluez5-device: Set device intended role for HFP 2021-08-12 18:54:46 +00:00
Zsombor Welker f87942027f bluez5: report HF indicator 2 based battery status
HF indicator 2 (see [assigned-numbers], Hands-Free Profile) is able to
report battery percentage at 1% intervals (in range [0, 100]), contrary
to the `+XAPL` `+IPHONEACCEV` extension which only supports 10%
increments.  This does not guarantee increased granularity however, as
peers may still be limited to imprecise battery measurements internally
or round to coarser percentages.
Supporting both additionally broadens the range of devices for which PW
can report its battery level.

[assigned-numbers]:
https://www.bluetooth.com/specifications/assigned-numbers/
2021-08-12 18:45:44 +00:00
Wim Taymans 44c6ec146e filter-chain: parse config options
Remove LADSPA dependencies, only use it in ladspa_plugin.c
Parse convolver config, like filename
2021-08-11 21:33:48 +02:00
Wim Taymans 0a5a4c046d alsa: Free global state
We need to do this or else newly plugged devices might not load.

It does not seem to harm UCM config on my machine, so this reverts
3d372424cc

See #1478
2021-08-10 11:25:41 +02:00
Wim Taymans b7162d2c09 alsa: free alibpref after use 2021-08-10 11:14:15 +02:00
Wim Taymans bdc164f509 udev: fix behringer UMC202 usb device id
See https://usb-ids.gowdy.us/read/UD/1397/0507
2021-08-10 10:45:47 +02:00
Wim Taymans 35d7ad5529 acp: compare the HW volume against stored HW volume
When we store the real_volume we get a hardware_volume as stored
in the mixer and a residual software_volume.

When we read the volume from the card, we need to compare this against
the hardware_volume we stored to check if something changed, not
against the real_volume that also contains the leftover software_volume.
2021-08-09 14:18:20 +02:00
Nils Tonnätt dd12910769 Revert "[Meson] Fix all deprecation warnings"
This reverts commit f7e1175ef0.
2021-08-08 19:18:40 +00:00
Nils Tonnätt f7e1175ef0 [Meson] Fix all deprecation warnings 2021-08-06 07:56:16 +00:00
Wim Taymans a9fecd50ed bluez5: improve debug
Log the errno when something is wrong.
2021-08-05 15:41:50 +02:00
Wim Taymans e3a643bffe bluez5: remove useless pod_frame() call 2021-08-05 15:41:26 +02:00
Peter Hutterer 5ae528c957 spa: move the log version define so it matches other implementations
Makes it match up with the comment now too
2021-08-05 09:51:40 +00:00
Peter Hutterer 1244229faf spa: document the spa_hook interface with an example 2021-08-05 09:51:40 +00:00
Peter Hutterer d8f6033b9d spa: document the spa_interface and how it works 2021-08-05 09:51:40 +00:00
Peter Hutterer 56acf766a5 doc: split the spa_interfaces out as separate group from the spa_hooks 2021-08-05 09:51:40 +00:00
Wim Taymans c6dc7e98fd dbus: protect against NULL data
Make sure we don't accidentally unref a NULL data.
2021-08-03 19:11:15 +02:00
Daniel Stone bf112940d0 spa: Only test __cplusplus value when it's defined
In higher warning levels, clang complains about testing the value of
__cplusplus when it's not defined.
2021-08-03 15:43:59 +00:00
Peter Hutterer 51a177eb6d tree-wide: replace strstr(a, b) == a with spa_strstartswith()
spa_strstartswith() is more immediately understandable.

Coccinelle spatch file:
	@@
	expression E1, E2;
	@@
	- strstr(E1, E2) != E1
	+ !spa_strstartswith(E1, E2)

	@@
	expression E1, E2;
	@@
	- strstr(E1, E2) == E1
	+ spa_strstartswith(E1, E2)

Applied to the tree except for alsa/acp/compat.h because it looks like
that header is still mostly as-is from PA.
2021-08-02 08:24:21 +00:00
Huang-Huang Bao 9f2d6d6d28 bluez5: fix rounding error on hardware volume conversion
Ensure the conversions between spa_bt_volume_linear_to_hw and spa_bt_volume_hw_to_linear are reversible when
operating on hardware volume.
2021-07-30 08:46:14 +00:00
Simon Ser 73217818cc spa: document enum spa_video_format
References: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/1470
2021-07-30 07:29:44 +00:00
Neal Gompa 1216371f8c bluez5: Use libfreeaptx instead of libopenaptx
libfreeaptx is a fork of libopenaptx prior to the dubious licensing
situation was introduced to the library.

As it's fully API compatible, let's use that instead for those who
want to use aptX support.

The library source is available at https://github.com/iamthehorker/libfreeaptx
2021-07-29 15:22:04 +00:00
Wim Taymans 2dabd337dc audioconvert: clear negotiated rate
When we clear the format on the non-dsp port, set the rate back to
0 so that we can negotiate a new rate if needed.
2021-07-29 13:35:41 +02:00
Peter Hutterer 4e90760155 spa: silence a doxygen warning
warning: documented symbol 'spa_log_error foo' was not declared or defined.
2021-07-29 14:03:00 +10:00
Wim Taymans 44583367db pod: add prop option to avoid fixation
Add a DONT_FIXATE flag to spa_pod_props. The flag avoids fixation
of the property by spa_pod_fixate().

When filtering properties, 'and' the flags together in the filtered
property. This mostly preserves the merged property flags. It also
merges the DONT_FIXATE flags so that when both sides can handle
the non-fixated result, it will be returned.

This can be used to let PipeWire filter out the common property
fields and leave the final selection of fields to the producer. This can
only work when the final selected field can be transported in some
other way than the format param, like on the buffer fields or in
metadata. One use case is negotiation of the DMABUF modifiers.

See #1084
2021-07-28 11:03:26 +02:00
Peter Hutterer 49f3d5842e test: replace all spa_assert() macros with spa_assert_se()
These are tests, we never want those to be optimized away.
2021-07-27 10:24:44 +10:00
Peter Hutterer 63d833dabf spa: use spa_assert_se() for bugs in the util string functions
These are programming bugs that should never happen, so let's always
abort.
2021-07-27 10:24:44 +10:00
Wim Taymans 78f52a7073 loop: avoid corruption of ringbuffer
The ringbuffer can't be written to from multiple threads.

When both the main loop and data thread do _invoke, they both write to
the ringbuffer and cause it to be corrupted because the ringbuffer is
not multi-writer safe.

Doing invoke from the thread itself is usually done to flush things out
so we really only need to flush the ringbuffer and call the callback.

See #1451
2021-07-26 11:39:48 +02:00
Pauli Virtanen 606108f409 spa: add spa_strstartswith 2021-07-24 14:36:03 +03:00
Javier Martinez Canillas 76cb5c1169 libcamera: remove unused buffer variable in LibCamera::stop()
To fix build warning about a variable being unused in LibCamera::stop():

[1/2] Compiling C++ object spa/plugins/libcamera/libspa-libcamera.so.p/libcamera_wrapper.cpp.o
../spa/plugins/libcamera/libcamera_wrapper.cpp: In member function ‘void LibCamera::stop()’:
../spa/plugins/libcamera/libcamera_wrapper.cpp:531:58: warning: unused variable ‘buffer’ [-Wunused-variable]
  531 |                 for (const std::unique_ptr<FrameBuffer> &buffer : this->allocator_->buffers(stream)) {
      |                                                          ^~~~~~
2021-07-23 07:59:10 +00:00
Javier Martinez Canillas 5471a0018b libcamera: fix no-longer existent <libcamera/buffer.h> header inclusion
The SPA plugin is including a <libcamera/buffer.h> header file, but this
got renamed to <libcamera/framebuffer.h> to match the defined class name:

../spa/plugins/libcamera/libcamera_wrapper.cpp:52:10: fatal error: libcamera/buffer.h: No such file or directory
   52 | #include <libcamera/buffer.h>
      |          ^~~~~~~~~~~~~~~~~~~~

Fixes #1435
2021-07-23 07:59:10 +00:00
Pauli Virtanen cb10d87bb8 bluez5: handle no data written to sco socket
If socket write results to EAGAIN/EWOULDBLOCK or rx data starts late,
spa_bt_sco_io_write may return 0, and we should give up and skip ahead
(and not loop in RT thread with very small timeout).
2021-07-23 07:58:39 +00:00
Wim Taymans a33df863b4 acp: sync with pulseaudio 2021-07-21 13:11:17 +02:00
Wim Taymans 3d372424cc alsa: don't free alsa global info for each node
Don't clear the global config or else we might lose the UCM state.

See #1437
2021-07-21 12:18:43 +02:00
Wim Taymans 08e34a99fd acp: use AUX channels for PRO audio profile
That way we can actually use the channel names to make custom loopback
mappings.
2021-07-21 11:27:09 +02:00
Wim Taymans 1ad54e8a26 spa: add 64 AUX channels
Make 64 AUX channels instead of using the CUSTOM range for them.
2021-07-21 11:25:43 +02:00
Wim Taymans a91502b3e0 loop: improve invoke avail check
First calculate the size of the aligned payload and then check if
we can fit this aligned payload in the remaining space in the
ringbuffer.

Otherwise we might be able to fit the item + payload in the remaining
space but then place the alignment bytes at the begginning, which would
break alignment of the next invoke_item struct.
2021-07-19 10:12:15 +02:00
Wim Taymans 7f4fa64291 loop: Fix crash because of overflow
Also check if there is enough space to write the payload bytes.

We check if there is enough space for the invoke_item structure first.
Then we calculate how much bytes we need to use for the payload but we
fail to check if we can actually write that much data, risking
overwriting existing data from the ringbuffer and causing a crash later
when we try to jump to invalid memory.

Add some more comments.
2021-07-19 09:53:23 +02:00
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
Pauli Virtanen b98b9e0e77 bluez5: deal with old libusb versions 2021-06-22 10:58:50 +03:00
Pauli Virtanen 9d38d375d2 bluez5: add and use quirk for broken mic HW volume
Some headsets emit AT+VGM even though +VGM commands do not actually
adjust the recording volume.
2021-06-22 10:58:50 +03:00
Pauli Virtanen 9422e76d89 bluez5: enable hw volume on all profiles, if device quirks permit it 2021-06-22 10:58:50 +03:00
Pauli Virtanen 5e0b63b149 bluez5: backend-native: use quirks + usb adapter caps for checking msbc
Use the quirks database to check whether to enable MSBC codec for each
device.

If quirks don't allow ALT1 mode for an USB adapter, check whether the
adapter has an usable ALT6 mode and disable MSBC if not.
2021-06-22 10:58:50 +03:00
Pauli Virtanen b57ae8c2a6 bluez5: add support for hardware quirk/feature database
Implement hardware quirk/feature database with pattern matching.
2021-06-22 10:58:50 +03:00
Pauli Virtanen 2c9764da1d bluez5: parse bluez vendor/product ids
It seems few devices support the Device Id via bluez.

Try to figure out vendor/product ids for usb devices also via sysfs.
Also try to figure out the adapter bus type.
2021-06-22 10:58:50 +03:00
Huang-Huang Bao ea28cb95c0 bluez5: don't autoconnect device if no profiles
Otherwise timers would be created for every bluetooth devices, even they don't have audio profiles.
2021-06-21 07:10:02 +00:00
Huang-Huang Bao db6e73895f bluez5: clean up connection status handling
Also separate device info emitting into a new function.
2021-06-21 07:10:02 +00:00
Huang-Huang Bao 3433f40cd9 bluez5: fix device connection issue if profile(UUIDs) info is delayed
Keep all types of devices, only emit device info if device has audio profiles.
Heuristically add profiles based on bluez actions so device can still be connected
even without initial UUIDs info from signal InterfaceAdded for org.bluez.Device1.

Fixes #1330
2021-06-21 07:10:02 +00:00
Pauli Virtanen b44fdf5ebb bluez5: backend-native: don't send +BCS if no codec negotiation
Fix issue with sending +BCS for CVSD even though codec negotation is not
available for the RFCOMM.
2021-06-20 19:40:00 +03:00
George Kiagiadakis 2723b0c6e2 meson: export plugin and data dirs for other projects to find them
SPA_PLUGIN_DIR is exported in pkgconfig as 'plugindir'
PIPEWIRE_MODULE_DIR is exported as 'moduledir'
PIPEWIRE_CONFIG_DIR is exported only in uninstalled environments
as 'confdatadir' (not making this public due to the possible upcoming
configuration changes in pipewire)

All variables are also exported on the meson dependency objects,
so that subprojects can find them.

Wireplumber can then find them like this:

  pipewire_moduledir = pipewire_dep.get_variable(
    pkgconfig: 'moduledir', internal: 'moduledir', default_value: '')

... and this works regardless of whether wireplumber is being
configured as a subproject or using the uninstalled pkgconfig files
or using the system installation of pipewire.

This is required in order to run wireplumber tests in the
uninstalled environment with 'meson test'
2021-06-18 19:24:28 +03:00
George Kiagiadakis 7ab5c35cad meson: declare spa_dep and override_dependency() for spa and pipewire
This allows meson subprojects (or projects using pipewire as a meson
subproject) to be able to use dependency('libpipewire-0.3') and
dependency('libspa-0.2') to find the uninstalled versions of these
libraries directly from the build dir instead of going through pkg-config
2021-06-18 17:54:18 +03:00
Wim Taymans 4aa80c7a71 splitter: we always produce output
Always set the HAVE_OUTPUT flag because we always consume the
input and produce output, either to a buffer or an error.
This makes sure processing never stalls when something is wrong
on the output side.

See #1305
2021-06-17 18:34:01 +02:00
Wim Taymans 2ad202b8e8 audioconvert: track and compensate for rate changes
Follow the rate of the _io_position area and adjust the resampler
to match. This ensures that we always process at the DSP samplerate
to the target negotiated fixed rate of the device/stream.
2021-06-17 11:11:45 +02:00
Wim Taymans 519bd342be audioconvert: don't use samplerate to negotiate
The merger and splitter use the samplerate from the _io_position
for the DSP formats so set the samplerate to 0 to make sure we
don't use it to negotiate a format with the peer.
2021-06-17 11:11:45 +02:00
Wim Taymans 7ba7179eee audioconvert: use the position rate to negotiate
When we have an io_position, use the rate as the samplerate when
negotiating.
2021-06-17 11:11:45 +02:00