Reputation: 585
I'm using a GPUImage library for developing an iOS camera app.
I found sometimes app crash with GPUImageContext. I noticed it via Crashlytics Crash report, and App crash at GPUImageContext.m line 196, below method.
- (void)presentBufferForDisplay;
{
[self.context presentRenderbuffer:GL_RENDERBUFFER];
}
I confirmed below question, but I support below case.
Mysterious app crash with OpenGL
Does anyone suggest the reason of this crash? I receive crash report, most crash(90%) occur in iPod.
Upvotes: 1
Views: 1218
Reputation: 759
You can't access OpenGL ES at all when your application is running in the background (suspended). GPUImage uses OpenGL ES for everything it does. You have to make sure that all work your application is doing with GPUImage (filtering video, processing an image) is done before your application completes its transition to the background.
You need to listen for the UIApplicationWillResignActiveNotification or fill out the related delegate callbacks for the transition to the background, and in there pause any camera capture (via the -pauseCameraCapture method on your camera input) or wait for any processing to finish (I believe a synchronous dispatch into the GPUImage serial dispatch queue will take care of this).
Related discussion for this can be found on the GitHub issues page here: https://github.com/BradLarson/GPUImage/issues/197 and in several related issues.
Upvotes: 3