This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func processSampleBuffer(scale: Float, sampleBuffer: CMSampleBuffer, writerInput: AVAssetWriterInput) -> Bool { | |
guard let blockBuffer = CMSampleBufferGetDataBuffer(sampleBuffer) else { | |
return false | |
} | |
let length = CMBlockBufferGetDataLength(blockBuffer) | |
var sampleBytes = UnsafeMutablePointer<Int16>.allocate(capacity: length) | |
defer { sampleBytes.deallocate(capacity: length) } | |
guard checkStatus(CMBlockBufferCopyDataBytes(blockBuffer, 0, length, sampleBytes), message: "Copying block buffer") else { | |
return false |