Silence-GitHub / BBMetalImage

A high performance Swift library for GPU-accelerated image/video processing based on Metal.
MIT License
989 stars 126 forks source link

Writer fails while recording #58

Open shiwanithakur opened 4 years ago

shiwanithakur commented 4 years ago

I start recording video, first few frames are written successful then writer fails with error code Error Domain=AVFoundationErrorDomain Code=-11800 "The operation could not be completed" UserInfo={NSLocalizedFailureReason=An unknown error occurred (-16364), NSLocalizedDescription=The operation could not be completed, NSUnderlyingError=0x28194a340 {Error Domain=NSOSStatusErrorDomain Code=-16364

it comes randomly, specially when app comes from background and start writing.

shiwanithakur commented 4 years ago

I figured out it, sometimes CMTime for sample buffer is not correct, should be greater that previous frame.

Silence-GitHub commented 4 years ago

Could you please write a sample project to reproduce the problem? And what kind of device, iOS version, Xcode version do you use?

shiwanithakur commented 4 years ago

I am using iPad 6th Generation, iOS 13.6. This issue was coming randomly. After putting so many logs i figured out problem in sampleTime was equal to previous frame. public func newTextureAvailable(_ texture: BBMetalTexture, from source: BBMetalImageSource) let sampleTime = texture.sampleTime

juanctecdam commented 4 years ago

@shiwanithakur how did you fixed it?