mac/common: render first frame on init if possible
since commit 5010c24 the initial window always shows a black frame
instead of the actual first rendered frame of the video, since the
visibility of the window for the initial render is always false. in the
worst case the first shown frame wasn't the intended first rendered
frame.
to prevent this, initial always allow rendering till the window is shown
or minimised. afterwards it will respect the occlusion state as before.
in the case of slow render pipeline initialisation and no frame being
ready to be rendered, it will still show a black frame.
This commit is contained in:
1 parent
78458a55ef
commit
0f910ec51c
3 files changed
+17
-1
No files matched your search
@@ -43,6 +43,7 @@ class Common: NSObject {
|
||||
var appNotificationObservers: [NSObjectProtocol] = []
|
||||
|
||||
var cursorVisibilityWanted: Bool = true
|
||||
var needsInitialDraw: Bool = true
|
||||
|
||||
var title: String = "mpv" {
|
||||
didSet { if let window = window { window.title = title } }
|
||||
@@ -471,6 +472,14 @@ class Common: NSObject {
|
||||
}
|
||||
}
|
||||
|
||||
func windowDidMiniaturize() {
|
||||
needsInitialDraw = false
|
||||
}
|
||||
|
||||
func windowDidBecomeMain() {
|
||||
needsInitialDraw = false
|
||||
}
|
||||
|
||||
func windowDidEndAnimation() {}
|
||||
func windowSetToFullScreen() {}
|
||||
func windowSetToWindow() {}
|
||||
|
||||
@@ -558,6 +558,7 @@ class Window: NSWindow, NSWindowDelegate {
|
||||
}
|
||||
|
||||
func windowDidMiniaturize(_ notification: Notification) {
|
||||
common.windowDidMiniaturize()
|
||||
option.setOption(minimized: true)
|
||||
}
|
||||
|
||||
@@ -573,6 +574,10 @@ class Window: NSWindow, NSWindowDelegate {
|
||||
common.updateCursorVisibility()
|
||||
}
|
||||
|
||||
func windowDidBecomeMain(_ notification: Notification) {
|
||||
common.windowDidBecomeMain()
|
||||
}
|
||||
|
||||
func windowDidChangeOcclusionState(_ notification: Notification) {
|
||||
if occlusionState.contains(.visible) {
|
||||
common.windowDidChangeOcclusionState()
|
||||
|
||||
@@ -110,7 +110,9 @@ class MacCommon: Common {
|
||||
}
|
||||
|
||||
@objc func isVisible() -> Bool {
|
||||
return window?.occlusionState.contains(.visible) ?? false || option.vo.force_render
|
||||
return window?.occlusionState.contains(.visible) ?? false ||
|
||||
option.vo.force_render ||
|
||||
needsInitialDraw
|
||||
}
|
||||
|
||||
override func displayLinkCallback(_ displayLink: CVDisplayLink,
|
||||
|
||||
Reference in new issue
Block a user