Improve video layer rendering on macOS

Refactored glUpdate to use requestRedraw method for better control. Added needsRedraw flag to prevent redundant display calls. Enabled asynchronous drawing on VideoLayer for improved performance. Modified displayLinkCallback to only report swap without triggering display to avoid flooding the main thread.
This commit is contained in:
Arkadiusz Fal
2025-11-14 20:24:33 +01:00
parent ddf997ee58
commit b88169c7dd
2 changed files with 19 additions and 6 deletions

View File

@@ -666,11 +666,8 @@ final class MPVClient: ObservableObject {
func glUpdate(_ ctx: UnsafeMutableRawPointer?) {
let videoLayer = unsafeBitCast(ctx, to: VideoLayer.self)
videoLayer.client?.queue?.async {
if !videoLayer.isAsynchronous {
videoLayer.display()
}
}
// Request a redraw when MPV signals that new content is available
videoLayer.requestRedraw()
}
#else
func getProcAddress(_: UnsafeMutableRawPointer?, _ name: UnsafePointer<Int8>?) -> UnsafeMutableRawPointer? {