Running GPUImage in background
Hi,
I have recently migrated some of my image processing algorithms using GPUImage. One thing that is crashing on me is when the application is entering background:
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
[self doImageProcessingUsingGPUImage];
[[UIApplication sharedApplication] endBackgroundTask:bgTask];
bgTask = UIBackgroundTaskInvalid;
});
I am getting some access violation errors. I am not sure what they really are but the best debug output I can get is:
libGPUSupportMercury.dylib`gpus_ReturnNotPermittedKillClient:
I am pretty sure the is inside of GPUImage as if I switch to the old implementation background processing is working fine.
Does anybody have any idea why this isn't working?
Michel
You can't run anything on the GPU when your application enters the background. Doing so will result in it being instantly terminated. This means that you can't use GPUImage for any processing to be performed when your application is moved to the background.
If you need to do this, you will have to switch to a CPU-bound solution, like using vImage or Core Image's CPU side routines. Unfortunately, they lack many of the capabilities I have here.