Commit graph

3942 commits

Author SHA1 Message Date
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
George Kiagiadakis
e02eedb5a7 bluez5: README-Telephony: document ofono service compatibility 2025-02-05 08:50:24 +00:00
Frédéric Danis
613021137c bluez: native-backend: Handle AT commands replies for HFP HF 2025-02-05 08:50:24 +00:00
Frédéric Danis
18c447b0a4 bluez: native-backend: Add three-way call handling support in HFP HF 2025-02-05 08:50:24 +00:00
Frédéric Danis
224f6a10f5 bluez: native-backend: Add call support in HFP HF
This commit implements the dial, answer and hangup callbacks to manage
call when connected to HFP AG device.
This adds +CLIP support to be able to get remote party phone number.
2025-02-05 08:50:24 +00:00
George Kiagiadakis
5dacd77866 bluez5: telephony: make the call list public 2025-02-05 08:50:24 +00:00
George Kiagiadakis
a501c887ea bluez5: telephony: ensure NULL strings are converted to "" on D-Bus properties 2025-02-05 08:50:24 +00:00
George Kiagiadakis
6534b58d3b bluez5: telephony: add user_data space on the AG & Call structures
This is mostly useful to store the spa_hook for the event listener
2025-02-05 08:50:24 +00:00
George Kiagiadakis
a7f7e65b92 bluez5: initialize telephony service in backend-native 2025-02-05 08:50:24 +00:00
George Kiagiadakis
b28399ac57 bluez5: add telephony D-Bus service implementation 2025-02-05 08:50:24 +00:00
George Kiagiadakis
16c4cd05a9 bluez5: initial telephony service API documentation 2025-02-05 08:50:24 +00:00
Barnabás Pőcze
1e09827953 spa: libcamera: don't use fixed size buffers for properties
Use `std::string` and `std::ostringstream` when processing the
camera properties, in order to avoid truncation.

See !2095
See !2268
2025-02-03 17:20:25 +00:00
Barnabás Pőcze
41045c5e61 spa: libcamera: use references when getting camera properties
The argument is not nullable, so use a const lvalue reference
to express that clearly.
2025-02-03 17:20:25 +00:00
Wim Taymans
5e6b77cf1e spa-resample: improve output format selection
Setting a format does not automatically mean making a wav file.

Instead, check for the extension on the output file name and when we
can't find any good containet, use the same as the input file.

This makes more sense than doing `spa-resample test.flac -r 44100 test.wav`
and ending up with a FLAC file named test.wav. Or
`spa-resample test.flac -r 44100 -f s16 test2.flac` and ending up with a
wav file named test2.flac.
2025-01-31 09:24:08 +01:00
Wim Taymans
110d8572c0 audioadapter: fix EnumPortConfig without converter
If we don't have a converter, we always work in passthrough mode and
EnumPortConfig can use the same code as PortConfig in all cases.

See !2265
2025-01-28 12:39:31 +01:00
Michael Tretter
0814bafef1 videoadapter: fix EnumPortConfig for adapter without converter
The videoadapter always exposes the EnumPortConfig parameter. If no
converter is loaded, the EnumPortConfig parameter doesn't return a
parameter.

In this case, the client-node in the PipeWire server returns -ENOENT for
the EnumPortConfig, which in turn causes WirePlumber to fail the object
activation and it won't be able to create a link for the object.

This happens since Commit b57375ba85 ("stream: enable videoadapter in
all cases"), since now the videoadapter is always added. Before that,
the EnumPortConfig parameter was just not exposed and linking worked.

Running another client that ignores the error codes for missing
parameters (e.g., pw-dump) hides the issue, as the EnumPortConfig result
is cached as successful with 0 parameters and accessing the cache
doesn't return an error code.

Return the same PortConfig for EnumPortConfig as for PortConfig to fix
this.
2025-01-28 11:38:08 +00:00
Sanchayan Maity
ab5f81b9a4 bluez5: g722: Make sequence number handling consistent with other codecs 2025-01-27 18:43:24 +05:30
Sanchayan Maity
23ae55015d bluez5-dbus: Do not setup ASHA profile for unconnected devices
Do not add/connect the profile for unconnected devices.

This fixes the issue where a previously paired ASHA device
would show up in the pavucontrol output device list even
when not connected.
2025-01-27 09:22:41 +00:00
Wim Taymans
ce31e66fb7 audioadapter: only add/remove port when passthrough changed
We only need to switch between the converter ports and the follower port
when we switch between passthrough. Avoid emiting remove of the (non
existing) follower ports when the mode changes from none to DSP at startup.
2025-01-27 10:20:55 +01:00
Arun Raghavan
43f148677e spa: audioadapter: Enum follower formats first in convert mode 2025-01-26 18:58:36 -05:00
Arun Raghavan
beb81e8f4e spa: audioadapter: Explicitly track port mode
Will be useful for convert-mode-specific EnumFormats.
2025-01-26 18:52:51 -05:00