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

NSInternalInconsistencyException When changing the background image multiple times when using a GPUImageChromaKeyBlendFilter #2452

Open justinmiller62 opened 7 years ago

justinmiller62 commented 7 years ago

Here is the full error:

Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Tried to overrelease a framebuffer, did you forget to call -useNextFrameForImageCapture before using -imageFromCurrentFramebuffer?'

I attached a simple swift file that demonstrates the issue. LiveVideoViewController.swift.zip

Here is the method I am using to change the background image, once it is set I change it with the following.

if canChangeImage == true { canChangeImage = false let inputImage = NSImage(named: "WID-small.jpg") self.blendImage?.removeAllTargets() self.blendImage = GPUImagePicture(image: inputImage!) self.blendImage?.addTarget((filter as! GPUImageInput)) self.blendImage?.processImage(completionHandler: { self.canChangeImage = true }) }