summaryrefslogtreecommitdiff
path: root/modules/avcapture/avcapture.m
diff options
context:
space:
mode:
Diffstat (limited to 'modules/avcapture/avcapture.m')
-rw-r--r--modules/avcapture/avcapture.m6
1 files changed, 5 insertions, 1 deletions
diff --git a/modules/avcapture/avcapture.m b/modules/avcapture/avcapture.m
index f276c96..7420cfe 100644
--- a/modules/avcapture/avcapture.m
+++ b/modules/avcapture/avcapture.m
@@ -234,7 +234,9 @@ didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer
fromConnection:(AVCaptureConnection *)conn
{
const CVImageBufferRef b = CMSampleBufferGetImageBuffer(sampleBuffer);
+ CMTime ts = CMSampleBufferGetOutputPresentationTimeStamp(sampleBuffer);
struct vidframe vf;
+ uint64_t timestamp;
(void)captureOutput;
(void)conn;
@@ -246,8 +248,10 @@ didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer
vidframe_set_pixbuf(&vf, b);
+ timestamp = CMTimeGetSeconds(ts) * VIDEO_TIMEBASE;
+
if (vidframe_isvalid(&vf))
- vsrc->frameh(&vf, vsrc->arg);
+ vsrc->frameh(&vf, timestamp, vsrc->arg);
CVPixelBufferUnlockBaseAddress(b, 0);
}