Skip to content

Fix the ~5 s reopen stall: renderer readiness no longer gated on current-vo - #1004

Merged
Riteshp2001 merged 1 commit into
Riteshp2001:masterfrom
fzs209:pr/fix-reopen-renderer-readiness
Nov 19, 2026
Merged

Riteshp2001 merged 1 commit into
Riteshp2001:masterfrom
fzs209:pr/fix-reopen-renderer-readiness

Conversation

@fzs209

@fzs209 fzs209 commented Nov 19, 2026 •

Copy link
Copy Markdown

Summary

Fixes #1000

Exiting a video and immediately opening the next one can stall for the full ~5 seconds before playback starts. The stall is a circular wait in the surface-binding activation loop:

  • After a video ends, the previous video output is destroyed. While nothing is loaded, no idle event creates a new one, and re-setting the same vo / force-window values is a no-op in mpv's option layer — so current-vo keeps reading back as unset.
  • The activation loop only marked the renderer ready once current-vo read back the requested output, so it could only pass after a load had started.
  • The load path, in turn, waits for the renderer-ready flag before selecting the video track. The loop therefore polled until its 300 × 16 ms budget ran out (~4.8 s) and the timeout fallback let the load through.

The fix makes readiness mean "Surface bound and wid applied": the loop still waits until the window id is observable (read back, unchanged) and the vo / force-window request has been issued, then marks the renderer ready and runs the suspended-track restore and deferred video selection as before — that selection is what makes mpv create the output, and those calls keep their own loaded-generation guards. current-vo is still read at ready time, but only as a log diagnostic. The retry loop and the detach-on-failure path are unchanged, so a bind that genuinely cannot complete still fails and can be retried.

One file: PlaybackSession.kt, +15 −6. (The related core-side asymmetry noted in the issue — placeholder output creation depends on which surface becomes ready first — is context for the intermittency; this PR removes the app-side circular wait that the captured stall shows.)

Validation

Disclosure: the fix and this text were produced with AI assistance; all testing described above was performed by me personally on the real device.

Screenshots or recordings

N/A — no visible UI change; the change removes a stall before playback starts.

Checklist

  • This PR is focused on the described change, with unrelated edits left out.
  • I have recorded validation results and any remaining limitations above.
  • User-facing documentation is updated where applicable. (No user-facing documentation covers this internal readiness logic.)
  • Upstream credits and license notices are preserved for adapted code or assets. (No adapted code or assets.)
  • Logs, screenshots, and code do not expose credentials or private information.
  • I have read the Code of Conduct.

…urrent-vo

Fix for the ~5 s reopen stall. bindSurface's activation loop no longer
requires current-vo to read back the requested output before marking the
renderer ready: when the previous VO was destroyed (video_out == null), no
idle event recreates one and re-setting unchanged vo/force-window values is
a no-op, so the gate could only pass after a load while the load path waited
for it. Readiness is now wid observable (read back, unchanged) plus the
vo/force-window request issued; mpv creates the output on the following
load or video-track selection, whose restore/deferred calls keep their own
loaded-generation guards. current-vo is still logged at ready time as a
diagnostic.
@vercel

vercel Bot commented Nov 19, 2026

Copy link
Copy Markdown

@fzs209 is attempting to deploy a commit to the riteshp2001's projects Team on Vercel.

A member of the Team first needs to authorize it.

@Riteshp2001
Riteshp2001 merged commit 598aafc into Riteshp2001:master Nov 19, 2026
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants