GPUImageWriter intermittent failure

I am using GPUImage environment for video recording. However, while recording, I like to stop recording, start recording and repeat. My code looks like this:

-(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];
});
}

      

Sometimes I see this glitch:

*** Assertion failure in -[GPUImageMovieWriter createDataFBO], /Users/.../Pods/GPUImage/framework/Source/iOS/GPUImageMovieWriter.m:548

      

I'm not sure why this is the case, but any help would be appreciated.

There is also a second problem. Sometimes console logs

Couldn't write a frame
Couldn't write a frame
Couldn't write a frame
Couldn't write a frame

      

+3


source to share





All Articles