From patchwork Mon Dec 6 23:39:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 15059 X-Patchwork-Delegate: kieran.bingham@ideasonboard.com Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id D7B94BF415 for ; Mon, 6 Dec 2021 23:40:00 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id DDD8E60897; Tue, 7 Dec 2021 00:39:58 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="TYk2xxT3"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 0F640607DE for ; Tue, 7 Dec 2021 00:39:55 +0100 (CET) Received: from Monstersaurus.local (cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id ACCDD11FE; Tue, 7 Dec 2021 00:39:54 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1638833994; bh=jyFT+4JF+7jG1gz19qvWB1h+iBfIhy527w6TaN2IIJk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TYk2xxT31CtDlMBfj96d3zQD3XiOxHqJuoAjtzBtxtXB+DUdDZkIDAyyOzUFowaXq 8IJKgdRU6WTf8Tyir4muBN2GNcr//reABVRI0zvA2eTWC+tPOlTw/cCPwRGY2mv3Y5 2p46g5E4ekLr0Pd6lU/SnA8T9d81P9bm5fMZI5HE= From: Kieran Bingham To: libcamera devel Date: Mon, 6 Dec 2021 23:39:43 +0000 Message-Id: <20211206233948.1351206-4-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211206233948.1351206-1-kieran.bingham@ideasonboard.com> References: <20211206233948.1351206-1-kieran.bingham@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 3/8] cam: Use SensorTimestamp rather than buffer metadata X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" 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 Reviewed-by: Umang Jain --- 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;