I have a phone running a Snapcast client: it pulls synced audio over Wi-Fi and plays it out to a pair of Bluetooth headphones. It buffered constantly: a few seconds of audio, then a stall, then a reconnect.
The Wi-Fi signal was excellent (RSSI -44), the server was idle, and the same stream played fine elsewhere, so naturally I blamed everything except the obvious thing. Eventually I just pinged the server with Bluetooth on, then turned Bluetooth off and pinged again. Same Wi-Fi network, same location, seconds apart:
# Bluetooth ON (streaming to the headphones)
10 packets transmitted, 8 received, 20% packet loss
rtt min/avg/max/mdev = 8.6/238.6/742.4/254.4 ms
# Bluetooth OFF
10 packets transmitted, 10 received, 0% packet loss
rtt min/avg/max/mdev = 7.4/9.1/10.8/0.9 ms
The only variable was Bluetooth, and it took the link from a flawless 9ms to 238ms average with 20% loss.
The cause is 2.4GHz coexistence. Bluetooth lives in the 2.4GHz band,1 and so did my Wi-Fi. On a phone the two typically share a single radio and antenna,2 so pushing audio out over Bluetooth while pulling audio in over 2.4GHz Wi-Fi means they have to take turns and they trample each other. Snapcast streams real-time PCM with a ~1s buffer;3 with packets arriving 250ms+ late and one in five dropped, the buffer starves and the client gives up and reconnects.
The fix was to get Wi-Fi off the band Bluetooth is squatting on: move the phone to 5GHz. Bluetooth stays on 2.4GHz, Wi-Fi moves up, and they stop fighting.
There was one more gotcha. The 5GHz SSID didn’t even show up in the phone’s Wi-Fi scans as the router had auto-selected channel 104, which phones won’t see. I pinned the router’s 5GHz radio to channel 36 and the problem disappeared entirely:
# 5GHz channel 36, Bluetooth still ON
12 packets transmitted, 12 received, 0% packet loss
rtt min/avg/max/mdev = 8.9/10.3/13.7/1.3 ms
10ms average, 1.3ms jitter, zero loss with Bluetooth doing exactly what it was doing before. The audio has been rock solid since.
Footnotes
-
Bluetooth operates in the 2.4 GHz ISM band (2.400–2.4835 GHz), the same unlicensed band used by 2.4 GHz Wi-Fi. “Improved Spectrum Coexistence in 2.4 GHz ISM Band Using Optimized Chaotic Frequency Hopping for Wi-Fi and Bluetooth Signals”, Sensors (NCBI/PMC). ↩
-
Phones commonly use a combined Wi-Fi/Bluetooth chip that shares a single antenna between the two radios, requiring time-division coexistence so they transmit in alternating time slots rather than simultaneously. “Systems and methods for coexistence between plurality of wireless communications modules sharing single antenna”, US Patent 9,130,605. ↩
-
Snapcast reads PCM chunks from its source and tags them with server time for synchronized playback; its default read/buffer size is 1000 ms. Note that, while it supports an uncompressed
pcmcodec, its default wire codec is FLAC rather than raw PCM. Snapcast README — codecs and buffering. ↩