Showing
1 changed file
with
4 additions
and
4 deletions
| @@ -57,7 +57,7 @@ public class MobileScanner: NSObject, AVCaptureVideoDataOutputSampleBufferDelega | @@ -57,7 +57,7 @@ public class MobileScanner: NSObject, AVCaptureVideoDataOutputSampleBufferDelega | ||
| 57 | 57 | ||
| 58 | private var nextScanTime = 0.0 | 58 | private var nextScanTime = 0.0 |
| 59 | 59 | ||
| 60 | - private var imagesCurrentlyBeingProcessed = 0 | 60 | + private var imagesCurrentlyBeingProcessed = false |
| 61 | 61 | ||
| 62 | public var timeoutSeconds: Double = 0 | 62 | public var timeoutSeconds: Double = 0 |
| 63 | 63 | ||
| @@ -97,12 +97,12 @@ public class MobileScanner: NSObject, AVCaptureVideoDataOutputSampleBufferDelega | @@ -97,12 +97,12 @@ public class MobileScanner: NSObject, AVCaptureVideoDataOutputSampleBufferDelega | ||
| 97 | registry?.textureFrameAvailable(textureId) | 97 | registry?.textureFrameAvailable(textureId) |
| 98 | 98 | ||
| 99 | let currentTime = Date().timeIntervalSince1970 | 99 | let currentTime = Date().timeIntervalSince1970 |
| 100 | - let eligibleForScan = currentTime > nextScanTime && imagesCurrentlyBeingProcessed == 0 | 100 | + let eligibleForScan = currentTime > nextScanTime && !imagesCurrentlyBeingProcessed |
| 101 | 101 | ||
| 102 | if ((detectionSpeed == DetectionSpeed.normal || detectionSpeed == DetectionSpeed.noDuplicates) && eligibleForScan || detectionSpeed == DetectionSpeed.unrestricted) { | 102 | if ((detectionSpeed == DetectionSpeed.normal || detectionSpeed == DetectionSpeed.noDuplicates) && eligibleForScan || detectionSpeed == DetectionSpeed.unrestricted) { |
| 103 | 103 | ||
| 104 | nextScanTime = currentTime + timeoutSeconds | 104 | nextScanTime = currentTime + timeoutSeconds |
| 105 | - imagesCurrentlyBeingProcessed += 1 | 105 | + imagesCurrentlyBeingProcessed = true |
| 106 | 106 | ||
| 107 | let ciImage = latestBuffer.image | 107 | let ciImage = latestBuffer.image |
| 108 | 108 | ||
| @@ -114,7 +114,7 @@ public class MobileScanner: NSObject, AVCaptureVideoDataOutputSampleBufferDelega | @@ -114,7 +114,7 @@ public class MobileScanner: NSObject, AVCaptureVideoDataOutputSampleBufferDelega | ||
| 114 | ) | 114 | ) |
| 115 | 115 | ||
| 116 | scanner.process(image) { [self] barcodes, error in | 116 | scanner.process(image) { [self] barcodes, error in |
| 117 | - imagesCurrentlyBeingProcessed -= 1 | 117 | + imagesCurrentlyBeingProcessed = false |
| 118 | 118 | ||
| 119 | if (detectionSpeed == DetectionSpeed.noDuplicates) { | 119 | if (detectionSpeed == DetectionSpeed.noDuplicates) { |
| 120 | let newScannedBarcodes = barcodes?.map { barcode in | 120 | let newScannedBarcodes = barcodes?.map { barcode in |
-
Please register or login to post a comment