【问题标题】:GPUImage mixing image and video getting crash overreleasing a frame bufferGPUImage 混合图像和视频崩溃过度释放帧缓冲区
【发布时间】:2014-10-23 20:06:34
【问题描述】:

我正在尝试将视频与视频、视频与图像或图像与图像混搭。如果我正在制作所有视频或所有图像,我的代码可以正常工作,但是当我尝试将图像与视频混合时,我的断言会崩溃:

Tried to overrelease a framebuffer, did you forget to call -useNextFrameForImageCapture before using -imageFromCurrentFramebuffer?

我尝试在整个代码中的不同位置添加[<some_filter> useNextFrameForImageCapture],但我不知道我需要在哪里添加它,或者这是否是我的问题。

我的链是:

GPUImagePicture -> any filter     --\ 
                                      > GPUImageColorDodgeBlendFilter
GPUImageVideoCamera -> any filter --/

我已尝试简化过滤器链以进行调试,如果我消除任何中间过滤器,则它适用于所有图像/视频组合。但是只要我在混合之前添加任何一个过滤器,它就会崩溃。

【问题讨论】:

标签: ios objective-c gpuimage


【解决方案1】:

我遇到了同样的问题,但想出了一个解决方法,又名“hack”。哼哼!!

    // next two lines address a bug in the GPUImage reference counting ...
    GPUImageFramebuffer* fb = self.filter.framebufferForOutput;
    [fb disableReferenceCounting];
    [self.filter useNextFrameForImageCapture];
    // next line was crashing with reference counting ...
    UIImage *retImage = [self.filter imageFromCurrentFramebuffer];

【讨论】:

  • 我参考了这个解决方案并应用(改变了一点)我的过滤器图。 useNextFrameForImageCapturedisableReferenceCounting 工作!
【解决方案2】:

原来这是带有 GPUImage 的 open bug。将视频/相机源与 GPUImagePicture 混合时。

我通过添加来解决它:

GPUImageNormalBlendFilter *blendFilter = [GPUImageNormalBlendFilter new];
[videoCameras[0] addTarget:blendFilter];
[source addTarget:blendFilter];

作为图片链中的第一个过滤器。该视频实际上并没有显示出来,它可以防止任何崩溃。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-11-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-01-20
    相关资源
    最近更新 更多