Commit graph

4758 commits

Author SHA1 Message Date
Pauli Virtanen
ba3a36b3d1 spa: acp: allow also too few channels in SplitPCM configs
GoXLR Mini has different numbers of channels actually available (21, 23,
or 25) depending on its firmware/etc, but its UCM profile specifies
always 23. The count can then be bigger or smaller than what is actually
available.

Fail a bit more gracefully in the case of too few channels: create all
the split devices specified by the profile. The channels that aren't
actually available in HW just won't get routed anywhere.

ALSA upstream IIUC is saying that the channel counts should be fixed, so
spew warnings that say the UCM profiles are wrong if they look wrong.
2025-03-14 10:16:05 +01:00
Wim Taymans
b4d88143da alsa-seq: fix UMP output
We need to set the UMP flag, which is done with
snd_seq_ev_set_ump_data() to make it output the midi data.
2025-03-11 13:30:37 +01:00
Wim Taymans
15e200846a alsa-seq: avoid uninitialized warning 2025-03-11 12:32:28 +01:00
Wim Taymans
f4417f4e2c audioconvert: remove some unused fields 2025-03-11 12:27:36 +01:00
Wim Taymans
edffc87ebf audioconvert: configure resample channels correctly
Depending on the direction of the conversion, we run the resampler
before or after the channelmix. This means we need to use the channel
count before or after the channelmixer instead of always using the
channels after channelmixing.

Fixes #4595
2025-03-11 12:27:33 +01:00
Pauli Virtanen
f7b1ba2a40 spa: avoid casting between snd_seq_event_t & snd_seq_ump_event_t
Although the two structs have same initial sequence, it's not really
correct to cast between their pointers. Alsa-lib also does this only
internally, but not in API.
2025-03-11 12:27:29 +01:00
Pauli Virtanen
4f077e1f27 spa: fix ALSA UMP support detection in meson 2025-03-11 12:27:25 +01:00
Pauli Virtanen
2167945eff spa: alsa: support also MIDI-1.0 IO for ALSA seq
Support also non-UMP IO with ALSA seq, in case either alsa-lib or the
kernel does not have UMP enabled.

Add configuration option "api.alsa.seq.ump" for optionally turning UMP
I/O off, for easier debugging.
2025-03-11 12:27:21 +01:00
Nikolay Borodin
2397a984f7 spa: alsa: allow building without UMP in libalsa
Allow building with older libalsa releases that don't have UMP.
2025-03-11 12:27:18 +01:00
Pauli Virtanen
06438cbc9a spa: acp: make spa-acp-tool debug output easier to read
Include log level, file/line numbers, and indent messages for debug
levels.
2025-03-10 09:24:29 +01:00
Pauli Virtanen
ae16463c3c spa: acp: be more noisy when UCM profiles fail to be supported
Generally ALSA UCM profiles should all work as they're supposed to be
device-specific, so be more noisy when the profile fails to be supported
due to the PCM device failing to open.

Some logging on the probe outcome in failure case also makes
spa-acp-tool etc. log output easier to read.
2025-03-10 09:24:26 +01:00
Pauli Virtanen
78981a8d9b spa: acp: in SplitPCM probe channel count and allow excess
In SplitPCM mode, Focusrite Scarlett Gen 4 (USB 1235:8218) UCM profile
specifies "CaptureChannels 2" for the Mic1/2 inputs, but
snd_pcm_hw_params_set_channels(2) fails for the HW device.

Fix by not requiring the channel count to be exact for SplitPCM, but
also allow larger numbers of channels than what UCM profile specifies.
2025-03-10 09:24:23 +01:00
Frédéric Danis
5c1be35018 bluez5: backend-native: Fix 3way active call hangup
HFP/HF/TWC/BV-03-C test, which setup an active and a held calls,
expects to receive AT+CHLD=1 (release and swap calls) instead of
AT+CHUP on active call hang up request.

As this changes the active call to disconnected and held call to
being active, the call states should be managed in hfp_hf_hangup
instead of waiting for +CIEV (callheld=0) event which will drop
the previously held call before AT+CLCC reply can inform this call
is now active.
2025-03-10 09:24:13 +01:00
Frédéric Danis
79d232c1f2 bluez5: backend-native: Fix incoming call crash
HFP/HF/TWC/BV-01-C test creates an incoming call as soon as the SLC is
completed, i.e. a +CIEV: <callsetup>,1 event just after AT+CHLD=? reply
has been received. This try to parse the rfcomm->telephony_ag->call_list
which has not yet been created.

This commit move the telephony_ag creation to the SLC completed event.
2025-03-10 09:24:10 +01:00
Frédéric Danis
277b80c903 bluez5: backend-native: Fix ECNR support in HFP HF SDP record
Sending AT+ECNR is supported by the native backend
2025-03-10 09:24:07 +01:00
Wim Taymans
4e63717e77 spa: fix device.profile key 2025-03-06 13:11:38 +01:00
George Kiagiadakis
491fb26f18 bluez5: backend-native: fix parsing +CLCC response with optional number
The format is: <idx>,<dir>,<status>,<mode>,<mpty>[,<number>,<type>]
so the response can be considered parsed when mpty is read.
2025-03-04 08:29:30 +00:00
Stefan Ursella
fb7c37aeb4 alsa-pcm: recognize headroom to calculate max_error and max_resync 2025-03-03 12:26:05 +01:00
Wim Taymans
54836736b0 pod: avoid use-after-free error because of reallocation
When the pod to filter is in the target builder memory and reallocation
is needed, make sure we refer to the filter in the reallocated memory
instead of the old freed memory.

Fixes #4445
2025-02-25 13:18:37 +01:00
Wim Taymans
c6de17c9b4 spa: improve introspection 2025-02-19 18:07:54 +01:00
Pauli Virtanen
8cd8138cc8 bluez5: specify node.latency at node rate
Avoid some potential rounding-down-to-power-of-2 by specifying the
wanted latency at the samplerate of the stream. Also looks nicer in
pw-top.
2025-02-17 19:42:56 +02:00
Pauli Virtanen
75243b7b02 bluez5: set node.rate for output streams
As AG, set node.rate for output streams that originate from remote
source, so that graph switches rate as needed.  This follows what
pipewire-pulse etc. do.

The patch is by Wim.
2025-02-14 19:59:50 +02:00
Sanchayan Maity
dbed1bdf3d bluez5: asha-codec-g722: Drop the dependency on FFmpeg
We use the G722 encoder from Android itself and drop
the dependency on FFmpeg/libav.
2025-02-13 19:55:18 +05:30
Wim Taymans
98b6469b88 audioconvert: handle rate_scale in both directions
We need to take the direction of the conversion into account when
deciding if we should apply rate scaling.
2025-02-11 11:58:55 +01:00
Joakim Tjernlund
c374aaca5b 90-pipewire-alsa.rules: Check firewire before pci
Fixes #4528
2025-02-07 16:43:52 +01:00
George Kiagiadakis
48fb960274 bluez5: backend-native: fix erroneous goto
In this error condition, execution is supposed to return immediately
because rfcomm is no longer valid. However, the code was incorrectly
changed to jump to the done label, which would try to use rfcomm
again to process pending commands.
2025-02-07 13:14:59 +02:00
Frédéric Danis
62645214a7 bluez5: telephony: Postpone AT commands if one is already in progress
To be sure that the AG reply correspond to the command sent, this
postpone the new command if previous reply (OK, ERROR or +CME) has
not yet been received.
The postponed command is sent on reception of the reply.
2025-02-06 17:25:17 +01:00
Frédéric Danis
fc45aba032 bluez5: telephony: Add configuration to disable NR/EC
This allows to disable the Noise Reduction and Echo Cancellation
on the Audio Gateway.
2025-02-06 17:25:12 +01:00
Frédéric Danis
b7c00e2f24 bluez5: telephony: Add CMEE support 2025-02-06 17:24:42 +01:00
Wim Taymans
4d502cb470 bluez: org.freedesktop.PipeWire -> org.pipewire
We have our own domain name.
2025-02-05 10:18:17 +01:00
George Kiagiadakis
b8e202f02e bluez5: telephony: add call transfer with user interaction capability
This allows implementing UI mechanisms to transfer the audio of a call
to the HF (pipewire) only when the user explicitly asks/allows it.

Normally, when a call is connected, the phone initiates a SCO connection
and the HF accepts it, transfering audio automatically. In order to
allow for user interaction, this patch enables the UI to set the RejectSCO
property to 'true' in order to automatically reject the SCO connection.
Later on, at the UI's discression, the audio may be reconnected by calling
the Activate() method, which sends AT+BCC to re-initialize the SCO channel.

A configuration file option is also added to configure the default value
of the RejectSCO property. By setting this to 'true' in the config file,
it is possible to implement rejecting the audio of a call that is already
active at the time the Bluetooth connection to the phone initializes.
2025-02-05 08:50:24 +00:00
George Kiagiadakis
7de0419ca3 bluez5: telephony: add Address property on the AudioGateway interface
This allows associating the AG with a remote device on higher level
software.
2025-02-05 08:50:24 +00:00
Frédéric Danis
a0356cf4ae bluez5: backend-native: Fix parsing of +CLCC event for PTS
PTS 8.7.3 Build 6 send +CLCC events without space after '+CLCC:'
Found with PTS test HFP/HF/ICA/BV-04-C
2025-02-05 08:50:24 +00:00
Frédéric Danis
99fa7efc2c bluez5: backend-native: Add eSCO S4 feature.
eSCO S4 feature is mandatory since HFP 1.7.
Found with PTS test HFP/HF/SLC/BV-03-C.
2025-02-05 08:50:24 +00:00
George Kiagiadakis
abd96e592b bluez5: telephony: improve +CLCC parsing
Make sure we don't crash or do anything stupid if the incoming
command is malformed
2025-02-05 08:50:24 +00:00
George Kiagiadakis
9d1862a6f8 bluez5: telephony: use spa_callbacks instead of spa_hook_list 2025-02-05 08:50:24 +00:00
Frédéric Danis
627515f641 bluez5: backend-native: Check current calls on SLC completion
This allows to create the calls existing before the HFP connection.
2025-02-05 08:50:24 +00:00
George Kiagiadakis
63e1c48c8b bluez5: telephony: report transport codec & state on D-Bus
This is useful for implementations that do hardware offloading of the
SCO audio channel and need to communicate state information to the
hardware (at least).
2025-02-05 08:50:24 +00:00
George Kiagiadakis
dc5b85fe57 bluez5: backend-native: fallthrough to report volume instead of duplicating code 2025-02-05 08:50:24 +00:00
Frédéric Danis
bd5de6eb1c bluez5: backend-native: Manage 3way commands asynchronously
The call's states should not be updated on 3ways commands but wait for
CIEV or CLCC events.
This allows to manage user actions on the phone.
2025-02-05 08:50:24 +00:00
Frédéric Danis
8e7a1a5235 bluez5: telephony: Do not return call objects in CreateMultiparty
The call's state updates are asynchronous, and even if AT+CHLD=3
returns OK the network may not create the multiparty.
2025-02-05 08:50:24 +00:00
Frédéric Danis
9f37ab25f5 bluez5: backend-native: Destroy only active calls on +CIEV:(call,0) 2025-02-05 08:50:24 +00:00
Frédéric Danis
056c2dd535 bluez5: backend-native: Create call on +CLCC event if supported
Wait for +CLCC event to create the call so the remote phone number can
be set.
2025-02-05 08:50:24 +00:00
Frédéric Danis
f5e08677a2 bluez5: backend-native: add CLCC support
Start call id at 1 as for the index calls in HFP, and move this id
to spa_bt_telephony_[ag|call] so they can be used by CLCC to retrieve
the related call.

if enhanced call status is supported, send AT+CLCC on +CIEV events to
get the calls information.
2025-02-05 08:50:24 +00:00
Frédéric Danis
a8363ff92b bluez5: backend-native: Fix dialing call-setup management
The call should be created if it is started from the phone, i.e. if it
doesn't yet exist.
2025-02-05 08:50:24 +00:00
Frédéric Danis
ffb19547b0 bluez5: backend-native: Fix supported HF features
The HF should declare the features supported before trying to send
related AT commands.
It should only send AT+CHLD related commands if the remote AG supports
them.
2025-02-05 08:50:24 +00:00
George Kiagiadakis
37fb79b9b8 bluez5: backend-native: hangup held/active calls respectively only if they exist
On some phones (at least), sending AT+CHLD=0 while there is no held
call returns an error. Make sure we don't do this to avoid returning
an error on D-Bus when in fact hangup_all actually succeeds.
2025-02-05 08:50:24 +00:00
George Kiagiadakis
a2fc92ee69 bluez5: backend-native: allow hanging up DIALING/ALERTING calls 2025-02-05 08:50:24 +00:00
George Kiagiadakis
03ab9dd771 bluez5: telephony: implement error reporting from all methods 2025-02-05 08:50:24 +00:00
George Kiagiadakis
159846d226 bluez5: telephony: implement ofono compatibility 2025-02-05 08:50:24 +00:00