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

Using gpuimage framework hanging over iPhone 4 #1782

Closed sourcebits-mahesh closed 9 years ago

sourcebits-mahesh commented 9 years ago

Hi,

I am using the GPUImageVideoCamera for open camera with blur filters like gpuimage blur filters. I added this filters to the GPUImageVideoCamera.Its working fine on the higher devices like iPhone 4s,iPhone 5, iPad 2,iPad 3 but its getting hang on iPhone 4,after long time it would shut down.This process would happen every time if i execute on iPhone 4 . Is there any hardware limit for this framework?

Thanks & Regards, Mahesh A

BradLarson commented 9 years ago

There shouldn't be. What's the code that you're using which is causing this hang? This doesn't do this on my iPhone 4 test devices.

sourcebits-mahesh commented 9 years ago

Hi Bradlarson,

 Thanking you to respond very quickly,Please look at the following sample code for your reference to find the issue.

GPUImageiOSBlurFilter *blurViewFilter = [[GPUImageiOSBlurFilter alloc] init]; blurViewFilter.blurRadiusInPixels = 4.5f ; blurViewFilter.downsampling = 2.5f ; blurViewFilter.saturation = 1.0f;

GPUImageVideoCamera *liveVideo = [[GPUImageVideoCamera alloc] initWithSessionPreset:AVCaptureSessionPresetMedium cameraPosition:AVCaptureDevicePositionFront]; liveVideo.outputImageOrientation = UIInterfaceOrientationPortrait; liveVideo.horizontallyMirrorFrontFacingCamera = YES ; [liveVideo removeAudioInputsAndOutputs]; [liveVideo removeInputsAndOutputs];

      [liveVideo addTarget:blurViewFilter];
       [blurViewFilter addTarget:blurView];//GPUImage...
          [liveVideo startCameraCapture];

Using this performance is very slow and In this same view ,after an event trigger i was removing all targets , stops the camera capture and going to take a video using uiimagepickercontroller with custom camera overlay, and then once the video recording started it hangs the iphone4, but it will for all other devices.Please any help ,thanks in advance.

Thanks & Regards Mahesh

BradLarson commented 9 years ago

For one thing, you're not hanging on to a strong reference to your liveVideo object, so it will be deallocated as soon as you finish your setup method. This will lead to crashes and unstable behavior. You need to hang on to that with a strong reference of some kind, like a property or instance variable.