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.25k stars 4.61k forks source link

Crash is occurred at glDrawArrays(GL_TRIANGLE_STRIP, 0, 4) #1836

Open sitanshu-joshi opened 10 years ago

sitanshu-joshi commented 10 years ago

Hi,

As i integrated GPUImage i see crashes at glDrawArrays when we select any frame on first time. This is became very serious issue on our DevOps.

It would be great if any one can help me.

BradLarson commented 10 years ago

What, exactly, are you trying to do? Could you provide some description of your setup and the code you use to set up your filter pipeline?

I don't know of many causes for glDrawArrays() crashes, outside of you trying to draw when your application is in the background (which you can't do with OpenGL ES).

sitanshu-joshi commented 10 years ago

//Declaration In Inrterface

GPUImageVideoCamera videoCamera; GPUImageOutput filter; @property (weak, nonatomic) IBOutlet GPUImageView *cameraView;

//Implementation //To Blend image on live video

filter = [[GPUImageNormalBlendFilter alloc] init]; [videoCamera addTarget:filter]; [filter addTarget:cameraView];

    GPUImagePicture *overlayImage = [[GPUImagePicture alloc] initWithImage:[UIImage imageNamed:[arrayOfFrames objectAtIndex:index]] smoothlyScaleOutput:YES];
    [overlayImage processImage];
    [overlayImage addTarget:filter];

We are applying filter using given sequence. GPUImageVideoCamera —> GPUImageNormalBlendFilter —> GPUImageView

BradLarson commented 9 years ago

At least one problem in the above is that you're not holding on to overlayImage. You're declaring it as a local variable, but this needs to be an instance variable or it will be deallocated the instant you leave your setup method. This will cause a crash.

I have no idea why you'd try to use @try in any part of this code, since try-catch are generally not used in Objective-C and will cause memory leaks under ARC.

sagargondaliya commented 9 years ago

Thanks Brad for your suggestion, but if we create Property of overlayImage then it crashed app. And without Property of overlayImage it crash app randomly , not overtime(Mostly crash when applying frame first time after app login.)

BeautyFei commented 2 years ago

I meet a similar problem, how did you solve it, can you share it? thank you