Commit graph

322 commits

Author SHA1 Message Date
Silviu Florian Barbulescu
e4432190f7 Add broadcast sink support for multiple BISes 2024-05-30 13:37:27 +00:00
Silviu Florian Barbulescu
5be2f5e096 Resolve problems found on review 2024-05-27 16:08:36 +00:00
Barnabás Pőcze
625c0f5784 Apply 1 suggestion(s) to 1 file(s)
Co-authored-by: Barnabás Pőcze <pobrn@protonmail.com>
2024-05-27 16:08:36 +00:00
Silviu Florian Barbulescu
1259829ac3 Remove device and transport for broadcast source on interfaces_removed 2024-05-27 16:08:36 +00:00
Silviu Florian Barbulescu
ab87eba149 Add support for the broadcast source multiple BIS implementation in BlueZ. 2024-05-27 16:08:36 +00:00
Diego Viola
7410755c03 Fix typos
found them with codespell.

Signed-off-by: Diego Viola <diego.viola@gmail.com>
2024-05-22 09:19:34 +02:00
Pauli Virtanen
b94d6e53a1 bluez5: use initial SCO RX wait workaround only for USB controllers
Kernel-provided MTU does not work for USB controllers and the correct
packet size to send can be known currently only from RX. So we are
waiting for RX to get it.

The known problem is USB-specific, we shouldn't need the workaround for
other transport types.

Don't wait for POLLIN for non-USB controllers on connect, but ready
things on POLLOUT as usual.

For non-USB controllers, pick some sensible packet sizes to use
initially, before we switch to same size as for RX.
2024-05-18 13:53:45 +03:00
Silviu Florian Barbulescu
bb1c2c3272 Fix review comments, added METADATA_VALUE_MAX_LEN and removed entry_key in configure_bis. 2024-05-15 08:11:50 +00:00
Pauli Virtanen
345131475c bluez5: cleanup bluez5.bcast_source.config parsing
Also fix doc.
2024-05-15 08:11:50 +00:00
Silviu Florian Barbulescu
44d96ed4b9 bluez: on metadata, parse remove the length field, and deduce the length from the value plus type 2024-05-15 08:11:50 +00:00
Silviu Florian Barbulescu
be3e87f485 Add code to fix problem found at review 2024-05-15 08:11:50 +00:00
Silviu Florian Barbulescu
2bff4a9337 bluez: Configure the BlueZ broadcast source
This is the first draft where the configuration is done based on BIS information loaded from the config file.
2024-05-15 08:11:50 +00:00
Pauli Virtanen
5ae0dfb239 bluez5: bap: determine SDU interval from codec frame duration
BlueZ API as BAP Server gives us the ISO interval, instead of the SDU
interval, in the MediaTransport.QoS.Interval property.  They are not
necessarily the same. What we need is the SDU interval.

The SDU interval is the interval between packets the encoder outputs, so
it is determined by the codec configuration, and for LC3 is equal to the
frame duration.

Add codec method get_interval() that returns the correct interval, and
use it in iso-io.
2024-04-01 19:13:01 +03:00
George Kiagiadakis
ddfe3daa22 bluez: print a nicer warning when the bluez service is not available 2024-03-25 14:54:30 +00:00
Pauli Virtanen
31b387f269 bluez5: add per-device option for BAP unicast stream group ID
Add some option to set manually group IDs of unicast streams
of devices.

Intel controllers don't appear to support more than one group at a time,
but in principle this can be done.
2024-02-21 18:22:38 +02:00
Barnabás Pőcze
0b87144d26 spa: bluez: fix whitespaces 2024-02-05 20:01:21 +01:00
Barnabás Pőcze
4aa2e44796 spa: move dbus helpers out of bluez plugin
The file is moved into a new "include-private" directory. This is done
because otherwise adjustments would have to be made to the list of installed
headers, the way include tests currently work and which files are
used for generating documentation.
2024-02-05 13:03:20 +00:00
Pauli Virtanen
0c434e4821 bluez5: reset A2DP codec shared endpoint status on disconnect 2024-02-04 12:57:31 +02:00
Pauli Virtanen
21392d327f bluez5: lowball fallback delay values
Reduce fallback delay values used when BT device doesn't provide the
information itself.

It may be better to have audio late than early, so use values that are
probably close to or below the delays of majority of headsets.
2024-01-28 18:00:04 +02:00
Pauli Virtanen
08819e3d17 bluez5: indicate to LC3 plugin whether endpoint is sink/duplex
The codec can make use of information on whether the endpoint is sink,
and whether there will be both sink and source configured.
2024-01-23 08:40:46 +00:00
Pauli Virtanen
9474030582 bluez5: determine available BAP profiles from remote endpoints
The PAC profile UUIDs do not appear in the UUID list, but are still
useful to know before SelectProperties.

Set them ahead of time based on the visible remote endpoints.
2024-01-23 08:40:46 +00:00
Pauli Virtanen
8eb1f5aa35 bluez5: pick right codec when multiple ones share the endpoint
The "default" codec is the one with fill_caps != NULL, and should be
picked if we don't know which one we are using.

Fixes showing AAC-ELD as supported when it's not, which happened because
it's ordered before the default AAC in the codec list unlike the other
"shared endpoint" codecs.
2024-01-22 22:38:45 +02:00
Adam Marcus
79ee1eaff0 bluez5: add AAC-ELD codec 2024-01-22 14:04:16 +00:00
Pauli Virtanen
89cdf4f6eb bluez5: move no-HFP fast connect checks to better place
Not waiting for HFP when no HFP backend should be checked via
adapter_connectable_profiles in spa_bt_device_check_profiles where the
relevant logic is.

Cleanup by moving the checks there.
2024-01-16 14:29:01 +00:00
Pauli Virtanen
ea5ff6b3c1 bluez5: more informative warning with unknown transports
Unknown transports visible in DBus usually belong to a different
sound server instance that is talking to BlueZ.

Explain this in the warning message that we log, so that people can more
easily understand why things are not working.
2024-01-14 10:57:56 +00:00
Pauli Virtanen
d487dc0fc6 bluez5: bap: support ChannelAllocation parameter from BlueZ
For multi-ASE configurations, BlueZ does the channel allocation itself,
and passes us the result in the ChannelAllocation parameter.

If it is present, don't do the allocation ourselves but use that value
instead.
2024-01-08 10:09:13 +00:00
Pauli Virtanen
eaea03c26c spa: export log topic enumerations 2024-01-04 10:02:55 +00:00
Pauli Virtanen
f327ed845f bluez5: add some debug to bap-codec-lc3
We don't want to dump on all calls to codec_select_config, so use debug
context.
2023-11-23 17:47:55 +00:00
Pauli Virtanen
43af0645b7 bluez5: set BAP QoS RTN correctly
Set QoS RTN according to values supported by server values.
2023-11-14 22:08:23 +02:00
Pauli Virtanen
b2e58198cc bluez5: make iso_io ISO groups transport-specific
Different BT adapters have separate ISO groups, so we should schedule
them separately.
2023-11-12 18:22:15 +02:00
Silviu Florian Barbulescu
e1fd73da66 Fix set state not seated on linked transport 2023-11-08 10:10:17 +02:00
Pauli Virtanen
b7e863b8cf bluez5: fix logic error in device set leader selection
Fix device set node sometimes not being emitted.

When leader changed it marked no-one as leader, do that in less buggy
way.
2023-10-24 19:45:03 +03:00
Pauli Virtanen
528c7c0f22 bluez5: set BAP Locations/Context endpoint properties
BlueZ now requires endpoints to set Locations/Context, so set them to
some sensible default values. These could in principle be made
configurable later.
2023-10-21 13:38:27 +03:00
Pauli Virtanen
e71cf62b69 bluez5: adapt to further BAP API changes in BlueZ
BlueZ master BAP API is changing, so match our code to that.
2023-10-04 18:36:34 +03:00
Pauli Virtanen
bfcbeccec2 bluez5: adapt to changes in BlueZ BAP API
BlueZ master branch now puts various QoS fields into a separate dict, in
properties and method input and return values.

Adjust our code to match that.
2023-09-30 18:13:30 +00:00
Barnabás Pőcze
436787d6ba treewide: try to use const char * for string literals 2023-09-16 17:47:35 +02:00
Pauli Virtanen
2804a8f1f6 bluez5: minor BAP broadcast fixups
Don't try to deref NULL if adapter not found. Disable bcast reconnect in
simpler way. Use adapter name as device name. Style fixes.
2023-09-13 15:51:50 +00:00
Pauli Virtanen
186b730c9c bluez5: fix device supported codec checks
Make supported codec checks to use profiles, not "is-a-sink" flag, to
determine which codecs can be used.

Fixes bluez5-device checking only source profiles, even when the local
device is only a sink.
2023-09-13 15:51:50 +00:00
Silviu Florian Barbulescu
32084ff3c6 Fix problems found in the review of the broadcast sink support. 2023-08-24 16:31:03 +00:00
Silviu Florian Barbulescu
8660066af6 Add suport for braodcast sink 2023-08-24 16:31:03 +00:00
Silviu Florian Barbulescu
c6760105df Fix problems found in the review. 2023-08-24 16:31:03 +00:00
Silviu Florian Barbulescu
b07bb4e106 Check if the adapter supports bap broadcast before registering the broadcast endpoint. 2023-08-24 16:31:03 +00:00
Silviu Florian Barbulescu
e2fa5537f7 Add support for bluez5.roles for broadcast source. 2023-08-24 16:31:03 +00:00
Silviu Florian Barbulescu
decbeed2c4 Create the fake device with the actual adapter DBus path. 2023-08-24 16:31:03 +00:00
Silviu Florian Barbulescu
ef3fac401d bluez5: Add LE Audio BAP broadcast source support
Once Pipewire is started it will try to register a BAP broadcast source media endpoint on UUID 00001852-0000-1000-8000-00805f9b34fb if the media codec that supports BAP and the adapter indicates LE Audio is supported.
When the endpoint is detected (over DBus) by Pipewire and it has a broadcast sink UUID, a new device will be created with the address 00:00:00:00:00:00. This device will be our simulated remote device. This is done because a broadcast source emitting device does not need any connection to start transmitting the audio. This device is set as connected.
When the SetConfiguration DBus method is called and the spa_bt_transport structure with the profile BAP broadcast source is created we switch the device from the one read from DBus to the one created by us. This is done because in BlueZ, when the transport is created, at the Device property, BlueZ sets the adapter as the device that the transport is connected to. Here the device will have the newly created SPA_BT_PROFILE_BAP_BROADCAST_SINK profile connected.
Added code that allows to create a node in the graph for a device connected to the SPA_BT_PROFILE_BAP_BROADCAST_SINK profile.
2023-08-24 16:31:03 +00:00
Pauli Virtanen
8f6d266632 bluez5: reacquire transport always for playing for A2DP
Some A2DP devices don't like reusing the same transport for different
media-sink instances, possibly because encoder is reset in between and
there can be a gap in transmitted audio.

This doesn't matter for SCO/ISO.
2023-08-18 15:07:01 +00:00
Barnabás Pőcze
4083502e03 spa: bluez: use some more spa_auto* 2023-07-30 13:45:49 +02:00
Barnabás Pőcze
ca85872e83 spa: bluez: use spa_auto for DBusError 2023-07-30 13:45:49 +02:00
Barnabás Pőcze
b52d590936 spa: bluez: add send_with_reply() dbus helper
This function sends a DBusMessage on a DBusConnection
and sets the reply callback of the resulting DBusPendingCall,
as well as properly cancelling the pending call if anything fails.
2023-07-30 13:45:49 +02:00
Barnabás Pőcze
6e581deb91 spa: bluez: use spa_autoptr for DBusMessage 2023-07-30 13:45:49 +02:00