Commit graph

1567 commits

Author SHA1 Message Date
Wim Taymans
fc9a6d6b1e spa: spa_json_get_string does not return the length
The returned string is null terminated.
2021-03-18 18:57:26 +01:00
Wim Taymans
8e590df92f spa: improve info parsing
Make info parsing a bit easier to read by assigning the key and
value to temporary variables.
Improve the parsing of channelmap using json parser to make it
support more cases.
Add a unit test for channelmap parsing options.
2021-03-18 18:40:56 +01:00
George Kiagiadakis
a75fe69c8e bluez5: emit & remove the A2DP source node depending on transport state
Typically a source stops the connection when it has nothing to play
and this causes the transport to become "idle" and our A2DP source
also stops. However, the node is still present and "running" (if linked),
which causes the graph to underrun as it receives no data from this node.

This patch dynamically creates and destroys the a2dp source node depending
on the transport state. So, when the transport is idle, there is no node
in the graph at all.
2021-03-18 14:34:27 +00:00
Wim Taymans
08f2284eea bluez5: add device.string in properties
See #842
2021-03-18 12:44:09 +01:00
Huang-Huang Bao
d0636875ee bluez5: fix memory leak on device battery path 2021-03-18 08:27:32 +00:00
Huang-Huang Bao
e9adb2844e bluez5: clear obsolete objects also when bluetooth daemon appeared
See #906
2021-03-18 08:24:06 +00:00
Huang-Huang Bao
68677774fc
bluez5: fix reference to already freed spa_bt_device
Fixes #907
2021-03-18 12:09:30 +08:00
Ivan
529f4d318f meson: Fix build without vulkan headers
Some distros ship Vulkan headers separately. In that case dependency
check is passed but build is failing due to the missing headers.
2021-03-17 20:52:20 +02:00
Wim Taymans
14e8073d18 audioconvert: add LFE filter
Use a lowpass filter to generate LFE from the stereo channels.
2021-03-17 11:28:40 +01:00
Wim Taymans
e51cc5b537 channelmix: Prepare for generating LFE channel
Add channelmix.lfe-cutoff property, 0 is disabled
Disable upmix by default
2021-03-17 11:09:19 +01:00
Björn Daase
5913eb098c treewide: fix issues found by codespell 2021-03-16 19:11:25 +00:00
Huang-Huang Bao
75b4c80dc6 bluez5: add logic to fallback to previous behavior if connection info handling is not supportrd by session manager (i.e wireplumber). 2021-03-16 10:31:08 +00:00
Huang-Huang Bao
01df7671d5 bluez5: avoid log spamming on debug log level, use log level 'warn' on hsphfpd or ofono registering fail instead of 'error' 2021-03-16 10:31:08 +00:00
Huang-Huang Bao
374180e211 bluez5: pass per-device settings to codec handler, make 'bluez5.sbc-xq-support' a per-device setting 2021-03-16 10:31:08 +00:00
Huang-Huang Bao
af8272fe08 bluez5: create device handle before profile negotiation started so that profile handler can retrieve per-device settings 2021-03-16 10:31:08 +00:00
Wim Taymans
1b1a3b96ec alsa: improve startup
Start with an extra period of silence.
Reconfigure a new timeout if we are too far off from the desired
buffer fill level. Reduce this level to the maximum error we
tollerate.

With this we use the extra period of silence to reconfigure the
timeout until we are close enough and we can start the dll with a
small error.

See #892
2021-03-16 09:48:12 +01:00
Pauli Virtanen
8f075619b2 bluez5: set volume for both channels when switching HFP -> A2DP
Retain mono volume level set with HFP, for A2DP, in case session manager
fails to restore it.
2021-03-15 23:24:40 +02:00
Pauli Virtanen
c7ad443e03 bluez5: update supported codec list when profiles changed
When A2DP is connected and new device profiles appear, update also
supported codec list.

Fixes missing codec profiles when A2DP is connected late.
2021-03-15 20:47:22 +02:00
Wim Taymans
b07bfd0661 alsa: fix dll handling
Pass the right value for the rate, we need to pass the graph rate.
Don't reduce bandwidth, it is not needed.

Fixes timings for reading the alsa-sequencer.
2021-03-14 21:42:17 +01:00
Wim Taymans
f372de8608 resample: refactor rate match code
Use the same code to start rate matching so that we get the same
results for passthrough.
2021-03-14 20:06:45 +01:00
Wim Taymans
017900575c alsa: don't compensate for resampler delay
Don't try to move closer to the read/write pointers in the ringbuffer
to compensate for the resampler delay. We might not have enough time
anymore to complete a cycle without xruns. The delay is properly
reported in the clock times and should also be reported on the port
latency eventually.
2021-03-14 17:08:04 +01:00
Wim Taymans
17fd38c3a5 channelmix: use front-center matrix values
Use the front-center matrix values to mix left and right.
2021-03-14 15:42:53 +01:00
Wim Taymans
c4e3b5adbc alsa: don't double the resampler delay
The delay of the resampler is what it reports, don't double it.

See #854
2021-03-14 14:13:37 +01:00
Wim Taymans
da5c43fb33 logger: printf \n even when colors disabled 2021-03-13 20:36:23 +01:00
Jan Alexander Steffens (heftig)
6e2f78fffc acp: Check return value of asprintf
Building with `-D c_args="-D_FORTIFY_SOURCE=2"` triggers warnings:

    ../spa/plugins/alsa/acp/acp.c: In function ‘add_pro_profile’:
    ../spa/plugins/alsa/acp/acp.c:298:2: warning: ignoring return value of ‘asprintf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
      298 |  asprintf(&device, "hw:%d", index);
          |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ../spa/plugins/alsa/acp/acp.c:334:4: warning: ignoring return value of ‘asprintf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
      334 |    asprintf(&name, "Mapping pro-output-%d", dev);
          |    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ../spa/plugins/alsa/acp/acp.c:364:4: warning: ignoring return value of ‘asprintf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
      364 |    asprintf(&name, "Mapping pro-input-%d", dev);
          |    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2021-03-13 14:50:42 +00:00
Wim Taymans
a9bf93030e resample: limit input size to max size of empty space
When flushing use the max size of the empty space, not the
max size of the input buffers, which might be larger.
2021-03-13 13:53:41 +01:00
Wim Taymans
801bd98233 audioconvert: use preallocated empty buffer to drain
Avoid calling memset on a large piece of memory when draining
the resampler because it might use up all the allocated time in
our realtime thread. Instead use a prealloced empty buffer.
2021-03-13 12:54:41 +01:00
Huang-Huang Bao
d6be84ddd0
bluez5: close sco socket if bluetooth daemon disappeared
Fixes pipewire/pipewire#853
2021-03-13 19:06:49 +08:00
Dmitry Sharshakov
e2ac16ccbd fix: remove v-battery when device disconnects 2021-03-12 15:45:41 +00:00
Dmitry Sharshakov
a0ac3ac8dd fix: cancel and free battery register pending call 2021-03-12 15:45:41 +00:00
Dmitry Sharshakov
5c9028a94d bluez5-dbus: move battery provider functions, fix ghost batteries 2021-03-12 15:45:41 +00:00
Dmitry Sharshakov
48cc5915fb chore: backend-native: remove unused define 2021-03-12 15:45:41 +00:00
Dmitry Sharshakov
2683c1ef5e backend-native: report battery status to BlueZ 2021-03-12 15:45:41 +00:00
Dmitry Sharshakov
a1ed8aec68 chore: bluez5: move spa_bt_monitor to common header file 2021-03-12 15:45:41 +00:00
Dmitry Sharshakov
0078b3b73e backend-native: get battery status via HFP 2021-03-12 15:45:41 +00:00
Wim Taymans
86cf4ad5a5 audioconvert: keep better track of changed params
Keep all the children param flags around and use those to decide
if something changed. Also don't change the param flag serial when
we are simply adding a listener.

This should reduce the number of param updates, most notably the
PropInfo that was updated along with the Props on volume changes.
2021-03-12 11:10:43 +01:00
Wim Taymans
6562a2ab79 channelmix: clean up param handling
Use defines to access the different params.
Fix the name of the function to emit properties.
2021-03-12 10:36:08 +01:00
Wim Taymans
9cd9339c2a alsa-pcm: only disable IRQ when not batch
For batch devices we want to keep the IRQ so that the pointers are
updated with the period-size. Brings my UMC404HD to 4.8ms roundtrip
times with IRQ at 6 sample and batch enabled.
2021-03-11 18:37:13 +01:00
Wim Taymans
b4cf78b5a6 alsa-pcm: improve debug 2021-03-11 18:34:55 +01:00
Wim Taymans
d63f4234ae channelmix: remap volumes
The volumes set with the properties need to be reordered to match
the volumes of our internal layout.
2021-03-11 11:26:26 +01:00
Thibault Saunier
485bae5eb0 meson: Use feature options everywhere it makes sense 2021-03-10 20:18:34 +00:00
Pauli Virtanen
98bedb3895 bluez5: don't set a2dp codec for source device initial profiles
Source devices don't have the a2dp codec profiles, so don't set a codec
profile as the initial one.
2021-03-10 21:32:01 +02:00
Wim Taymans
4f816c1fb0 loop: never try to block in the thread
When we are calling invoke from the thread, the call will be completed
in the thread and there is no need to block for completion.
2021-03-10 13:01:19 +01:00
Wim Taymans
63a34f4f84 alsa: after XRun, fill with previous threshold
It is possible that the quantum has changed before the xrun and
then we will assume the previous quantum was in the device.
2021-03-09 15:46:44 +01:00
Wim Taymans
aa0e0043d3 alsa: only recompute threshold when quantum changes 2021-03-09 13:21:50 +01:00
Wim Taymans
fc044a37af resample: don't copy too much
When we are in passthrough mode, copy only the min of input and
output size or else we might overread/overwrite.

See #875
2021-03-09 12:47:38 +01:00
Wim Taymans
c0ab4b1b8d bluez5: fix compiler warning 2021-03-09 12:25:20 +01:00
Pauli Virtanen
808b54bc19 bluez5: sco-io: fallback packet size when read size unknown should be even
Reported write MTU is odd for some adapters, which will misalign CVSD
frames, so round fallback value to even.
2021-03-09 08:03:21 +00:00
Wim Taymans
e095105e57 resample: fix passthrough check
Only in passthrough we need to just copy input to output. Otherwise
we need to ask the resampler for the conversion size.
2021-03-09 08:52:43 +01:00
Pauli Virtanen
511bafb436 bluez5: release transports on profile change
SCO transports have timer-delayed release, but they need to be released
immediately when changing profiles to close connections before switching
to A2DP.
2021-03-08 23:42:08 +02:00