[Airplay] Stereo image is not stable
- PipeWire version (
pipewire --version
): master 1daae4c3 - Distribution and distribution version (
PRETTY_NAME
from/etc/os-release
): Arch Linux - Desktop Environment: Sway no Xwayland
- Kernel version (
uname -r
): 6.4.8-arch1-1
Description of Problem:
The stereo image drifts when using two HomePods as a stereo pair.
Do we need something like this to coordinate the streams?
https://github.com/philippe44/libraop/blob/master/src/raop_client.c
--- timestamps (ts), millisecond (ms) and network time protocol (ntp) ---
NTP is starting Jan 1900 (EPOCH) made of 32 high bits (seconds) and 32
low bits (fraction).
The player needs timestamp that increment by one for every sample (44100/s), so
we created a "absolute" timestamp that is direcly based on NTP: it has the same
"origin" for time.
- TS = NTP * sample_rate / 2^32 (TS fits in 64bits no matter what)
- NTP = TS * 2^32 / sample_rate
Because sample_rate is less than 16 bits, then TS always have the highest 16
bits available, so this gives, with proper rounding and avoiding overflow:
- TS = ((NTP >> 16) * sample_rate) >> 16
- NTP = ((TS << 16) / sample_rate) << 16
If we want to use a more convenient millisecond base, it must be derived from
the same NTP and if we want to use only a 32 bits value, raopcl_time32_to_ntp()
do the "guess" of a 32 bits ms counter into a proper NTP
How Reproducible:
Always
Steps to Reproduce:
- Set up two HomePods as a stereo pair
- Play mono test tone
Actual Results:
Mono sounds drift left and right
Expected Results:
Mono sounds should be centered and stable.