Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backporting Fix Crashs since Xcode 14.3 compilation CIContext#render #1330

Merged
merged 1 commit into from
Nov 3, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions Sources/Media/IOVideoUnit.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,17 @@ final class IOVideoUnit: NSObject, IOUnit {

let lockQueue = DispatchQueue(label: "com.haishinkit.HaishinKit.VideoIOComponent.lock")

var context: CIContext = .init() {
didSet {
for effect in effects {
effect.ciContext = context
private var _context: CIContext = .init()
var context: CIContext {
get {
lockQueue.sync { _context }
}
set {
lockQueue.async {
self._context = newValue
for effect in self.effects {
effect.ciContext = newValue
}
}
}
}
Expand Down Expand Up @@ -215,7 +222,7 @@ final class IOVideoUnit: NSObject, IOUnit {
}

func registerEffect(_ effect: VideoEffect) -> Bool {
effect.ciContext = context
effect.ciContext = _context
return effects.insert(effect).inserted
}

Expand Down Expand Up @@ -265,7 +272,7 @@ final class IOVideoUnit: NSObject, IOUnit {
}
#endif
imageBuffer?.lockBaseAddress()
context.render(image, to: imageBuffer ?? buffer)
_context.render(image, to: imageBuffer ?? buffer)
}
drawable?.enqueue(sampleBuffer)
}
Expand Down
Loading