mirror of
https://github.com/yattee/yattee.git
synced 2026-07-20 14:22:02 +00:00
Fix no video on iOS/tvOS devices after GL two-thread hardening
1d9c5e3b removed the main-thread EAGLContext bind from setupAsync so
the context is never left current on two threads. But libmpv's
mpv_render_context_create requires a current GL context on the calling
thread (it probes glGetString(GL_VERSION)), so render context creation
failed with MPV_ERROR_UNSUPPORTED (-18) and every video played with no
--vo ("No render context set") on real iOS/tvOS devices.
Bind the context around the createRenderContext call and unbind right
after. The bind is scoped to setup, before the display link starts and
before any frame is rendered, so the never-left-current invariant that
protects the A10X fence fix (#947/#949) still holds.
Verified on Apple TV 4K (3rd gen): createRenderContext succeeds and
video frames render.
Claude-Session: https://claude.ai/code/session_01UEXP5f6F4S1zLdY8fdVuLJ
This commit is contained in:
@@ -521,8 +521,13 @@ final class MPVRenderView: UIView {
|
||||
}
|
||||
}
|
||||
|
||||
// Create MPV render context with our getProcAddress function
|
||||
// Create MPV render context with our getProcAddress function.
|
||||
// mpv_render_context_create probes GL (glGetString) on the calling thread —
|
||||
// the EAGL context must be current here. Unbind after so it isn't left
|
||||
// current on main (performRender binds it on the render queue per frame).
|
||||
EAGLContext.setCurrent(context)
|
||||
let success = client.createRenderContext(getProcAddress: getProcAddress)
|
||||
EAGLContext.setCurrent(nil)
|
||||
if !success {
|
||||
MPVLogging.warn("setupAsync: failed to create MPV render context")
|
||||
throw MPVRenderError.renderContextFailed(-1)
|
||||
|
||||
Reference in New Issue
Block a user