mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-11-21 20:00:49 +01:00
audio_service mapped and encoded the whole play queue for the platform on every queue change, on every platform. Only the Android plugin reads it: the darwin plugin answers setQueue with an empty result, the web plugin and the desktop SMTC and MPRIS sessions are no-ops. With a 20,000-song Shuffle Library queue that is about 10 MB and 60 ms (host JIT) of UI isolate work per change, plus a main-thread decode on iOS and macOS, all of it discarded. _observeQueue now skips the queue off Android, and on Android keeps only the newest queue while a setQueue is in flight. That queue goes out when the in-flight call completes or fails, at the same point the old loop sent its next buffered change, so Android always ends on the latest queue and its order against setMediaItem and setState is kept. An idle change is still sent at once, with the same payload. Host benchmark, 20,000 songs per queue: iOS, macOS and Windows go from one 10.1 MB send (about 61 ms) per change to none; six changes during one Android send go from six sends (60.5 MB, 383 ms) to two (20.2 MB, 128 ms). The patch is recorded in MORNYE_PATCHES.md.