Commit graph

9117 commits

Author SHA1 Message Date
Wim Taymans
302bad96a0 tests: add json float check unit test 2022-07-11 12:05:42 +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
Wim Taymans
cbbc4baa3f json: avoid converting random string to floats
Only allow the json float characters when converting to float.
This avoids NAN, INF, 0xffe4 etc to be seen as a json float.
2022-07-11 11:50:58 +02:00
Wim Taymans
bdfde2fdf0 Revert "spa: leave vendor.id and product.id in hex"
This reverts commit 0d33760b71.
2022-07-11 11:23:08 +02:00
Wim Taymans
dd1d5960b4 audioconvert: implement f64s
Add swapping functions for f64s.
Fix the awkward interleave/deinterleave names for 32s.
2022-07-11 10:58:51 +02:00
Wim Taymans
bc1789c3ea Revert "acp: sync with pulseaudio"
This reverts commit 57f0fdf746.

This seems to cause problems and needs to mature a bit more in
pulseaudio it seems.
2022-07-11 10:03:01 +02:00
Wim Taymans
6baf2ede50 filter-chain: add filter-chain.conf
Make a new filter-chain.conf file that contains the boilerplate for
filters.
Suggest that the example filter-chain fragments be copied to the
filter-chain.conf.d/ directory and that filters be run from this
config.
2022-07-11 10:00:46 +02:00
Wim Taymans
8fe83e5304 audiomixer: optimize avx mixer some more
Add avx mixer to test and benchmark
Rework and unroll the avx mixer some more.
The SSE one is 10 times faster than the C one, The AVX is 20 times
faster. The SSE2 function is 5 times faster than the C one.
2022-07-10 23:13:24 +02:00
Wim Taymans
23984f8790 jack: improve mix function
Avoid many reads and writes to temp buffer.
2022-07-10 21:59:05 +02:00
Wim Taymans
7a0445cb28 audiomixer: improve sse and sse2 mixer
Add mixer benchmark.
Improve sse and sse2 mixer function by removin some read/write to the
temporary buffer at the expense of more scattered reads.
2022-07-10 21:15:34 +02:00
Pauli Virtanen
240d212822 pipewire-v4l2: disable _FORTIFY_SOURCE when defining override functions
_FORTIFY_SOURCE defines always_inline versions of open etc. functions,
which conflict with our exported override versions.  Disable it for the
file that defines the override functions.
2022-07-10 16:05:27 +03:00
Wim Taymans
5fbda82cc3 spa: tweak SPA_MIN and SPA_MAX
This generates much better assembler because it can use a cmov in
more cases.
2022-07-09 20:35:47 +02:00
Pauli Virtanen
fe7c6bcef9 bluez5: volume changes from headset should be saved
User changing volume via headset buttons should be treated on the same
level as changing from desktop UI.  Also initial headset volume should
be considered saved (even though session managers currently ignore the
initial route values on route restore).

Mark route as saved on volume events.
2022-07-09 18:19:45 +00:00
Pauli Virtanen
77959a2c1c bluez5: get initial node volume from transport
When emitting node, get initial volumes from transport hardware volume,
if available.

The session manager usually overrides these immediately with saved
values, but it's better to show the HW volume when the node first
appears.
2022-07-09 18:19:45 +00:00
Pauli Virtanen
d82b3d6479 bluez5: backend-native: set HFP/HSP volume when connecting
The HFP/HSP HW volume on the device is not necessarily what we think it
is.

Sync the device volume to our value at connect time.
2022-07-09 18:19:45 +00:00
Pauli Virtanen
276c4bc554 bluez5: use separate routes for HFP and A2DP
The A2DP and HFP profiles may have different volume curves, so trying to
convert volumes between the two can produce undesirable volume spikes.
For example, when one of them is using hardware volume and the other
software.

Fix by separating HFP and A2DP routes.
2022-07-09 18:19:45 +00:00
Wim Taymans
bb2f054d43 tests: add missing file 2022-07-09 20:16:15 +02:00
Wim Taymans
abd6806d71 tests: add sse and sse2 versions to tests 2022-07-09 20:11:46 +02:00
Wim Taymans
371b5a1836 audiomixer: rewrite the mixer functions
Let the mixer functions accumulate the intermediate results into a
larger size variable and then clamp to the final precission. This avoids
distortions because of intermediate clamping.

Although the access pattern of the reads are no longer sequential, the
writes are sequential and we don't need to read intermediate values.
Together with the avoided clamping this is probably faster overall.

Add a unit test for the various cases.
2022-07-09 18:11:13 +02:00
Wim Taymans
3ffb9f4b26 audioconvert: improve s24_32 and u24_32 conversion
We should ignore the upper 8 bits, so first shift them out and then
use the s32/u32 conversion functions.
Add a test for this.
2022-07-09 18:07:49 +02:00
Wim Taymans
20172bfbe6 spa: add comment about prefetch 2022-07-08 17:02:46 +02:00
Wim Taymans
41dd96426c tests: fix clang build 2022-07-08 16:56:48 +02:00
Wim Taymans
ac90a0db13 filter-chain: fix build 2022-07-08 16:38:29 +02:00
Wim Taymans
9861e0f5f5 filter-chain: add mixer sink example 2022-07-08 16:28:50 +02:00
Wim Taymans
3a8275427e tests: wait for the filter node as well
Use the filter state to see when the filter was connected. It needs 2
roundtrips to get the filter to show in the registry.
2022-07-08 16:09:26 +02:00
Wim Taymans
8109f9a42d tests: make a test for ports
Test if adding a port will result in a new Port global.
2022-07-08 15:56:42 +02:00
Wim Taymans
e92e90bd3f tests: add filter unit test 2022-07-08 15:16:41 +02:00
Lucas Holt
4c3f5a7655 When adding MidnightBSD support, I inversed the condition here. 2022-07-08 12:25:58 +02:00
Wim Taymans
a1fac201e3 audioconvert: don't use uninitialized max_out
Move the calculation of the expected max output size before collecting
the buffers and doing the monitor ports so that we can get the size
correct.
2022-07-08 11:31:22 +02:00
Wim Taymans
e53eefef0d stream: implement prefetch
When the audioconverter needs more data, let it return NEED_DATA. This
can happen before the ports actually have consumed all the input data.
For example, then the next cycle would require 1024 samples but there
are currently only 16 samples queued, the next cycle will consume the
16 samples and then need another buffer to produce output.

For rt streams, this is not a problem because a new buffer will be
fetched in the next cycle synchronously.

When the stream is async, we can use this NEED_DATA to prefetch a
new buffer so that we have one in the next cycle.

This fixes hickups with async streams that provide random sized
buffers.
2022-07-08 10:48:29 +02:00
Wim Taymans
9714ce83d4 audioconvert: only consume what is needed
Move the setup of the output buffers first.
Then figure out how many samples we need to produce and consume.
Make sure we use the resampler to only convert the input samples that
are needed to produce the output samples.

Fixes some muddled sound with mpv when upmixing.
2022-07-08 10:45:44 +02:00
Wim Taymans
7b01068837 audioconvert: consume right amount of input samples
When we are not using the resampler, we consume the same amount of
input samples as output samples.

Fixes #2519
2022-07-08 09:23:31 +02:00
Wim Taymans
df40c9bf6a fmt-ops: express 32 bits formats in terms of 32_24 bits formats 2022-07-07 20:11:08 +02:00
Wim Taymans
ea3a81dc29 raop-sink: fix some compilation errors 2022-07-07 19:56:55 +02:00
Wim Taymans
0343e0da73 fmt-ops: fix some missing shifts and min/max 2022-07-07 18:57:03 +02:00
Wim Taymans
b8a4bf880f audioconvert: use 24 bits for 32 formats
The float only preserves 24 bits so use this. Otherwise we get overflows
and errors in clang.
2022-07-07 18:38:32 +02:00
Wim Taymans
43b964ea26 stream: improve process callback
When we are running non-rt and we just dequeued a buffer, check if the
queue is empty and we need to call process to queue a new buffer. We can
only do this when there is an empty buffer to dequeue.

Don't try to request a new buffer immediately when we are rate_matching
because we want the peer to first process the newly dequeued buffer and
update the rate match.

This makes pw-midiplay work again. Previously it was only requesting a
buffer every other cycle.
2022-07-07 16:17:56 +02:00
Wim Taymans
a293e079d1 stream: don't crash when there is no io_rate 2022-07-07 15:56:25 +02:00
Wim Taymans
4da583a44b raop-sink: reuse timing packet send
Use send() instead of write(), use sendto() for the packets so that we
can specify a destination.
2022-07-07 14:00:38 +02:00
Christian Glombek
2c8d25b4dc module-raop-sink: Reply on timing socket earlier
Some AirPlay 2 devices require responding on the UDP timing port
right after sending the SETUP request.
2022-07-07 11:20:39 +00:00
Davis Davalos-DeLosh
eb3c2f3e95 module-raop: Add support for auth_setup
This step is required by some devices.

Co-authored-by: Christian Glombek <lorbus@fedoraproject.org>
2022-07-07 11:20:39 +00:00
Wim Taymans
f9660f5e8f audiomixer: clean up mixer functions
Use the same limits as the format converter.
Use a struct for 24bits.
Use macros to generate the mixers.
2022-07-07 13:12:50 +02:00
Wim Taymans
4a82cb74e8 resample: switch to cosh window function 2022-07-07 12:26:45 +02:00
Wim Taymans
57f0fdf746 acp: sync with pulseaudio 2022-07-07 12:23:28 +02:00
Wim Taymans
752afa06a2 0.3.54 2022-07-07 10:19:55 +02:00
Wim Taymans
273c95d71b resample: tweak cosh parameter, this look really good 2022-07-07 10:18:52 +02:00
Wim Taymans
74bed47a56 audioconvert: don't leak converter data 2022-07-06 21:06:55 +02:00
Wim Taymans
08d918432f tests: add more audioconvert remap test
Add tests for all permutations of input/output remappings.
2022-07-06 20:57:04 +02:00
Wim Taymans
4036b8a3f0 tests: add audioconvert test
Add a little test framework for writing end-to-end audioconvert tests.
2022-07-06 19:20:16 +02:00
Pauli Virtanen
df2c5d6a14 alsa: fix uninitialized variable 2022-07-06 14:36:22 +00:00