bluez5: allow codecs to share endpoints

AVDTP in principle allows 62 endpoints, but in practice it appears some
devices (Samsung Galaxy Buds2 Pro, Redmi Buds 3 Lite, probably others)
fail to connect A2DP when the number is somewhere above 24.  A2DP
connection works when initiated from the Central, but not when the
device itself does it, so these devices are not fully broken.  We should
reduce the number of registered A2DP endpoints to avoid running into
problems with such broken devices.

Some of our source codecs are the same actual codec with the same
configuration, and don't need separate source endpoints.

Allow codecs to not have a registered endpoint (fill_caps == NULL), and
tolerate codecs with the same endpoint name.  In codec switch, keep
track separately which of the codecs with the same endpoint name the
local endpoint is currently associated with.
This commit is contained in:
Pauli Virtanen 2022-10-23 14:05:05 +03:00
parent 99406aefea
commit d94832942e
4 changed files with 100 additions and 52 deletions

View file

@ -459,6 +459,8 @@ struct spa_bt_device_events {
void (*destroy) (void *data);
};
struct media_codec;
struct spa_bt_device {
struct spa_list link;
struct spa_bt_monitor *monitor;
@ -507,9 +509,9 @@ struct spa_bt_device {
const struct spa_dict *settings;
DBusPendingCall *battery_pending_call;
};
struct media_codec;
const struct media_codec *preferred_codec;
};
struct spa_bt_device *spa_bt_device_find(struct spa_bt_monitor *monitor, const char *path);
struct spa_bt_device *spa_bt_device_find_by_address(struct spa_bt_monitor *monitor, const char *remote_address, const char *local_address);