【发布时间】:2016-01-21 12:56:54
【问题描述】:
我有一个视频AVCaptureDevice (AVMediaTypeVideo),正在使用setExposureTargetBias:completionHandler 短暂减少曝光,然后再次恢复它。
我需要确切知道captureOutput:didOutputSampleBuffer:fromConnection: 中的哪个缓冲区对应于曝光减少的第一帧。
文档说:
该块收到一个时间戳,该时间戳与已应用该设置的第一个缓冲区的时间戳相匹配。时间戳与设备时钟同步,因此必须先转换为主时钟,然后再与通过 AVCaptureVideoDataOutput 实例传递的缓冲区的时间戳进行比较。
如何获取“设备时钟”?
我在completionHandler中做了以下操作,虽然主机时钟似乎与主时钟重合。
CMClockRef masterClock = self.captureSession.masterClock;
CMClockRef deviceClock = CMClockGetHostTimeClock();
syncTimeConverted = CMSyncConvertTime( syncTime, deviceClock, masterClock );
我打算在captureOutput:didOutputSampleBuffer:fromConnection: 中执行以下操作来测试缓冲区是否是我想要的缓冲区
CMTime bufferTime = CMSampleBufferGetPresentationTimeStamp( sampleBuffer );
bool isDroppedExposureFrame = CMTimeCompare( bufferTime, syncTimeConverted ) == 0;
我走对了吗?
【问题讨论】:
标签: ios avcapturesession avcapturedevice cmtime