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

Laurent Pinchart laurent.pinchart at ideasonboard.com
Tue Apr 20 23:34:24 CEST 2021


Hi Jacopo,

Thank you for the patch.

On Mon, Apr 19, 2021 at 03:14:23PM +0200, Jacopo Mondi wrote:
> 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.

That's actually not the full story, UVC device report timestamp
information in metadata that can be used to recover a SOE 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();
>  

I'd add

	/* \todo Use the UVC metadata to calculate a more precise timestamp */

Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>

> +	request->metadata().set(controls::SensorTimestamp,
> +				buffer->metadata().timestamp);
> +
>  	pipe_->completeBuffer(request, buffer);
>  	pipe_->completeRequest(request);
>  }

-- 
Regards,

Laurent Pinchart


More information about the libcamera-devel mailing list