mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -05:00
bluez5: sco-source: deal with incomplete CVSD frames
Rarely BT adapter may send CVSD packets with incomplete frames. Ignore such packets, as it's not clear if they contain valid data at all.
This commit is contained in:
parent
54b499b1cf
commit
8f0478a2ce
1 changed files with 9 additions and 0 deletions
|
|
@ -542,6 +542,15 @@ static int sco_source_cb(void *userdata, uint8_t *read_data, int size_read)
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (size_read % port->frame_size != 0) {
|
||||
/* Unaligned data: reception or adapter problem.
|
||||
* Consider the whole packet lost and report.
|
||||
*/
|
||||
spa_log_debug(this->log,
|
||||
"received bad Bluetooth SCO CVSD packet");
|
||||
return 0;
|
||||
}
|
||||
|
||||
packet = spa_bt_decode_buffer_get_write(&port->buffer, &avail);
|
||||
avail = SPA_MIN(avail, (uint32_t)size_read);
|
||||
spa_memmove(packet, read_data, avail);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue