Mysterious application crash using OpenGL

I am using the GPUIImage library to develop an application for an iOS camera. Sometimes, when the application pauses after 2-3 minutes, Xcode crashes the application by pointing to the lines in the method:

 - (void)presentBufferForDisplay; { [self.context presentRenderbuffer:GL_RENDERBUFFER]; } 

What could be causing this crash? I have a very long camera installed, and the code itself is in the GPUImageContext class. What can i do wrong here?

+6
source share
1 answer

You cannot access OpenGL ES at all when your application is running in the background (paused). GPUImage uses OpenGL ES for everything it does. You must make sure that all the actions performed by your application using GPUImage (video filtering, image processing) are performed before your application completes the transition to the background.

You need to listen to UIApplicationWillResignActiveNotification or fill out the appropriate delegate callbacks to go to the background and pause camera capture (using the -pauseCameraCapture method at the input of your camera) or wait for any processing to complete (I believe that synchronous sending to the sequential send queue of GPUImage will take care of this )

A related discussion for this can be found on the GitHub problems page here: https://github.com/BradLarson/GPUImage/issues/197 and in several related issues.

+9
source

Source: https://habr.com/ru/post/955975/


All Articles