2016-05-26 5 views

Répondre

1

Vous devez appeler CMSampleBufferGetPresentationTimeStamp(sampleBuffer)

Quelque chose comme ça (en rapide, un peu maladroit parce que je ne pouvais pas trouver un CMTime 1/x):

let delta = CMTimeSubtract(CMSampleBufferGetPresentationTimeStamp(buf2), CMSampleBufferGetPresentationTimeStamp(buf1)) 

// awkward 1/x, beware that delta.value may overflow as a timescale 
// what's the right way? 
let frameRate = CMTime(value: CMTimeValue(delta.timescale), timescale: CMTimeScale(delta.value)) 

// maybe you want floating point instead of CMTime: 
let frameRateAsFloat64 = CMTimeGetSeconds(frameRate)