[libcamera-devel] [PATCH 3/8] cam: Use SensorTimestamp rather than buffer metadata

Umang Jain umang.jain at ideasonboard.com
Wed Jun 1 10:24:16 CEST 2022


Hi Kieran,

Thank you for the patch (again)

On 12/7/21 00:39, Kieran Bingham wrote:
> The SensorTimestamp is defined to be the time of capture of the image.
> While all streams should have the same timestamp, this is not always
> defined or guaranteed as ISP drivers may not forward sequence numbers
> and timestamps from their input buffer.
>
> Use the Request metadata to get the SensorTimestamp which must be
> set by the pipeline handlers according to the data from the capture
> device.
>
> Signed-off-by: Kieran Bingham <kieran.bingham at ideasonboard.com>


Much as has been discussed regarding the per-buffer timestamp vs request 
timestamp. But it shouldn't affect this patch for now hence,

Reviewed-by: Umang Jain <umang.jain at ideasonboard.com>

> ---
>   src/cam/camera_session.cpp | 7 ++++---
>   1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/src/cam/camera_session.cpp b/src/cam/camera_session.cpp
> index 1bf460fa3fb7..50170723c30f 100644
> --- a/src/cam/camera_session.cpp
> +++ b/src/cam/camera_session.cpp
> @@ -359,10 +359,11 @@ void CameraSession::processRequest(Request *request)
>   	const Request::BufferMap &buffers = request->buffers();
>   
>   	/*
> -	 * Compute the frame rate. The timestamp is arbitrarily retrieved from
> -	 * the first buffer, as all buffers should have matching timestamps.
> +	 * Compute the frame rate. The timestamp is retrieved from the
> +	 * SensorTimestamp property, though all streams should have the
> +	 * same timestamp.
>   	 */
> -	uint64_t ts = buffers.begin()->second->metadata().timestamp;
> +	uint64_t ts = request->metadata().get(controls::SensorTimestamp);
>   	double fps = ts - last_;
>   	fps = last_ != 0 && fps ? 1000000000.0 / fps : 0.0;
>   	last_ = ts;


More information about the libcamera-devel mailing list