Commit graph

57 commits

Author SHA1 Message Date
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
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
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
Pauli Virtanen
a99f3a90ef bluez5: correct EnumRoute availability
Mark bluez5 routes always available in EnumRoute, because there's always
a device connected.

Fixes default-route resetting profiles back, when they are manually
changed.
2021-03-07 01:37:57 +02:00
Pauli Virtanen
e42261c6d2 bluez5: remove per-device codec filtering
This does not work as intended, because we no longer do a codec switch
on device connect.  It should be done in a different way, but since it's
not used for anything right now, can as well remove it.
2021-03-06 15:19:14 +02:00
Pauli Virtanen
4389e44903 bluez5: emit props change events only if values actually changed
This may avoid infinite loops if parameters are being set based on events
sent by parameter changes. It's also what alsa-acp devices do, so bluez5
should follow.
2021-03-02 23:46:27 +02:00
Wim Taymans
157d423246 bluez5: remove stray route param field
This info is also in the classes field.
2021-03-01 16:55:16 +01:00
Pauli Virtanen
a5dc2493df bluez5: route shouldn't list a2dp profiles when not connected 2021-02-19 21:16:27 +02:00
Wim Taymans
930b411075 bluez5: set the right volumes on the node 2021-02-18 19:25:04 +01:00
Wim Taymans
8c5ca000ef bluez5: volumes need to be distributed to all channels
Otherwise some channels might become silent.

See #741
2021-02-18 17:47:22 +01:00
Pauli Virtanen
d75a79babc bluez5: add delay adjustment property + fallback value for a2dp-sink
Not all devices report their A2DP delay. In those cases, use a fallback
value of 150ms by default.

Make the delay adjustable with a SPA_Prop, and expose it as a part of
the route. Implement the corresponding parts in media-session.
2021-02-18 11:33:45 +00:00
Pauli Virtanen
df1dbee687 bluez5: include a2dp codec profiles in route profiles 2021-02-18 11:33:45 +00:00
Wim Taymans
2908e11a72 bluez5: add mSBC and CVSD codec name to properties
Fixes #666
2021-02-12 17:20:37 +01:00
Pauli Virtanen
beaec3d003 bluez5: set initial profile based on what's connected at startup
Set initial device profile according to what's connected at startup,
rather than having media-session try to set it to A2DP (and fail, if the
profile was not connected, resulting to startup in null profile).

This avoids making a codec switch at device startup (we'll stay with
what BlueZ autoconnected us to, usually the previously used codec).
2021-02-11 11:13:42 +00:00
Pauli Virtanen
e0557e0ca8 bluez5: disable codec switching when in A2DP sink role
Devices that expect pipewire to function as a sink don't seem to like it
switching codecs. Disable codec switching when device is a source.
2021-02-06 18:12:19 +00:00
Pauli Virtanen
0346b477ad bluez5: make routes compatible with default-route
default-route wants to have SPA_PARAM_ROUTE_devices and
card.profile.devices before it will restore routes. Add these
also for bluez5-devices.

Fixes restoring volumes on Bluetooth profile change.
2021-02-03 10:49:30 +00:00
Pauli Virtanen
4d9e9fcc33 bluez5: emit events on profile change and handle them
BlueZ may connect transports long after DEVICE_PROFILE_TRANSPORT_SEC has
passed on already existing devices.  When this occurs, the bluez5
pipewire device should notify that the profile enumeration has changed.

Ignore these events during A2DP codec switch, and handle any changes
when the switch completes.
2021-02-02 09:56:29 +00:00
Pauli Virtanen
5d97351970 bluez5: expose different A2DP codecs as separate profiles
The codecs probably should become a separate param later on, but this
workaround at least makes existing UIs work.
2021-02-02 09:56:29 +00:00
Pauli Virtanen
e860f2bb4e bluez5: basic codec-switching framework 2021-02-02 09:56:29 +00:00
Wim Taymans
7fa1833310 bluez5: use function to get profile name 2021-01-27 20:39:02 +01:00
Wim Taymans
30d568403c bluez5: mark profiles as available 2021-01-25 15:53:36 +01:00
Wim Taymans
26d5fe373e bluez5: fix mute
Actually remember the mute state and use this when reporting our
state.

See #559
2021-01-25 15:21:23 +01:00
Wim Taymans
b3f728b1a0 bluez5: set device.bus to bluetooth 2021-01-25 13:07:31 +01:00
Wim Taymans
1eb9d73814 bluez5: skip routes without a profile 2021-01-22 17:35:27 +01:00
Wim Taymans
4d15df6f24 bluez5: improve device and node properties
Set form factor, name routes based on form factor.
Improve profile names
Make card and node names like pulseaudio, with bt address in them.
Fill in port type in the route info.

Fixes #544
2021-01-10 20:56:27 +01:00
Wim Taymans
e91fbd2721 bluez5: Implement routes
Implement routes on the device. This makes it possible for the
session manager to restore the device volumes.
Use validate_config to get the negotiated channels for the route
volumes.
2021-01-07 18:10:22 +01:00
Wim Taymans
92f4831c9f bluez5: handle NULL profile, don't run the filter on it 2020-12-17 12:25:38 +01:00
Wim Taymans
1934b0adb9 bluez5: add codec name to node 2020-12-14 13:29:12 +01:00
Wim Taymans
dadb3a884d profile: refactor code to make EnumProfile and Profile params
Use the same code to enumerate the profiles and the current profile,
this makes sure we have all info in the Profile param as well and
don't need to do a lookup in the EnumProfile.
2020-08-17 11:08:26 +02:00
Julian Bouzas
c388df1cf3 bluez5: include profile classes when doing enum profile 2020-07-31 10:53:51 +00:00
Wim Taymans
8ad769b943 bluez: improve profile description 2020-07-03 16:25:46 +02:00
Wim Taymans
7778f8d70e bluez5: remove devices correctly
Remember how many devices we emited for the current profile and
remove them all when we switch profile.
2020-07-03 16:12:19 +02:00
Wim Taymans
1091d2eaf1 bluez5: improve profile enumeration 2020-07-03 12:14:00 +02:00
Frédéric Danis
0b970ec965 bluez: Update BT profiles
Only provide high-level A2DP and HSP/HFP profiles in pw.
Expose nodes based on pw profiles and BT profiles available on remote
device.
2020-07-03 11:53:52 +02:00
Wim Taymans
9db240e786 bluez: implement profile on device
Enumerate the available profiles on the device. Make params
visible.

Implement set_profile, only expose the nodes that belong to the
profile.
2020-01-10 13:25:40 +01:00
Wim Taymans
8f3b2b9543 bluez5: implement sync, profile and enum_profile 2020-01-03 13:01:54 +01:00
Wim Taymans
f391353c7f Make interface types a string
This is more in line with wayland and it allows us to create new
interfaces in modules without having to add anything to the type
enum. It also removes some lookups to map type_id to readable
name in debug.
2019-12-19 13:36:04 +01:00
Julian Bouzas
ddd2a97f7e bluez: set bluez profile property when emitting node
We need to expose the bluetooth profile in the nodes so that external
applications know how to handle them.
2019-09-10 10:42:11 +02:00
Julian Bouzas
de031b42b1 bluez: add sco-sink and sco-source nodes 2019-08-01 15:31:54 +02:00
Wim Taymans
0e765de519 props: remove pointers in property values in protocol
Mark pointers in property values with pointer: and remove them
when sending the properties over the wire to avoid errors.
2019-07-11 12:52:55 +02:00
Wim Taymans
6720ded529 names: add standard factory name definitions
Define a set of standard factory names and document what they
contain. This makes it possible to change the implementation by
mapping the factory-name to a different shared library.
2019-06-21 13:31:34 +02:00
Wim Taymans
86dc0496a5 simply use INTERFACE_Loop for the main-loop 2019-06-06 15:20:43 +02:00
Wim Taymans
49ef8f9b5f spa: add keys for properties
Define and document property keys
2019-06-03 16:48:01 +02:00
Wim Taymans
1d1f035e78 monitor: return factory_name in the object_info
Pass a factory_name in the object_info of monitor and device.
Restructure the factory name to mean something functionaly. With
the factory to library mapping this then means that the implementation
of certain factories can be configured in the config file.
2019-05-31 15:06:44 +02:00
Wim Taymans
11393ce9dd bluez: add api to properties 2019-05-30 16:09:56 +02:00
Wim Taymans
c8cbb7e322 bluez5: improve debug 2019-05-30 13:01:15 +02:00
Wim Taymans
ff946e3d4b interface: add an interface struct
The interface struct has the type,version and methods of the
interface.
Make spa interfaces extend from spa_interface and make a
separate structure for the methods.
Pass a generic void* as the first argument of methods, like
we don in PipeWire.
Bundle the methods + implementation in a versioned inteface
and use that to invoke methods. This way we can do version
checks on the methods.
Make resource and proxy interfaces that we can can call. We
can then make the core interfaces independent on proxy/resource and
hide them in the lower layers.
Add add_listener method to methods of core interfaces, just
like SPA.
2019-05-23 12:59:24 +02:00
Wim Taymans
a564d9f3f1 Move implementation helpers to utils 2019-05-20 10:14:00 +02:00
Wim Taymans
6cfddde39c bluez: fix a2dp source
Actually compile the codec config and declare the config as extern
or else it's just all 0.
Only acquire the transport when ACTIVE.
Implement transport state_change signal and acquire the transport
when going to pending/active.
Try to acquire the transport before we expose the device if we
can.
Force device expose when we get the device ServicesResolved=1 property
update.
Free transport when the rfcomm is closed.
Implement various DBus signals to detect dynamic property updates.
2019-05-16 13:18:45 +02:00