Problem
While playing a library song over AirPlay, the receiver's audio sometimes speeds up or stutters, and a lyric line repeats.
What we found
- Rust bumps the audience stream generation on every BeginLoad, install, resume, pause, seek and clear. It also bumps on audience mode changes and after debounced volume changes.
- The macOS bridge bumps it too. When
externalPlaybackActivegoes from false to true,restartStreamForRouteActivation(src-tauri/src/macos/airplay_bridge.m, around line 2045) setsstreamGeneration + 1. - Each bump attaches a new
AVPlayerItemforaudience-video.m3u8?generation=N. The new item starts at the live edge and drops the sync points. Meanwhile the lyric position keeps following the app's playback position, so the receiver jumps ahead to catch up and replays a line. - A real session logged:
- generation 19→32 within about 2 s, and 42→47 within a few seconds;
- the phase flapping between
waiting_for_videoandwaiting_for_routeevery ~25 ms with no user action; FigBufferedAirPlayOutput err=-17320when the device was selected.
The ~25 ms flapping points at the bridge's route-activation bump, but the log alone doesn't confirm it.
Related
- The audience stream is live HLS (no
#EXT-X-ENDLIST, no duration), so receivers show "Live" for every song. - Separately,
cpal_stream.rsused to rebuild the output stream on every xrun, about every 220 ms. That was fixed onfeat/418-online-sourcesand may have made the audio side worse. Re-test after that lands.
Acceptance
- Pause, resume and seek don't make the receiver re-buffer from the live edge, or they re-sync lyrics and audio without a visible jump.
- Selecting an AirPlay device produces one stable attach, not a burst of generations.