From 0b16e1e94d5074c9dd1ab7e0a7bdeeda89124586 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Tue, 22 Oct 2019 09:44:25 +0100 Subject: [PATCH] d/v4l2: Set the timestamp --- src/xrt/drivers/v4l2/v4l2_driver.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/xrt/drivers/v4l2/v4l2_driver.c b/src/xrt/drivers/v4l2/v4l2_driver.c index 0d94cb789..5209523c7 100644 --- a/src/xrt/drivers/v4l2/v4l2_driver.c +++ b/src/xrt/drivers/v4l2/v4l2_driver.c @@ -923,6 +923,13 @@ v4l2_fs_stream_run(void *ptr) xf->source_id = vid->base.source_id; xf->source_sequence = v_buf.sequence; + if ((v_buf.flags & V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC) != 0) { + int64_t ns = 0; + ns += v_buf.timestamp.tv_sec * 1000 * 1000 * 1000; + ns += v_buf.timestamp.tv_usec * 1000; + xf->timestamp = ns; + } + vid->sink->push_frame(vid->sink, xf); // The frame is requeued as soon as the refcount reaches zero,