From 551844c0efc1cb8dab27ec6b884667d9ac37d272 Mon Sep 17 00:00:00 2001 From: Julian Bouzas Date: Mon, 13 Jul 2020 13:59:34 -0400 Subject: [PATCH] sco-source: initialize read mtu and read chunks of its size The mtu value returned by the kernel seems to be incorrect, we use the hardcoded value of 48 for now (like bluezalsa) --- spa/plugins/bluez5/sco-source.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/spa/plugins/bluez5/sco-source.c b/spa/plugins/bluez5/sco-source.c index 5d95c9dbd..aab68fea2 100644 --- a/spa/plugins/bluez5/sco-source.c +++ b/spa/plugins/bluez5/sco-source.c @@ -337,7 +337,7 @@ static void sco_on_ready_read(struct spa_source *source) datas = port->current_buffer->buf->datas; /* read */ - size_read = read_data(this, (uint8_t *)datas[0].data + port->ready_offset, datas[0].maxsize); + size_read = read_data(this, (uint8_t *)datas[0].data + port->ready_offset, this->read_mtu); if (size_read < 0) { spa_log_error(this->log, "failed to read data"); goto stop; @@ -1065,6 +1065,15 @@ impl_init(const struct spa_handle_factory *factory, &this->transport_listener, &transport_events, this); this->sock_fd = -1; + /* TODO: For now, we always use an MTU size of 48 bytes like bluezalsa + * because the MTU size returned by the kernel is incorrect (or our + * interpretation of it) */ +#if 0 + this->read_mtu = this->transport->read_mtu; +#else + this->read_mtu = 48; +#endif + return 0; }