提交 a5108e5f 编写于 作者: P Palana

Simplify timestamp handling for mac-avcapture

上级 b92e8dfe
......@@ -106,18 +106,8 @@ static inline void update_frame_size(struct av_capture *capture,
update_frame_size(capture, frame, CVPixelBufferGetWidth(img),
CVPixelBufferGetHeight(img));
CMSampleTimingInfo info;
CMSampleBufferGetSampleTimingInfo(sampleBuffer, 0, &info);
CMTime target_pts;
if (capture->has_clock) {
AVCaptureInputPort *port = capture->device_input.ports[0];
target_pts = CMSyncConvertTime(info.presentationTimeStamp,
port.clock, CMClockGetHostTimeClock());
} else {
target_pts = info.presentationTimeStamp;
}
CMTime target_pts =
CMSampleBufferGetOutputPresentationTimeStamp(sampleBuffer);
CMTime target_pts_nano = CMTimeConvertScale(target_pts, NANO_TIMESCALE,
kCMTimeRoundingMethod_Default);
frame->timestamp = target_pts_nano.value;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册