[libcamera-devel,v5,07/17] libcamera: uvc: Report sensor timestamp
diff mbox series

Message ID 20210503104152.34048-8-jacopo@jmondi.org
State Accepted
Headers show
Series
  • Support SensorTimestamp metadata
Related show

Commit Message

Jacopo Mondi May 3, 2021, 10:41 a.m. UTC
Report the sensor's timestamp in the Request metadata using the
completed buffer timestamp.

The UVC driver reports timestamps of SOE event through metadata, for
which there is no support in the current pipeline implementation.

Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
---
 src/libcamera/pipeline/uvcvideo/uvcvideo.cpp | 4 ++++
 1 file changed, 4 insertions(+)

Patch
diff mbox series

diff --git a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp
index b6c6ade5ebaf..faa8d6b05f46 100644
--- a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp
+++ b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp
@@ -662,6 +662,10 @@  void UVCCameraData::bufferReady(FrameBuffer *buffer)
 {
 	Request *request = buffer->request();
 
+	/* \todo Use the UVC metadata to calculate a more precise timestamp */
+	request->metadata().set(controls::SensorTimestamp,
+				buffer->metadata().timestamp);
+
 	pipe_->completeBuffer(request, buffer);
 	pipe_->completeRequest(request);
 }