[libcamera-devel] [PATCH 03/13] libcamera: uvc: Report sensor timestamp

Jacopo Mondi jacopo at jmondi.org
Mon Apr 19 15:14:23 CEST 2021


Report the sensor's timestamp in the Request metadata using the
completed buffer timestamp.

The UVC driver does not support the FRAME_SYNC v4l2 event, and the
buffer timestamp is the only available approximation of the
sensor timestamp.

Signed-off-by: Jacopo Mondi <jacopo at jmondi.org>
---
 src/libcamera/pipeline/uvcvideo/uvcvideo.cpp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp
index b6c6ade5ebaf..b2d2f211e61b 100644
--- a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp
+++ b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp
@@ -662,6 +662,9 @@ void UVCCameraData::bufferReady(FrameBuffer *buffer)
 {
 	Request *request = buffer->request();
 
+	request->metadata().set(controls::SensorTimestamp,
+				buffer->metadata().timestamp);
+
 	pipe_->completeBuffer(request, buffer);
 	pipe_->completeRequest(request);
 }
-- 
2.31.1



More information about the libcamera-devel mailing list