Querying the audio latency of a Bluetooth Headset

Started by Epsicode,

Epsicode

Hello all,

I'm working on a rhythm game that requires precise synchronisation between audio and visuals, and I've implemented a way for the users to manually input the latency values of hardware-induced audio or video delay, so that the game adjusts visuals accordingly.

In case the user is using a Bluetooth audio Headset in A2DP profile, I would love to be able to fetch that latency value automatically, instead of relying on an error-prone human calibration process.

Browsers such as Firefox and Chrome seem to be able to detect that information automatically and properly delay video streams to achieve perfect synchronization (for instance on Youtube and Twitch), however I wasn't able to find any information on how they achieve this feat.

Querying BASS_INFO after initializing BASS (with BASS_DEVICE_LATENCY flag) on the Bluetooth headset returns a "latency" value of 18ms.
However, my own measure of the latency of the headset is around 120ms, which is quite a significant difference!

  • Is there any way for me to retrieve this "true" latency information from the BT device by using BASS?
  • And if not, does anybody know a way to query the hardware driver to request this latency information?

Thanks!