X-Git-Url: https://git.r.bdr.sh/rbdr/captura/blobdiff_plain/9431168da5eb1338d8c9fc8cc92e6245c539e73d..refs/heads/rbdr-multimonitor:/Captura/Domain/CapturaCaptureSession.swift diff --git a/Captura/Domain/CapturaCaptureSession.swift b/Captura/Domain/CapturaCaptureSession.swift index 80240e6..8943282 100644 --- a/Captura/Domain/CapturaCaptureSession.swift +++ b/Captura/Domain/CapturaCaptureSession.swift @@ -12,7 +12,11 @@ class CapturaCaptureSession: AVCaptureSession, AVCaptureFileOutputRecordingDeleg let displayId = screen.deviceDescription[NSDeviceDescriptionKey("NSScreenNumber")] as! CGDirectDisplayID let screenInput = AVCaptureScreenInput(displayID: displayId) - screenInput?.cropRect = box.insetBy(dx: 1, dy: 1) + var croppingBox = NSOffsetRect(box, -screen.frame.origin.x, -screen.frame.origin.y) + if croppingBox.width.truncatingRemainder(dividingBy: 2) != 0 { + croppingBox.size.width -= 1 + } + screenInput?.cropRect = croppingBox.insetBy(dx: 1, dy: 1) if self.canAddInput(screenInput!) { self.addInput(screenInput!)