Commit graph

3076 commits

Author SHA1 Message Date
Pauli Virtanen
d29aafd857 bluez5: enable A2DP duplex volume boost only if codec asks for it
Make A2DP volume boost conditional on a flag the codec sets.

Bump codec API version.
2022-07-19 13:44:56 +00:00
Pauli Virtanen
92b2b44954 bluez5: pass global setting dict to codec select_config / preference_cmp
The device is not know at SelectConfiguration time, so the settings
argument in select_config is currently unused. Pass on a global settings
dict instead, so that codec parameters can be configured.

Also add settings argument to caps_preference_cmp.

Bump codec API version.
2022-07-19 13:44:56 +00:00
Pauli Virtanen
a8eb146d39 bluez5: tell the codec whether endpoint is sink or source
Add a flag A2DP_CODEC_FLAG_SINK to incidate a sink endpoint.

Also enum_config and caps_preference_cmp may need to know whether the
codec is being configured for SRC or SNK. Also add the flags argument to
init_props.

Bump codec API version.
2022-07-19 13:44:56 +00:00
Pauli Virtanen
8d66b2b2f7 bluez5: a2dp-source: more duplex codec workarounds
a2dp-sink writing duplex data to the BT socket breaks a2dp-source source
polling, also in A2DP source role. Hence, use the timer-based polling
workaround always in duplex mode.
2022-07-19 13:44:56 +00:00
Pauli Virtanen
f593a44069 bluez5: a2dp-sink: support duplex codec
Allow running a2dp-sink using the duplex codec, when the local endpoint
is the A2DP sink.
2022-07-19 13:44:56 +00:00
Wim Taymans
aaa015d0c0 avb: fix compilation on big endian 2022-07-19 13:06:52 +02:00
Wim Taymans
3c87541219 Revert "mixer-dsp: mix a quantum of data at a time"
This reverts commit ecc0eecf0f.

The io-position is not actually set or updated on the mixer node so it
might use the wrong values.

Fixes #2525
2022-07-18 21:34:57 +02:00
Pauli Virtanen
d82cd959e7 audioconvert: add different channel remap testcase 2022-07-18 20:33:05 +02:00
Pauli Virtanen
977d6e2321 audioconvert: fix input remapping
As currently implemented, input format convert channel remap is no-op.
This is because although the out_datas array is permuted, the original
pointer array is not referred to later on, so the only effect is that
the temporary data array is stored in permuted order.

Fix the permutation by permuting the pointers only for the conversion
step.
2022-07-18 20:31:46 +02:00
Wim Taymans
4eb81b13ac audioconvert: add test
Add test for F32_7p1_remapped to F32P_7p1_remapped

See #1324
2022-07-18 18:55:30 +02:00
Wim Taymans
67754ad3bc meson: remove sse_args from plain c build 2022-07-18 13:00:12 +02:00
Wim Taymans
ada39f3048 audioconvert: improve noise bits
Make a new noise method called PATTERN and use it to add a slow (every
1024 samples) repeating pattern of -1, 0.
Only use this method when we don't already use triangular dither.

See #2540
2022-07-18 11:41:57 +02:00
Wim Taymans
57f63feb92 audioconvert: Fix Wannamaker name 2022-07-18 10:22:21 +02:00
Wim Taymans
9dbd016f9d audioconvert: fix compilation warnings 2022-07-17 13:15:00 +02:00
Wim Taymans
a4db745a7e audioconvert: improve noise shaping
Reorganize things a little so we can add more noise shapers.
Add sloped triangular noise.
Add wanamaker3 noise shaping.
2022-07-15 12:36:15 +02:00
Wim Taymans
a458b39774 tests: add test for rounding 2022-07-14 10:48:37 +02:00
Wim Taymans
419517fd55 audioconvert: build C versions with -Ofast and -ffast-math
Move resampler implementations to a -c version.
Compile some of the functions with other flags to make them more
optimized.
2022-07-14 10:07:07 +02:00
Wim Taymans
0ba3e7c5db audioconvert: round instead of truncate, to reduce distortion
See #2543
2022-07-13 20:56:13 +02:00
Wim Taymans
d18428f8bb audiconvert: make macros for conversions
Make a common macro for float to int and int to float so that we can
change the algorithms easily.
2022-07-13 18:10:25 +02:00
Wim Taymans
4062077472 avb: remove wrong cargs
Fix a typo
2022-07-13 13:14:07 +02:00
Wim Taymans
e82145aeae spa-resample: don't flush too much
Also clamp the amount of input samples we push when flushing. do several
rounds of zero pushing until we have flushed enough.
Handle the cases where no input is needed or no output is generated.

Fixes crashes when downsampling from 96000 to 1000 Hz or so.
2022-07-13 12:02:12 +02:00
Fabian Vogt
ed88cad583 spa/alsa-udev: Check accessibility of pcm devices as well
The order of attribute changes is random, so it's possible that controlCX is
accessible before the other devices, which marks the device as available but it
actually fails to open. Only consider the device accessible if both control and
PCM devices can be accessed.

This requires reacting to ATTRIB changes of pcm devices as well now.

Fixes #2534
2022-07-13 09:17:08 +00:00
Wim Taymans
52281b9a7e alsa: check the offset against the size of the buffer
We need to check the last offset against the size of the buffer, not the
remaining size in the buffer.

When the writing is split, this could cause the buffer to be reused
wrongly.

See #2536
2022-07-13 09:37:01 +02:00
Wim Taymans
11bc60a53d spa-resample: handle init errors 2022-07-12 17:39:58 +02:00
Wim Taymans
ce9a912f1a audioconvert: set scale to cutoff when upsampling 2022-07-12 17:39:14 +02:00
Pauli Virtanen
d6a7db8020 bluez5: mark HFP/HSP streams with media.role=Communication 2022-07-12 14:04:31 +00:00
Pauli Virtanen
6e37110efd bluez5: adjust source rate control
Use different filter function than spa_dll for the rate control.
Also use a longer window for spike determination.
2022-07-12 13:55:54 +00:00
Wim Taymans
ee84f96915 audioconvert: tweak the resampler a bit 2022-07-12 14:35:23 +02:00
Wim Taymans
f043922b24 avb: implement maap
Implement the maap state machine.
Use maap for the destination address of talker streams.
2022-07-12 12:27:22 +02:00
Wim Taymans
9f25adc0f6 avb: use spa dll 2022-07-12 12:27:22 +02:00
Wim Taymans
af4875eb47 avb: remove libavtp dependency 2022-07-12 12:27:21 +02:00
Wim Taymans
c79fddf007 avb: handle xruns better
Don't stop early, fill gaps with silence.
2022-07-12 12:27:21 +02:00
Wim Taymans
87053365ea avb: handle sink follower
We need to flush out the packets when we are a follower and when we get
data because our timer is not running as a sink.
2022-07-12 12:27:21 +02:00
Wim Taymans
4d6c71bf12 avb: use iovec to read from ringbuffer 2022-07-12 12:27:21 +02:00
Wim Taymans
5c3629a165 avb: add follower mode
As a follower we disable our own timer and produce a buffer from what we
have when _process is called.
2022-07-12 12:27:21 +02:00
Wim Taymans
ff5201ef3d avb: check seq
Avoid infinite loops.
Check sequence number and warn
Use 32 frames per pdu in example.
2022-07-12 12:27:21 +02:00
Wim Taymans
200f591a3d avb: add source 2022-07-12 12:27:21 +02:00
Wim Taymans
552a0056b5 avb: more work
Handle properties.
Fix format negotiation.
Wait in underrun.
2022-07-12 12:27:21 +02:00
Wim Taymans
537a38355a avb: more work 2022-07-12 12:27:21 +02:00
Wim Taymans
f95b8263e6 avb: more improvements 2022-07-12 12:27:21 +02:00
Wim Taymans
1adc94df11 start of AVB support 2022-07-12 12:27:21 +02:00
Wim Taymans
6a8fd7024e audioconvert: add and use AVX2 clamp macros 2022-07-12 10:45:41 +02:00
Wim Taymans
7745346292 audioconvert: add sse2 s16 dither functions 2022-07-12 10:34:13 +02:00
Wim Taymans
c31928c5f0 audioconvert: add and use CLAMP macros 2022-07-12 10:33:37 +02:00
Wim Taymans
c35006f040 audioconvert: move scaling to setup 2022-07-11 17:50:20 +02:00
Wim Taymans
68f883ff77 audioconvert: fix dither scale
Rectangular dither should be [-0.5, 0.5]
Triangular dither should be [-1.0, 1.0]
Noise should add extra bits.
2022-07-11 17:19:28 +02:00
Wim Taymans
e313149f7f audioconvert: improve SSE2 dither generation 2022-07-11 16:41:12 +02:00
Wim Taymans
277addcca6 audioconvert: add triangular dither 2022-07-11 16:28:51 +02:00
Wim Taymans
9a5a71dda9 tests: add test for noise 2022-07-11 15:49:44 +02:00
Wim Taymans
03f918bf15 udev: prefix vendor.id and product.id with 0x
They are hex strings so prefix them with 0x to make sure they get
handled like that in properties.

Fixes #2527
2022-07-11 11:55:42 +02:00