Commit graph

9072 commits

Author SHA1 Message Date
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
Pauli Virtanen
e1cb7c6fb2 bluez5: sco-source: implement sco-source the same way as a2dp-source 2022-07-05 14:21:04 +00:00
Pauli Virtanen
51356ea3d0 bluez5: a2dp-source: separate clock from recv + handle buffering
a2dp-source as driver does not produce regularly spaced graph cycles,
because A2DP is not isochronous. This causes e.g. crackling for alsa
etc. that expect regular timings. It also does not rate match.

Change a2dp-source to trigger graph on regular intervals. Change recv to
only accumulate data to a buffer, and put data to buffers in process().

Rate match with DLL, keeping average buffer level constant.  Keep track
of jitter to determine a safe target value.
2022-07-05 14:21:04 +00:00
Pauli Virtanen
459a1114f1 bluez5: sco-io: we should always read from socket
Not reading from the socket appears to cause messages to pile up to some
limit, which causes problems if we start the source after some point.
2022-07-05 14:21:04 +00:00
Pauli Virtanen
02bdfcb115 bluez5: ad2p-sink: adjust debug log message
timeout -> timer, since "timeout" looks like error to users
2022-07-05 14:21:04 +00:00
Frédéric Danis
036bb13474 audioconvert: Fix s24/u24 byte swapping 2022-07-05 14:06:31 +00:00
Wim Taymans
c4cc13c094 audioconvert: use right scale value
Disable assert, it seems to fail on clang.
2022-07-05 16:02:24 +02:00
Wim Taymans
f62244d7a9 audioconvert: tweak more conversion constants
Tweak some more constants to make lossless conversions work.
Add some tests for lossless conversion.
Add some more tests.
2022-07-05 15:50:05 +02:00
Wim Taymans
22317da685 audioconvert: tweak conversion constants
Tweak the conversion constants a bit so that they handle the
extreme ranges a bit better.
Align the C and vector instructions.
Reactivate the unit test asserts when a conversion fails.
2022-07-05 12:20:02 +02:00
Wim Taymans
e3951cc1f1 audioconvert: fix pack/unpack of s24/u24
Copy the values into the right place in the struct.
2022-07-05 12:18:57 +02:00
Pauli Virtanen
a46d4aedd7 pulse-server: work around race condition in SET_DEFAULT/MOVE_*
The default metadata update may be delayed for some time after
SET_DEFAULT, since the session manager has to work on it.

MOVE_* commands need to know what the client thinks is the current
default sink, so that they can decide between "move to default" and
"move to specific device".

To avoid race condition here, stash the default value set by the client
and use it in the MOVE_* commands, until the metadata update arrives.
2022-07-04 15:57:31 +00:00
Adolfo Rodrigues
6188e4d074 pulse-server: tweak maxlength some more
Make the buffer size at least 4 times as large as the fragment size to avoid
xruns.
2022-07-04 15:56:16 +00:00
Wim Taymans
12bee0edf8 audioconvert: fix channel remapping
Do the channel remapping to the cannonical format when we
deinterleave/interleave instead. Otherwise we would completely skip
the remapping when we have interleaved input.

Fixes #2502, #2490
2022-07-04 17:38:20 +02:00
Wim Taymans
ffedc2d1e8 null-sink: add option to debug memory 2022-07-04 13:38:07 +02:00
Wim Taymans
67f648cc66 audioconvert: handle NAN from window function
The window function can generate NAN, convert those to 0.0.

Fixes #2491
2022-07-03 20:37:48 +02:00
Wim Taymans
8b649c4510 pulse-server: optimize property allocations
Only allocate a new properties object when we actually need to
change something.
2022-07-02 11:27:54 +02:00
Davide Beatrici
a31989b46d pulse-server: add card properties to sinks and sources
To match the original PulseAudio server's behavior.
2022-07-01 19:54:44 +00:00
Wim Taymans
a2521bb3e0 audioconvert: fix draining
When we get something else that a drain status as input, bring us back
to the non-drained state.

When we are draining, don't remove the drained flag on the input
io status. This needs to be cleared by the host when the draining is
finished.

Fixes speaker-test
2022-07-01 21:49:13 +02:00
Wim Taymans
9af9450888 audioconvert: ensure temp buffers are large enough
Ensure that our temporary buffers can hold at least quantum_limit
samples. When no output or input is connected, we can generate up
to a quantum_limit of silence, which requires all the buffers to
be scaled correctly.

Fixes a segfault in mpv.
2022-07-01 15:25:37 +02:00
Wim Taymans
e0b3e06bea audioconvert: remove unused field 2022-07-01 12:40:19 +02:00
Wim Taymans
817d5bd7a4 audioconvert: simplify 24 bits handling
Make a new uint42_t and int24_t type and use that to handle 24 bits
samples. This makes it easier because we can iterate and copy the
structs like other types.
2022-07-01 12:25:58 +02:00
gogogogi
e395f62425 Update Croatian language and pipewire.pot file 2022-06-30 19:18:32 +00:00
Wim Taymans
06b1cf8663 audioconvert: implement (de)interleave with existing functions 2022-06-30 18:24:05 +02:00
Wim Taymans
afd8e8823e audioconvert: use macros to generate code
Most of the outer loops are all the same.
2022-06-30 17:49:44 +02:00
Wim Taymans
3853eba32f 0.3.53 2022-06-30 09:15:01 +02:00
Davide Beatrici
e0731f0ffa pulse-server: map "device.sysfs.path" to "sysfs.path" 2022-06-30 08:41:30 +02:00
Wim Taymans
0d33760b71 spa: leave vendor.id and product.id in hex
There is no reason to store this as anything other than the original
hex string. Especially for compatibility with pulseaudio.

See !1298
2022-06-30 08:38:52 +02:00
Wim Taymans
a44c600ade resample: use cosh window function
Seem to produce a little sharper cutoff.

Fixes #2483
2022-06-29 18:03:40 +02:00
Wim Taymans
9b37142ef6 audioconvert: implement noise shaping
To compare the results:

  pw-cat -r test.wav --format=u8 -P '{ dither.method=none }'

vs:

  pw-cat -r test.wav --format=u8 -P '{ dither.method=shaped5 }'
2022-06-29 17:33:37 +02:00
Wim Taymans
7701786016 audioconvert: demote a debug log to trace_fp 2022-06-29 17:30:04 +02:00
Wim Taymans
d1ee783322 pw-cat: read and write raw formats correctly
We need to transform the number of bytes into frames.
2022-06-29 17:29:16 +02:00
Wim Taymans
0b62cea4f9 audioconvert: use faster noise generator 2022-06-29 14:33:58 +02:00
Wim Taymans
938f2b123e audioconvert: improve format conversion
Make dither noise as a value between -0.5 and 0.5 and add this
to the scaled samples.
For this, we first need to do the scaling and then the CLAMP to
the target depth. This optimizes to the same code but allows us
to avoid under and overflows when we add the dither noise.

Add more dithering methods.

Expose a dither.method property on audioconvert. Disable dither when
the target depth > 16.
2022-06-29 14:10:15 +02:00
Wim Taymans
d23b96b033 audioconvert: fix some compiler warnings 2022-06-29 14:08:30 +02:00
Wim Taymans
0b73fa97d0 audioconvert: use loop for channelmix method enum 2022-06-29 14:05:48 +02:00
Wim Taymans
22d02a7891 audioconvert: dither in 24 bits
This saves some shifts.
2022-06-28 17:15:27 +02:00