我正在使用GPUImage框架来录制视频。但是,在录制时,我希望能够停止录制,开始录制和重复录制。我的代码如下:
-(void) startRecording {
NSLog(@"begin recording ");
dispatch_async(recordingQ, ^{
@autoreleasepool {
_assetURL = [self mediaURLAsVideo:YES];
_movieWriter = [[GPUImageMovieWriter alloc] initWithMovieURL:[self mediaURLAsVideo:YES] size:CGSizeMake(640, 480)];
[_overlay addTarget:_movieWriter];
[_movieWriter startRecording];
}
});
}
-(void) stopRecording {
NSLog(@"stop recording");
dispatch_sync(recordingQ, ^{
[_overlay removeTarget:_movieWriter];
[_movieWriter finishRecording];
});
}
偶尔,我会看到这次崩溃:
*** Assertion failure in -[GPUImageMovieWriter createDataFBO], /Users/.../Pods/GPUImage/framework/Source/iOS/GPUImageMovieWriter.m:548
我不确定为什么会这样,但任何帮助都会受到赞赏。
还有第二个问题。有时,控制台会记录
Couldn't write a frame
Couldn't write a frame
Couldn't write a frame
Couldn't write a frame