mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-11-21 20:00:49 +01:00
With FFmpegKit now loaded on the first Dart call, a download that finalizes before any Dart FFmpeg use is the usual order. The finalizer's complete-callback filter then read a null callback and forwarded to nothing, and the plugin's later registration replaced the filter. If the read and the write straddled the registration, the filter forwarded to null until the process restarted. The plugin now exposes ensureGlobalCallbacksRegistered(), which registers the global callbacks on the calling thread (loading FFmpegKit if needed), waits for a registration already in progress and throws a load failure to its first caller. The background load uses it too, and the finalizer calls it before wrapping, so the filter always wraps the plugin callback and is never replaced. The finalizer runs on worker threads, so the main thread still never waits for the load. The host-JVM main looper stand-in is now a thread named main that the tests post calls through, and replies are checked against it: draining the waiting calls on the loader thread instead of posting them, removing the registration lock, or making the new method a no-op each fail a test. No startup cost change; the ST1 gain is unchanged.