I have a video AVCaptureDevice (AVMediaTypeVideo), am decreasing the exposure briefly using setExposureTargetBias:completionHandler and then restoring it again.
I need to know exactly which buffer in captureOutput:didOutputSampleBuffer:fromConnection: corresponds to the first frame with decreased exposure.
The docs say:
The block receives a timestamp which matches that of the first buffer to which the setting has been applied. The timestamp is synchronized to the device clock, and thus must be converted to the master clock prior to comparison with the timestamps of buffers delivered via an AVCaptureVideoDataOutput instance.
How do I get the "device clock"?
I have done the following in the completionHandler, although the host time clock seems to coincide with the master clock.
CMClockRef masterClock = self.captureSession.masterClock;
CMClockRef deviceClock = CMClockGetHostTimeClock();
syncTimeConverted = CMSyncConvertTime( syncTime, deviceClock, masterClock );
I intend on doing the following in captureOutput:didOutputSampleBuffer:fromConnection: to test whether a buffer is the one I want
CMTime bufferTime = CMSampleBufferGetPresentationTimeStamp( sampleBuffer );
bool isDroppedExposureFrame = CMTimeCompare( bufferTime, syncTimeConverted ) == 0;
Am I on the right track?