mirror of
https://github.com/narrrl/proton-stream.git
synced 2026-12-03 20:01:50 +01:00
mpv publishes time-pos and demuxer-cache-time once per video frame, and each reading went to the main thread and rebuilt the whole player: the up-next card and the time left were read in PlayerView's body. The event thread now coalesces those two readings to 4 Hz, as Android polls, holding the latest and sending it when its turn comes even if mpv goes quiet. Any other event sends what is held first, so a reading of the outgoing file still lands before the next one's START_FILE, and resets the pace, so the reading after a seek or a pause is not a beat late. The skip button, the up-next card and the time left are views of their own, so a reading redraws only them. Property reads and writes took the core's lock on the main thread, which the demuxer holds through a block fetch: a track list read on load was seven reads per track. Reads, writes and commands now run in order on a queue of their own (Android's NativeMpvHost keeps them off its UI thread for the same reason). The track and chapter lists land on the main thread unless another file was loaded since, and onLoaded waits for the tracks it reads. load waits for the queue, so a seek queued for the outgoing file cannot land on the new one.