macos: announce frames on the main queue (Kitedesk T-4204)
textureFrameAvailable was called on the thread that pushed the frame, a Kitedesk video thread. The engine wants it on the platform thread (Shell::OnPlatformViewMarkTextureFrameAvailable checks it, engine a18df97c), as it wants registerTexture and unregisterTexture, which already run there; Kitedesk's own GPU texture (KdMatoyaTexture.swift) posts its notices the same way. The notice is now posted to the main queue; the registry is only used on the main thread. Tests: frames_are_announced_on_the_main_thread passes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
11478d230c
commit
2a36975b62
1 changed files with 6 additions and 2 deletions
|
|
@ -8,7 +8,7 @@
|
||||||
// IOSurface-backed buffers of a pool, which does not hand out again the
|
// IOSurface-backed buffers of a pool, which does not hand out again the
|
||||||
// buffers last handed to the engine, and are copied outside the queue the
|
// buffers last handed to the engine, and are copied outside the queue the
|
||||||
// raster thread waits on; rows are copied one by one when their stride
|
// raster thread waits on; rows are copied one by one when their stride
|
||||||
// differs from the pixel buffer's.
|
// differs from the pixel buffer's; frames are announced on the main queue.
|
||||||
//
|
//
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
@ -17,6 +17,7 @@ import CoreVideo
|
||||||
|
|
||||||
@objc public class TextRgba: NSObject, FlutterTexture {
|
@objc public class TextRgba: NSObject, FlutterTexture {
|
||||||
public var textureId: Int64 = -1
|
public var textureId: Int64 = -1
|
||||||
|
// Main thread only.
|
||||||
private var registry: FlutterTextureRegistry?
|
private var registry: FlutterTextureRegistry?
|
||||||
private var data: CVPixelBuffer?
|
private var data: CVPixelBuffer?
|
||||||
private var width: Int = 0
|
private var width: Int = 0
|
||||||
|
|
@ -80,7 +81,10 @@ import CoreVideo
|
||||||
self.data = pixelBufferCopy
|
self.data = pixelBufferCopy
|
||||||
}
|
}
|
||||||
if textureId != -1 {
|
if textureId != -1 {
|
||||||
registry?.textureFrameAvailable(textureId)
|
// On the platform (main) thread, which the engine checks.
|
||||||
|
DispatchQueue.main.async {
|
||||||
|
self.registry?.textureFrameAvailable(self.textureId)
|
||||||
|
}
|
||||||
return true
|
return true
|
||||||
} else {
|
} else {
|
||||||
return false
|
return false
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue