mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-01-26 14:13:19 +00:00
Add heuristic to resync streams if controller packet completion times for different streams differ by too much. This likely indicates controller has lost sync between the streams, and we have to reset playback. There's no way to do this properly. The ISO-over-HCI transport is badly specified in Bluetooth Core Specification. Many controllers have broken implementation of the current send timestamp read command, so packets have no identifiers which ISO interval they belong to. Controllers try to reconstruct the right interval based on manufacturer-specific heuristics probably based on packet arrival times. Kernel + USB introduce timing jitter, and playback sometimes desyncs and packet from some streams are persistently sent some multiple of the SDU interval off from the intended timing. Try to determine this from packet completion latencies. This is somewhat manufacturer specific, tested on Intel & Realtek, hopefully works on others too.