summaryrefslogtreecommitdiff
path: root/src/v4l2
diff options
context:
space:
mode:
authorKieran Bingham <kieran.bingham@ideasonboard.com>2022-02-14 12:39:51 +0000
committerKieran Bingham <kieran.bingham@ideasonboard.com>2022-02-15 11:10:26 +0000
commit039a6a02d019d0e06a5b236bfe99c4444e05fe8d (patch)
tree591187ecb1bd3c6c50f2ea5ade2d9933fec0a7c8 /src/v4l2
parent1966b9a58436fab51f8270aad6a228b935e4fac4 (diff)
v4l2: v4l2_camera_proxy: Fix timestamp calculation
The V4L2 Compatibility layer is returning timestamps for buffers which are incorrectly calculated from the frame metadata. The sec component of the timestamp is correct, but the usec component is out, leaving frame captures reporting non-monotonically increasing timestamps, and incorrect frame rate calculations. Fix the usecs calculation reported by the V4L2 adaptation layer. Bug: https://bugs.libcamera.org/show_bug.cgi?id=118 Fixes: 0ce8f2390b52 ("v4l2: v4l2_compat: Add V4L2 compatibility layer") Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src/v4l2')
-rw-r--r--src/v4l2/v4l2_camera_proxy.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/v4l2/v4l2_camera_proxy.cpp b/src/v4l2/v4l2_camera_proxy.cpp
index e114d09f..74bd54ce 100644
--- a/src/v4l2/v4l2_camera_proxy.cpp
+++ b/src/v4l2/v4l2_camera_proxy.cpp
@@ -231,7 +231,7 @@ void V4L2CameraProxy::updateBuffers()
});
buf.field = V4L2_FIELD_NONE;
buf.timestamp.tv_sec = fmd.timestamp / 1000000000;
- buf.timestamp.tv_usec = fmd.timestamp % 1000000;
+ buf.timestamp.tv_usec = (fmd.timestamp / 1000) % 1000000;
buf.sequence = fmd.sequence;
buf.flags |= V4L2_BUF_FLAG_DONE;