I am working on GPUImage framework , to record video using GPUImageVideoCamera .
it used to work sometime very flawlessly, but sometimes i go back and forth from my cameraScreen, it does crash sometime . I donot what is happening . I am Using ARC and IOS 6.
I am adding images of my error please have a look .
The crash happens in the GpuImageVideoCamera dealloc method when releasing the frameRenderingSemaphore:
// ARC forbids explicit message send of 'release'; since iOS 6 even for dispatch_release() calls: stripping it out in that case is required.
#if ( (__IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_6_0) || (!defined(__IPHONE_6_0)) )
if (frameRenderingSemaphore != NULL)
{
dispatch_release(frameRenderingSemaphore);
}
#endif
It appears that this is not an issue with ARC/not ARC (I've tried GPUImage builds with and without ARC enabled).
What I have found instead is that before releasing the GPUImageVideoCamera, you need to stop it from capturing any frames. Then schedule the call to [camera release]
on the GPUImageContext.contextQueue
, which will make sure the release is called after all frames have been processed.
Sorry for not posting more sample code, right now using GPUImage from Xamarin/C# hence translations a bit cumbersome.