每次我运行此代码时,它都会给出错误说&#34;(CMTime)presentationTime = <out of =“”scope =“”>&#34;和imageBufferRef一样超出范围

时间:2015-12-30 11:20:41

标签: xcode swift avfoundation

运行以下代码

var sampleData  = NSMutableArray()

for var i = sampleData.count-1 ; i >= 0 ; i-- {

        let  presentationTime : CMTime = CMSampleBufferGetPresentationTimeStamp(sampleData[i] as! CMSampleBuffer)

        let imageBufferRef : CVPixelBufferRef = CMSampleBufferGetImageBuffer(sampleData[sampleData.count - i - 1] as! CMSampleBuffer)!

        while (!writerInput.readyForMoreMediaData) {
            NSThread.sleepForTimeInterval(0.1)
        }

        pixelBufferAdaptor.appendPixelBuffer(imageBufferRef, withPresentationTime: presentationTime)
 }

产生以下错误:

objc[1670]: _objc_rootFinalize called with garbage collection off

Printing description of imageBufferRef:
(CVPixelBufferRef) imageBufferRef = out of scope

Printing description of presentationTime:
(CMTime) presentationTime = out of scope

0 个答案:

没有答案