evermeer / PassportScanner

Scan the MRZ code of a passport and extract the firstname, lastname, passport number, nationality, date of birth, expiration date and personal numer.
BSD 3-Clause "New" or "Revised" License
457 stars 101 forks source link

Crash while scanning #2

Closed francisjervis closed 8 years ago

francisjervis commented 8 years ago

Hi, I encountered the following error:

2015-12-31 13:47:49.125 PassportScanner[3038:1427113] * Assertion failure in -[GPUImageFramebuffer unlock], /Users/francis/Downloads/PassportScanner-master/Pods/GPUImage/framework/Source/GPUImageFramebuffer.m:269 2015-12-31 13:47:49.130 PassportScanner[3038:1427113] * Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Tried to overrelease a framebuffer, did you forget to call -useNextFrameForImageCapture before using -imageFromCurrentFramebuffer?'

Apart from that this is fantastic! Thanks for your work.

evermeer commented 8 years ago

I have seen that error before. I was under the impression that it was fixed after I added an extra queue operation as you can see on: https://github.com/evermeer/PassportScanner/blob/5ff827355cff98f8a12e116b1b220ad65509faef/Pod/PassportScannerController.swift#L156-156

        currentFilterConfiguration.useNextFrameForImageCapture()
        NSOperationQueue.mainQueue().addOperationWithBlock {
            let snapshot = currentFilterConfiguration.imageFromCurrentFramebuffer()

This is actually a GPUImage issue. I will create an issue there to see if I can get any support for this.

evermeer commented 8 years ago

Hmm... It looks like a common issue... I will do some investigation..

https://github.com/BradLarson/GPUImage/issues?utf8=✓&q=is%3Aissue+is%3Aopen+Tried+to+overrelease+a+framebuffer

francisjervis commented 8 years ago

Thanks!

evermeer commented 8 years ago

I moved the useNextFrameForImageCapture to inside the addOperationWithBlock so that it's right before the imageFromCurrentFramebuffer. It might have been a timing issue. I was not able to reproduce it. Can you tell me what Xcode version an what iPhone version plus iOS version you tried this on? How often did you get this error?

francisjervis commented 8 years ago

9.2 on a 6, from xCode 7.2 - was running the sample project. Just saw it once.

On Jan 5, 2016, at 5:14 PM, Edwin Vermeer notifications@github.com wrote:

I moved the useNextFrameForImageCapture to inside the addOperationWithBlock so that it's right before the imageFromCurrentFramebuffer. It might have been a timing issue. I was not able to reproduce it. Can you tell me what Xcode version an what iPhone version plus iOS version you tried this on? How often did you get this error?

— Reply to this email directly or view it on GitHub https://github.com/evermeer/PassportScanner/issues/2#issuecomment-169150719.

evermeer commented 8 years ago

Ok, I'm using the same. I will do some more tests to see if I can reproduce this. Could you also try it again with the updated version of the code?

evermeer commented 8 years ago

Please notify me if you encounter this error again.