bluez5: backend-ofono: don't do codec probe connections + add wait

Codec probe connections can trigger bad behavior from oFono if done when
device is busy (e.g. at connect), and they might be done at the same
time as A2DP transport is acquired which cannot work.

Also, oFono will not reply to DBus Acquire, if device does not complete
codec negotiation correctly. This is most likely to happen just after
device connect, when it is busy with other stuff (eg A2DP).

Remove codec probe connections altogether: instead, we guess mSBC if
mSBC is enabled and otherwise CVSD. If the guess turns out to be wrong,
which is unlikely (almost all devices have mSBC), we recreate the
transport with correct codec (from main loop, must not be done in
*_acquire because that can destroy nodes + unload the spa libs while
we're being called from there).

To avoid oFono DBus hangs at startup, add delay before marking the
profile connected, enforcing a time difference to A2DP operations.
This commit is contained in:
Pauli Virtanen 2022-03-03 23:32:33 +02:00 committed by Wim Taymans
parent 8026b65caa
commit 24fd273820
3 changed files with 139 additions and 37 deletions

View file

@ -499,6 +499,7 @@ int spa_bt_device_ensure_hfp_codec(struct spa_bt_device *device, unsigned int co
int spa_bt_device_supports_hfp_codec(struct spa_bt_device *device, unsigned int codec);
int spa_bt_device_release_transports(struct spa_bt_device *device);
int spa_bt_device_report_battery_level(struct spa_bt_device *device, uint8_t percentage);
void spa_bt_device_update_last_bluez_action_time(struct spa_bt_device *device);
#define spa_bt_device_emit(d,m,v,...) spa_hook_list_call(&(d)->listener_list, \
struct spa_bt_device_events, \