BradLarson / GPUImage

An open source iOS framework for GPU-based image and video processing
http://www.sunsetlakesoftware.com/2012/02/12/introducing-gpuimage-framework
BSD 3-Clause "New" or "Revised" License
20.23k stars 4.61k forks source link

iOS 10.1.1 - GPUImageContext fails to create OpenGL ES 2.0 Context #2396

Open ar9jun opened 7 years ago

ar9jun commented 7 years ago

Hello!

I'm having a very weird issue where I get the following error - which comes from an NSAssert in GPUImageContext.m Line 249:

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 
'Unable to create an OpenGL ES 2.0 context. 
The GPUImage framework requires OpenGL ES 2.0 support to work.'

Here is my flow:

I have a GPUImageVideoCamera, and when I am ready to record, I create a GPUImageMovieWriter that writes what I record to a folder. I am able to do this multiple times, successfully. No issues, no errors. Each time I do it, I create a new GPUImageMovieWriterinstance with:

- (id)initWithMovieURL:(NSURL *)newMovieURL 
size:(CGSize)newSize 
fileType:(NSString *)newFileType 
outputSettings:(NSMutableDictionary *)outputSettings;

Any one have the same issue and/or know how to fix it or even have a workaround - would be much appreciated!

charmingtoad commented 6 years ago

I had the exact same issue.

These are my steps to reproduce:

1) Create a GPUImageMovieWriter 2) Call startRecording 3) Call finishRecording 4) Repeat 1-3 about 120x

Around the 120th recording, in debug mode there's a crash and this is printed to the console:

Unable to create an OpenGL ES 2.0 context. The GPUImage framework requires OpenGL ES 2.0 support to work.

In release mode, there's not a crash but recordings start coming out black.

I created a pull request with a fix here:

https://github.com/BradLarson/GPUImage/pull/2549