Search code examples
gpuimage

Switching GPUImageFilter chain on the fly


I'm running a set of filters on a video stream (not using GPUImageVideoCamera, but processing a sample buffer) currently using GPUImageFilterPipeline.

To change my filters, I'm simply using:

[self.filterPipeline replaceAllFilters:self.warmFilterArray];

Or [self.filterPipeline replaceAllFilters:self.coolFilterArray];

Or [self.filterPipeline removeAllFilters];

I'm having a problem with crashes whenever I change filters. The crashes are inconsistent, but if I change filters too rapidly, I'm more likely to crash.

I suspect that it has something to do with the targets in the filter chain being abruptly removed. Any ideas on how to safely remove filters? Thanks


Solution

  • I solved the issue by using multiple pipelines with multiple inputs. I send the sample buffer to be processed to whichever input is appropriate, allowing me to avoid removing filters from a chain while it is processing!