bluez5: rework sco i/o + autodetect mtu

Move SCO polling to a single place, and abstract mtu handling.
Autodetect suitable tx packet size based on rx, instead of relying on
the kernel providing correct values.
This commit is contained in:
Pauli Virtanen 2020-12-23 15:10:04 +02:00
parent 518365e350
commit 368182d963
9 changed files with 423 additions and 79 deletions

View file

@ -701,6 +701,7 @@ struct spa_bt_transport *spa_bt_transport_create(struct spa_bt_monitor *monitor,
t->monitor = monitor;
t->path = path;
t->fd = -1;
t->sco_io = NULL;
t->user_data = SPA_MEMBER(t, sizeof(struct spa_bt_transport), void);
spa_hook_list_init(&t->listener_list);
@ -731,6 +732,11 @@ void spa_bt_transport_free(struct spa_bt_transport *transport)
spa_bt_transport_emit_destroy(transport);
if (transport->sco_io) {
spa_bt_sco_io_destroy(transport->sco_io);
transport->sco_io = NULL;
}
spa_bt_transport_destroy(transport);
if (transport->fd >= 0) {
@ -792,6 +798,16 @@ int spa_bt_transport_release(struct spa_bt_transport *transport)
return res;
}
void spa_bt_transport_ensure_sco_io(struct spa_bt_transport *t, struct spa_loop *data_loop)
{
if (t->sco_io == NULL) {
t->sco_io = spa_bt_sco_io_create(data_loop,
t->fd,
t->read_mtu,
t->write_mtu);
}
}
static int transport_update_props(struct spa_bt_transport *transport,
DBusMessageIter *props_iter,
DBusMessageIter *invalidated_iter)