I modified this Apple pattern code AVcam, what I need to do is to retailer the most recent 20 CMSampleBuffer into an array.
I add an AVCaptureVideoDataOutputSampleBufferDelegate
protocal in CameraViewController
, create a brand new VideoDataOutput
and join it. Then set the delegate to self.
Within the callback perform
var bufferArray:[CMSampleBuffer] = []
func captureOutput(_ output: AVCaptureOutput, didOutput sampleBuffer: CMSampleBuffer, from connection: AVCaptureConnection) {
if bufferArray.depend > 20{
bufferArray.removeFirst()
}
bufferArray.append(sampleBuffer)
}
However After 5-10 instances calling it,(primarily based on the preset of session), It’ll by no means name that once more. And In my one other digicam app, the preview additionally caught.
The bizarre factor is that if I solely maintain one reference of the buffer, like altering the code into singlebuffer = sampleBuffer
, all the pieces works advantageous. I’ve modified many seize settings however none of them work.