Ios 实时CMSampleBuffer处理
我试图在移动中处理CMSampleBuffers,但我很快停止接收样本,即使我正在复制样本并处理副本 我使用AVCaptureAudioDataOutputSampleBufferDelegate获取样本,并按如下方式处理它们:Ios 实时CMSampleBuffer处理,ios,swift,avfoundation,Ios,Swift,Avfoundation,我试图在移动中处理CMSampleBuffers,但我很快停止接收样本,即使我正在复制样本并处理副本 我使用AVCaptureAudioDataOutputSampleBufferDelegate获取样本,并按如下方式处理它们: func captureOutput(captureOutput: AVCaptureOutput!, didOutputSampleBuffer sampleBuffer: CMSampleBuffer!, fromConnection connection:
func captureOutput(captureOutput: AVCaptureOutput!, didOutputSampleBuffer sampleBuffer: CMSampleBuffer!, fromConnection connection: AVCaptureConnection!) {
if (bufferCopy != nil) {
bufferCopy == nil
}
if CMSampleBufferCreateCopy(kCFAllocatorDefault, sampleBuffer, &bufferCopy) == noErr {
let encodedSamples = self.encoder.encodeSample(bufferCopy?.takeRetainedValue())
println(encodedSamples.count)
CMSampleBufferInvalidate(sampleBuffer)
// println("Copy: \(bufferCopy!.takeRetainedValue())")
}
else {
println("Failed to copy sampleBuffer")
}
}
Objective-C解决方案也会起作用
我还创建了一个GitHub回购协议,示例为:typo==nil。另外,设置为nil可能不是您想要做的,将mem归零或刷新缓冲区。尚未彻底检查问题,只是注意到typo==nil。另外,设置为nil可能不是您想要做的,将mem归零或刷新缓冲区。还没有彻底检查问题,只是注意到了