Commit graph

9207 commits

Author SHA1 Message Date
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
Pauli Virtanen
167537dffc pulse-server: fix warning
The rest of the fields are zeroed later in reply_create_record_stream,
but static analysis doesn't know that.
2022-07-06 14:36:22 +00:00
Pauli Virtanen
783fbc507b bluez5: fix minor error handling/warning issues 2022-07-06 14:36:22 +00:00
Wim Taymans
84d2b2ce3a audioconvert: optimize remapping paths
Remove the redundant remap array.
First set up the array with remapped output pointers in case we
can do passthrough output. Make sure stages write to the remapped
array in passthrough.
Remap the input array after unpack/convert.
This avoid an input and output memcpy in the common case of
remapping.
2022-07-06 15:20:13 +02:00
Wim Taymans
565c385228 alsa: add lock around sw_params
The stream and data is protected with the lock.
2022-07-06 13:46:54 +02:00
Wim Taymans
0b351aab99 audioconvert: use blackman window again
I'm not convinced the cosh window is better and it causes some weird
nan numbers in some cases.

See #2483
2022-07-06 09:57:52 +02:00
Wim Taymans
a4f6598f47 dsdfile: support DSD128/256/512 as well
We need to scale the number of samples to read from the file depending
on the bitrate.

Fixes #2508
2022-07-06 09:27:38 +02:00
Wim Taymans
76350cebef audioconvert: fix PROP_INFO
The description needs to be set. The name is the unique name of the
property and the id the predefined property id.

Fixes #2488
2022-07-05 20:41:01 +02:00
Carlos Rafael Giani
7e44909741 alsa: add lower rate bound for DSD playback
This prevents errors when trying to play at a rate
that's lower than DSD64 (the lowest rate available).
2022-07-05 16:56:50 +00:00
Wim Taymans
651f4af0ae audioadapter: ask more data when converter empty
When we are actively driving the stream and the converter needs more
data, call the stream process function again to get it so that we
don't underrun.

Fixes #2494
2022-07-05 17:54:44 +02:00
Wim Taymans
987784b629 tests: add test for s24/u24 swap 2022-07-05 16:34:22 +02:00