GPUImage icon indicating copy to clipboard operation
GPUImage copied to clipboard

Still camera continuous capture encounters error

Open KarenHu196 opened this issue 13 years ago • 0 comments

If I use Still camera to continuously capture photo, I sometimes keep getting the following error:

Error:Error Domain=AVFoundationErrorDomain Code=-11801 "Cannot Complete Action" UserInfo=0x780890 {NSLocalizedRecoverySuggestion=Try again later., NSUnderlyingError=0x4b6e80 "The operation couldn’t be completed. (OSStatus error -6689.)", NSLocalizedDescription=Cannot Complete Action}

I noticed that the signalling of the frameRenderingSemaphore is picked up by the wait in the capturePhotoProcessedUpToFilter of the GPUImageStillCamera class. The AV callback is not able to pick it up.

In order to fix this issue, I am thinking of adding a second semaphore called captureDoneSemaphore. In the completion block of capturePhotoAsImageProcessedUpToFilter call, signal captureDoneSemaphore instead of frameRenderingSemaphore. In the AV callback captureOutput function in the GPUImageVideoCamera, wait for either of these two semaphores. It returns only when none of the semaphores are signalled. The code is as follows:

    if (dispatch_semaphore_wait(frameRenderingSemaphore, DISPATCH_TIME_NOW) != 0 && dispatch_semaphore_wait(captureDoneSemaphore, DISPATCH_TIME_NOW) != 0)
    {
        return;
    }

Could you let me know if this is a real issue? If it is, may I submit my changes for review?

Thanks, Karen Hu

KarenHu196 avatar Sep 28 '13 20:09 KarenHu196