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!)