You need to call CMSampleBufferGetPresentationTimeStamp(sampleBuffer)
Something like this (in swift, a little awkward because I couldn't find a 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)