chore: sync pending changes

This commit is contained in:
Peter Steinberger
2025-12-30 00:59:30 +01:00
parent 37f85bb2d1
commit 7aabe73521

View File

@@ -68,9 +68,13 @@ final class ScreenRecordService: @unchecked Sendable {
try? FileManager.default.removeItem(at: outURL) try? FileManager.default.removeItem(at: outURL)
let state = CaptureState() let state = CaptureState()
let recordQueue = DispatchQueue(label: "com.steipete.clawdis.screenrecord")
try await withCheckedThrowingContinuation { (cont: CheckedContinuation<Void, Error>) in try await withCheckedThrowingContinuation { (cont: CheckedContinuation<Void, Error>) in
let handler: @Sendable (CMSampleBuffer, RPSampleBufferType, Error?) -> Void = { sample, type, error in let handler: @Sendable (CMSampleBuffer, RPSampleBufferType, Error?) -> Void = { sample, type, error in
// ReplayKit can call the capture handler on a background queue.
// Serialize writes to avoid queue asserts.
recordQueue.async {
if let error { if let error {
state.withLock { state in state.withLock { state in
if state.handlerError == nil { state.handlerError = error } if state.handlerError == nil { state.handlerError = error }
@@ -178,6 +182,7 @@ final class ScreenRecordService: @unchecked Sendable {
break break
} }
} }
}
let completion: @Sendable (Error?) -> Void = { error in let completion: @Sendable (Error?) -> Void = { error in
if let error { cont.resume(throwing: error) } else { cont.resume() } if let error { cont.resume(throwing: error) } else { cont.resume() }