From patchwork Thu Jul 10 14:43:16 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= X-Patchwork-Id: 23779 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 8144CC3237 for ; Thu, 10 Jul 2025 14:43:23 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 8E25668F03; Thu, 10 Jul 2025 16:43:22 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="HXMfEfBz"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id F26DD68EE7 for ; Thu, 10 Jul 2025 16:43:20 +0200 (CEST) Received: from pb-laptop.local (185.221.140.39.nat.pool.zt.hu [185.221.140.39]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id C4C57B2B; Thu, 10 Jul 2025 16:42:51 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1752158571; bh=zvg3mBHVucwtnoiNfmswx4MMnJ38zAXw8ZF+CYjqll4=; h=From:To:Subject:Date:From; b=HXMfEfBzWmUrZRYv8YbHHIZv8hOAlm41YF+5cJytZ0LMPuTDHMEAQOoWOSnu1ADM7 eU79XKC21fv+zrjrMW860kX5+32HLTDhPRzGYWxTHRfFPxRYKsy4R29UNxKu3wWXPU gjc6gtvgVK97LRVYcSw3oGArneX00EtXXcUIuKPo= From: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= To: libcamera-devel@lists.libcamera.org, David Plowman , Naushir Patuck Subject: [PATCH v1] libcamera: pipeline: rpi: Do not set timestamps to 0 if unavailable Date: Thu, 10 Jul 2025 16:43:16 +0200 Message-ID: <20250710144316.601640-1-barnabas.pocze@ideasonboard.com> X-Mailer: git-send-email 2.50.0 MIME-Version: 1.0 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" `SensorTimestamp` and `FrameWallClock` should always be available. However, if that ever changes or they are not available for some unforeseen reason, setting them to 0 is not ideal. That makes it more complicated for the application to detect these cases (since they have to check the existence either way), and if an application blindly assumes e.g. that `SensorTimestamp` is monotonically increasing, then receiving a timestamp of 0 will likely cause issues. So simply omit them from the request metadata if they are not available. Signed-off-by: Barnabás Pőcze Reviewed-by: Naushir Patuck --- src/libcamera/pipeline/rpi/common/pipeline_base.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp index eafe94427..563df198e 100644 --- a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp +++ b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp @@ -1487,10 +1487,10 @@ void CameraData::checkRequestCompleted() void CameraData::fillRequestMetadata(const ControlList &bufferControls, Request *request) { - request->metadata().set(controls::SensorTimestamp, - bufferControls.get(controls::SensorTimestamp).value_or(0)); - request->metadata().set(controls::FrameWallClock, - bufferControls.get(controls::FrameWallClock).value_or(0)); + if (auto x = bufferControls.get(controls::SensorTimestamp)) + request->metadata().set(controls::SensorTimestamp, *x); + if (auto x = bufferControls.get(controls::FrameWallClock)) + request->metadata().set(controls::FrameWallClock, *x); if (cropParams_.size()) { std::vector crops;