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)
This commit is contained in:
Julian Bouzas 2020-07-13 13:59:34 -04:00 committed by Wim Taymans
parent 15a4019e45
commit 551844c0ef

View file

@ -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;
}