GPUImage:试图过度发布帧缓冲区,你在使用-imageFromCurrentFramebuffer之前忘了调用-useNextFrameForImageCapture吗?

时间:2016-05-22 22:04:13

标签: ios iphone gpuimage

我一直打开和关闭此错误。我已经看到一些推荐在滤镜链中使用GPUImageNormalBlendFilter的解决方案,但这样做会产生纯灰色的输出。

videoCamera = [[GPUImageVideoCamera alloc] initWithSessionPreset:AVCaptureSessionPreset1280x720 cameraPosition:AVCaptureDevicePositionFront];
filter = [[GPUImageFilter alloc] init];

[videoCamera addTarget:_filter];
blendFilter = [[GPUImageAlphaBlendFilter alloc] init];
blendFilter.mix = 1.0;

animatedImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
[contentView addSubview:_animatedImageView];
[contentView addSubview:[self watermark]];
uiElementInput = [[GPUImageUIElement alloc] initWithView:contentView];

[filter addTarget:blendFilter];

[uiElementInput addTarget:blendFilter];

[blendFilter addTarget:filteredVideoView];

过滤后的视频视图是GPUImageView

1 个答案:

答案 0 :(得分:1)

您必须使用setFrameProcessingCompletionBlock并调用uiElement的更新方法:

__weak typeof(self) weakSelf = self;
[filter setFrameProcessingCompletionBlock:^(GPUImageOutput *filter, CMTime frameTime) {
    [weakSelf.uiElementInput update];
}];

[videoCamera startCameraCapture];