【问题标题】:Application is crashing on dispatch_release Semaphore?应用程序在 dispatch_release 信号量上崩溃?
【发布时间】:2013-09-20 16:05:39
【问题描述】:

我正在研究 GPUImage 框架,使用 GPUImageVideoCamera 录制视频。

它曾经工作得非常完美,但有时我从我的相机屏幕来回走动,它确实有时会崩溃。我不知道发生了什么。我正在使用 ARC 和 IOS 6。

我正在添加我的错误图片,请看一下。

在释放frameRenderingSemaphore时GpuImageVideoCamera的dealloc方法发生崩溃:

// ARC forbids explicit message send of 'release'; since iOS 6 even for dispatch_release() calls: stripping it out in that case is required.
#if ( (__IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_6_0) || (!defined(__IPHONE_6_0)) )    
    if (frameRenderingSemaphore != NULL)
    {
        dispatch_release(frameRenderingSemaphore);
    }
#endif

【问题讨论】:

  • 我刚刚遇到了同样的问题,我将代码作为文本包含在内,以便其他人在谷歌搜索/搜索时找到它。我会在找到解决方案时通知您。

标签: iphone ios objective-c gpuimage gpuimagestillcamera


【解决方案1】:

看来这不是 ARC/not ARC 的问题(我尝试过启用和不启用 ARC 的 GPUImage 构建)。

我发现,在释放 GPUImageVideoCamera 之前,您需要阻止它捕获任何帧。然后在GPUImageContext.contextQueue 上安排对[camera release] 的调用,这将确保在处理完所有帧后调用释放。

很抱歉没有发布更多示例代码,现在使用来自 Xamarin/C# 的 GPUImage,因此翻译有点麻烦。

【讨论】:

    【解决方案2】:

    尝试删除项目中的所有断点,然后做产品 --> 清理

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-07-16
    • 2014-11-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-04-05
    相关资源
    最近更新 更多