[{"id":34847,"web_url":"https://patchwork.libcamera.org/comment/34847/","msgid":"<CAEmqJPq6ZvindB=yq_td8UzoU3X7RE-mVXrkSbYGrP6FtRkGeg@mail.gmail.com>","date":"2025-07-10T14:47:48","subject":"Re: [PATCH v1] libcamera: pipeline: rpi: Do not set timestamps to 0\n\tif unavailable","submitter":{"id":34,"url":"https://patchwork.libcamera.org/api/people/34/","name":"Naushir Patuck","email":"naush@raspberrypi.com"},"content":"Hi Barnabás,\n\nOn Thu, 10 Jul 2025 at 15:43, Barnabás Pőcze\n<barnabas.pocze@ideasonboard.com> wrote:\n>\n> `SensorTimestamp` and `FrameWallClock` should always be available. However,\n> if that ever changes or they are not available for some unforeseen reason,\n> setting them to 0 is not ideal. That makes it more complicated for the\n> application to detect these cases (since they have to check the existence\n> either way), and if an application blindly assumes e.g. that `SensorTimestamp`\n> is monotonically increasing, then receiving a timestamp of 0 will likely\n> cause issues.\n>\n> So simply omit them from the request metadata if they are not available.\n>\n> Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\n\nLooks good to me.\n\nReviewed-by: Naushir Patuck <naush@raspberrypi.com>\n\n> ---\n>  src/libcamera/pipeline/rpi/common/pipeline_base.cpp | 8 ++++----\n>  1 file changed, 4 insertions(+), 4 deletions(-)\n>\n> diff --git a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp\n> index eafe94427..563df198e 100644\n> --- a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp\n> +++ b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp\n> @@ -1487,10 +1487,10 @@ void CameraData::checkRequestCompleted()\n>\n>  void CameraData::fillRequestMetadata(const ControlList &bufferControls, Request *request)\n>  {\n> -       request->metadata().set(controls::SensorTimestamp,\n> -                               bufferControls.get(controls::SensorTimestamp).value_or(0));\n> -       request->metadata().set(controls::FrameWallClock,\n> -                               bufferControls.get(controls::FrameWallClock).value_or(0));\n> +       if (auto x = bufferControls.get(controls::SensorTimestamp))\n> +               request->metadata().set(controls::SensorTimestamp, *x);\n> +       if (auto x = bufferControls.get(controls::FrameWallClock))\n> +               request->metadata().set(controls::FrameWallClock, *x);\n>\n>         if (cropParams_.size()) {\n>                 std::vector<Rectangle> crops;\n> --\n> 2.50.0\n>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id BA8A3BE175\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 10 Jul 2025 14:48:26 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A886568F06;\n\tThu, 10 Jul 2025 16:48:25 +0200 (CEST)","from mail-vk1-xa2a.google.com (mail-vk1-xa2a.google.com\n\t[IPv6:2607:f8b0:4864:20::a2a])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id A6F9E68EE7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 10 Jul 2025 16:48:23 +0200 (CEST)","by mail-vk1-xa2a.google.com with SMTP id\n\t71dfb90a1353d-532d07a648cso61431e0c.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 10 Jul 2025 07:48:23 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"cujmfhBw\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1752158902; x=1752763702;\n\tdarn=lists.libcamera.org; \n\th=content-transfer-encoding:cc:to:subject:message-id:date:from\n\t:in-reply-to:references:mime-version:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=ZFGVa72ZSo3CwDglsjRY1Ji0LEj/9yNnom2KwEbysSI=;\n\tb=cujmfhBwkWp6jOWcpcJHqVcKF/z9117P/7BId6vfz60L9nXfp/srLRJntNWViT1Si9\n\t6zpHl87kgxlE0RkbMwWVsZFBmTIJpOyytHAtLmdrMMjlLBKPpdEbferX6ROxsA0XB940\n\tXqMiEuO1+4vJZRNr1jTGyZGpVuwdwd64+YV3ahK9GbQk7CLnMnYg4NaKCsLIzhXtDS6T\n\tCYBil3YZDRpISH4vIKolIR5MD7vfXlgOwYPo86NLpr/RtCpIBlz5GBWaqHuGyVC7hcfU\n\t54jWNaIFWHtd8Pi6jGEpnBqH5rcXk5EbRHyssWsIQCfOOvq5DGCJMa4VHrRQ35exMnHR\n\tBwMw==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1752158902; x=1752763702;\n\th=content-transfer-encoding:cc:to:subject:message-id:date:from\n\t:in-reply-to:references:mime-version:x-gm-message-state:from:to:cc\n\t:subject:date:message-id:reply-to;\n\tbh=ZFGVa72ZSo3CwDglsjRY1Ji0LEj/9yNnom2KwEbysSI=;\n\tb=nGQ8iKn00Or8r7O4WvhHkF8N0IHOOmX2dqy4p8UzgELjBh85VEpnoPIfA6paNeYHfN\n\t72MwSdCsl5BGQ1s3yo3/coFLb2cE3rg4nlicU70F8ssy45dYJW0OdekUsNDReE8ynMIT\n\th1Tyx9mbZkxzPzCLdBwaz84FnRhLkPxoUAApj60wtPvJfLEPbI6N+aqY6D2bWJxPIlqq\n\tUyn76cDV4PEvkTv8PBTnlcWLKm61C2n3SKpY25BfczXh9kcGBy4HOZjSQFZ8UDkOGG9w\n\tNsAgHwshLPtAz9ZJhMHx48fM1k55YLncjGE3PAjYbjMBslbymyeoMDe0t8MT9Gwqqjke\n\tMKAA==","X-Gm-Message-State":"AOJu0Yyrwwon8J6PQ7sB22f9OC0sc6Q4D9uAWTl3lJ2BvbjkyzW/6Dsu\n\tVQpS5QH7mf0MBLjXCzc/b/xLR5Zvje7dzTavlWgAiC56BesvMjfSRNiW/2w3AK7gkHhW6CwnkYk\n\tKZVVWosMb6h5XpZSm8bsknED3pgA6ztVJf3wgyL4kWA==","X-Gm-Gg":"ASbGncsVJGpv6mxcNldfyGWOzk7Q4GeY7k4nrJV6qgkHgPx8Tt1pafMnJPbtVZQpvKj\n\t/n9jQITdzfGJwrvGslxnqNQNfUpJdWT0W2aL5mA9WdDF3o3ozIWhk9ksA9aJ6kKg4F5f07kTK8A\n\tP8Aq5l8d98TP4fSjWWo1FVTGabkt+SV3syP5kIVJ2rA8CDfgfewgJVYlwViXxE5oToUIQ1cZuY+\n\tAM=","X-Google-Smtp-Source":"AGHT+IGqXpt70qrlE4u2kJZlk5tEcHkcYV3Ea2KmN4jJS8F5lbzy1S4bqIoBU9s7M9MYfALFfkCudEgPMjf4cG+mHgw=","X-Received":"by 2002:a05:6122:328c:b0:534:7e4f:9ca5 with SMTP id\n\t71dfb90a1353d-535d71ba90bmr1738322e0c.0.1752158902189;\n\tThu, 10 Jul 2025 07:48:22 -0700 (PDT)","MIME-Version":"1.0","References":"<20250710144316.601640-1-barnabas.pocze@ideasonboard.com>","In-Reply-To":"<20250710144316.601640-1-barnabas.pocze@ideasonboard.com>","From":"Naushir Patuck <naush@raspberrypi.com>","Date":"Thu, 10 Jul 2025 15:47:48 +0100","X-Gm-Features":"Ac12FXwQgTxmGLA2aRn52sU5UFvtVR5syGTtX-HsKxzj6JouS6G_txb6RUx0qOE","Message-ID":"<CAEmqJPq6ZvindB=yq_td8UzoU3X7RE-mVXrkSbYGrP6FtRkGeg@mail.gmail.com>","Subject":"Re: [PATCH v1] libcamera: pipeline: rpi: Do not set timestamps to 0\n\tif unavailable","To":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org, \n\tDavid Plowman <david.plowman@raspberrypi.com>","Content-Type":"text/plain; charset=\"UTF-8\"","Content-Transfer-Encoding":"quoted-printable","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":34901,"web_url":"https://patchwork.libcamera.org/comment/34901/","msgid":"<40695443-082f-4cce-85b0-6362c5d94cf5@ideasonboard.com>","date":"2025-07-15T11:49:52","subject":"Re: [PATCH v1] libcamera: pipeline: rpi: Do not set timestamps to 0\n\tif unavailable","submitter":{"id":156,"url":"https://patchwork.libcamera.org/api/people/156/","name":"Dan Scally","email":"dan.scally@ideasonboard.com"},"content":"Hi Barnabás,\n\nOn 10/07/2025 15:43, Barnabás Pőcze wrote:\n> `SensorTimestamp` and `FrameWallClock` should always be available. However,\n> if that ever changes or they are not available for some unforeseen reason,\n> setting them to 0 is not ideal. That makes it more complicated for the\n> application to detect these cases (since they have to check the existence\n> either way), and if an application blindly assumes e.g. that `SensorTimestamp`\n> is monotonically increasing, then receiving a timestamp of 0 will likely\n> cause issues.\n>\n> So simply omit them from the request metadata if they are not available.\n>\n> Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\nReviewed-by: Daniel Scally <dan.scally@ideasonboard.com>\n> ---\n>   src/libcamera/pipeline/rpi/common/pipeline_base.cpp | 8 ++++----\n>   1 file changed, 4 insertions(+), 4 deletions(-)\n>\n> diff --git a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp\n> index eafe94427..563df198e 100644\n> --- a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp\n> +++ b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp\n> @@ -1487,10 +1487,10 @@ void CameraData::checkRequestCompleted()\n>   \n>   void CameraData::fillRequestMetadata(const ControlList &bufferControls, Request *request)\n>   {\n> -\trequest->metadata().set(controls::SensorTimestamp,\n> -\t\t\t\tbufferControls.get(controls::SensorTimestamp).value_or(0));\n> -\trequest->metadata().set(controls::FrameWallClock,\n> -\t\t\t\tbufferControls.get(controls::FrameWallClock).value_or(0));\n> +\tif (auto x = bufferControls.get(controls::SensorTimestamp))\n> +\t\trequest->metadata().set(controls::SensorTimestamp, *x);\n> +\tif (auto x = bufferControls.get(controls::FrameWallClock))\n> +\t\trequest->metadata().set(controls::FrameWallClock, *x);\n>   \n>   \tif (cropParams_.size()) {\n>   \t\tstd::vector<Rectangle> crops;","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id AA206C3237\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 15 Jul 2025 11:49:58 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C31A668F59;\n\tTue, 15 Jul 2025 13:49:57 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id E5D536186B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 15 Jul 2025 13:49:55 +0200 (CEST)","from [192.168.0.43]\n\t(cpc141996-chfd3-2-0-cust928.12-3.cable.virginm.net [86.13.91.161])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 56A41743\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 15 Jul 2025 13:49:23 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"s/FZshoG\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1752580163;\n\tbh=4rsGFP9NICUhm57oQcy3/a+hxdSkX/9vZ5oDgtHe4uk=;\n\th=Date:Subject:To:References:From:In-Reply-To:From;\n\tb=s/FZshoGTkBU6lvrafY3TFqyG+HQ9ak8lB2X4o/K51x3vwPfBhLptmyGDdWdPdYko\n\t0kNOxd7XSQqGx4nAN3B1XE5px+3ob2MX5saqWV7dMRSgB9PHhibksAceHG5RoZ3lVY\n\tAI+4vwRP0m2RZcc6Y6kKSrKRMj72KkMqciS1rkxo=","Message-ID":"<40695443-082f-4cce-85b0-6362c5d94cf5@ideasonboard.com>","Date":"Tue, 15 Jul 2025 12:49:52 +0100","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [PATCH v1] libcamera: pipeline: rpi: Do not set timestamps to 0\n\tif unavailable","To":"libcamera-devel@lists.libcamera.org","References":"<20250710144316.601640-1-barnabas.pocze@ideasonboard.com>","Content-Language":"en-US","From":"Dan Scally <dan.scally@ideasonboard.com>","Autocrypt":"addr=dan.scally@ideasonboard.com; keydata=\n\txsFNBGLydlEBEADa5O2s0AbUguprfvXOQun/0a8y2Vk6BqkQALgeD6KnXSWwaoCULp18etYW\n\tB31bfgrdphXQ5kUQibB0ADK8DERB4wrzrUb5CMxLBFE7mQty+v5NsP0OFNK9XTaAOcmD+Ove\n\teIjYvqurAaro91jrRVrS1gBRxIFqyPgNvwwL+alMZhn3/2jU2uvBmuRrgnc/e9cHKiuT3Dtq\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AcLBfAQYAQgAJhYhBLHbbfDlj+/vEjX0HpIkLofy/hjEBQJi8nZT\n\tBQkFo5qAAhsMAAoJEJIkLofy/hjEXPcQAMIPNqiWiz/HKu9W4QIf1OMUpKn3YkVIj3p3gvfM\n\tRes4fGX94Ji599uLNrPoxKyaytC4R6BTxVriTJjWK8mbo9jZIRM4vkwkZZ2bu98EweSucxbp\n\tvjESsvMXGgxniqV/RQ/3T7LABYRoIUutARYq58p5HwSP0frF0fdFHYdTa2g7MYZl1ur2JzOC\n\tFHRpGadlNzKDE3fEdoMobxHB3Lm6FDml5GyBAA8+dQYVI0oDwJ3gpZPZ0J5Vx9RbqXe8RDuR\n\tdu90hvCJkq7/tzSQ0GeD3BwXb9/R/A4dVXhaDd91Q1qQXidI+2jwhx8iqiYxbT+DoAUkQRQy\n\txBtoCM1CxH7u45URUgD//fxYr3D4B1SlonA6vdaEdHZOGwECnDpTxecENMbz/Bx7qfrmd901\n\tD+N9SjIwrbVhhSyUXYnSUb8F+9g2RDY42Sk7GcYxIeON4VzKqWM7hpkXZ47pkK0YodO+dRKM\n\tyMcoUWrTK0Uz6UzUGKoJVbxmSW/EJLEGoI5p3NWxWtScEVv8mO49gqQdrRIOheZycDmHnItt\n\t9Qjv00uFhEwv2YfiyGk6iGF2W40s2pH2t6oeuGgmiZ7g6d0MEK8Ql/4zPItvr1c1rpwpXUC1\n\tu1kQWgtnNjFHX3KiYdqjcZeRBiry1X0zY+4Y24wUU0KsEewJwjhmCKAsju1RpdlPg2kC","In-Reply-To":"<20250710144316.601640-1-barnabas.pocze@ideasonboard.com>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"8bit","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":34907,"web_url":"https://patchwork.libcamera.org/comment/34907/","msgid":"<20250715182228.GK20231@pendragon.ideasonboard.com>","date":"2025-07-15T18:22:28","subject":"Re: [PATCH v1] libcamera: pipeline: rpi: Do not set timestamps to 0\n\tif unavailable","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Barnabás,\n\nThank you for the patch.\n\nOn Thu, Jul 10, 2025 at 04:43:16PM +0200, Barnabás Pőcze wrote:\n> `SensorTimestamp` and `FrameWallClock` should always be available. However,\n> if that ever changes or they are not available for some unforeseen reason,\n> setting them to 0 is not ideal. That makes it more complicated for the\n> application to detect these cases (since they have to check the existence\n> either way), and if an application blindly assumes e.g. that `SensorTimestamp`\n> is monotonically increasing, then receiving a timestamp of 0 will likely\n> cause issues.\n> \n> So simply omit them from the request metadata if they are not available.\n> \n> Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\n> ---\n>  src/libcamera/pipeline/rpi/common/pipeline_base.cpp | 8 ++++----\n>  1 file changed, 4 insertions(+), 4 deletions(-)\n> \n> diff --git a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp\n> index eafe94427..563df198e 100644\n> --- a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp\n> +++ b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp\n> @@ -1487,10 +1487,10 @@ void CameraData::checkRequestCompleted()\n>  \n>  void CameraData::fillRequestMetadata(const ControlList &bufferControls, Request *request)\n>  {\n> -\trequest->metadata().set(controls::SensorTimestamp,\n> -\t\t\t\tbufferControls.get(controls::SensorTimestamp).value_or(0));\n> -\trequest->metadata().set(controls::FrameWallClock,\n> -\t\t\t\tbufferControls.get(controls::FrameWallClock).value_or(0));\n> +\tif (auto x = bufferControls.get(controls::SensorTimestamp))\n> +\t\trequest->metadata().set(controls::SensorTimestamp, *x);\n\nCan it ever happen that we wouldn't have a timestamp, and if so, is\nthere a way to fix that ?\n\n> +\tif (auto x = bufferControls.get(controls::FrameWallClock))\n> +\t\trequest->metadata().set(controls::FrameWallClock, *x);\n>  \n>  \tif (cropParams_.size()) {\n>  \t\tstd::vector<Rectangle> crops;","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 870F1BE175\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 15 Jul 2025 18:22:32 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 56BBF68F64;\n\tTue, 15 Jul 2025 20:22:31 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 17B1D6186B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 15 Jul 2025 20:22:30 +0200 (CEST)","from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi\n\t[81.175.209.231])\n\tby perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id 1656A78E;\n\tTue, 15 Jul 2025 20:21:57 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"eb5MhKzY\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1752603717;\n\tbh=Ne6QA6KBds4LKBn7ZnYm4r8MEOTDWQVea+N5Swrl3MI=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=eb5MhKzYo2ElhrSFamdLhSTgtKlIr/hs45JcKS7kgLXViaWZIH16cZAAUT5zaxg8B\n\txSDxpGeZsbAo8+iArAh156aOf+eN6DeLuh/X0O/lzcC0mr2F9Td8jhCpo1KEYBjlCp\n\tPKTwr5R8p03948iTwuSyyySB7GrwinxOzmM4G49A=","Date":"Tue, 15 Jul 2025 21:22:28 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org,\n\tDavid Plowman <david.plowman@raspberrypi.com>,\n\tNaushir Patuck <naush@raspberrypi.com>","Subject":"Re: [PATCH v1] libcamera: pipeline: rpi: Do not set timestamps to 0\n\tif unavailable","Message-ID":"<20250715182228.GK20231@pendragon.ideasonboard.com>","References":"<20250710144316.601640-1-barnabas.pocze@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20250710144316.601640-1-barnabas.pocze@ideasonboard.com>","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":34909,"web_url":"https://patchwork.libcamera.org/comment/34909/","msgid":"<1c718ccc-15bd-44c2-960f-0b484136980a@ideasonboard.com>","date":"2025-07-16T07:11:20","subject":"Re: [PATCH v1] libcamera: pipeline: rpi: Do not set timestamps to 0\n\tif unavailable","submitter":{"id":216,"url":"https://patchwork.libcamera.org/api/people/216/","name":"Barnabás Pőcze","email":"barnabas.pocze@ideasonboard.com"},"content":"Hi\n\n2025. 07. 15. 20:22 keltezéssel, Laurent Pinchart írta:\n> Hi Barnabás,\n> \n> Thank you for the patch.\n> \n> On Thu, Jul 10, 2025 at 04:43:16PM +0200, Barnabás Pőcze wrote:\n>> `SensorTimestamp` and `FrameWallClock` should always be available. However,\n>> if that ever changes or they are not available for some unforeseen reason,\n>> setting them to 0 is not ideal. That makes it more complicated for the\n>> application to detect these cases (since they have to check the existence\n>> either way), and if an application blindly assumes e.g. that `SensorTimestamp`\n>> is monotonically increasing, then receiving a timestamp of 0 will likely\n>> cause issues.\n>>\n>> So simply omit them from the request metadata if they are not available.\n>>\n>> Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\n>> ---\n>>   src/libcamera/pipeline/rpi/common/pipeline_base.cpp | 8 ++++----\n>>   1 file changed, 4 insertions(+), 4 deletions(-)\n>>\n>> diff --git a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp\n>> index eafe94427..563df198e 100644\n>> --- a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp\n>> +++ b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp\n>> @@ -1487,10 +1487,10 @@ void CameraData::checkRequestCompleted()\n>>   \n>>   void CameraData::fillRequestMetadata(const ControlList &bufferControls, Request *request)\n>>   {\n>> -\trequest->metadata().set(controls::SensorTimestamp,\n>> -\t\t\t\tbufferControls.get(controls::SensorTimestamp).value_or(0));\n>> -\trequest->metadata().set(controls::FrameWallClock,\n>> -\t\t\t\tbufferControls.get(controls::FrameWallClock).value_or(0));\n>> +\tif (auto x = bufferControls.get(controls::SensorTimestamp))\n>> +\t\trequest->metadata().set(controls::SensorTimestamp, *x);\n> \n> Can it ever happen that we wouldn't have a timestamp, and if so, is\n> there a way to fix that ?\n\nAt the moment I don't think so. But I believe one could go even further and\nstore the two timestamps in the `CfeJob` / `BayerFrame` types. But that would\nbe a bigger change, needing to reconcile the issue of having separate types\nbut `CameraData::fillRequestMetadata()` being common. I can take a look at that\nif you want. I stopped here because I think it is still an improvement over the\nprevious status quo.\n\n\nRegards,\nBarnabás Pőcze\n\n\n> \n>> +\tif (auto x = bufferControls.get(controls::FrameWallClock))\n>> +\t\trequest->metadata().set(controls::FrameWallClock, *x);\n>>   \n>>   \tif (cropParams_.size()) {\n>>   \t\tstd::vector<Rectangle> crops;\n>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 31775BE175\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 16 Jul 2025 07:11:27 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 3406B68F69;\n\tWed, 16 Jul 2025 09:11:26 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 802F46150F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 16 Jul 2025 09:11:24 +0200 (CEST)","from [192.168.33.16] (185.221.140.39.nat.pool.zt.hu\n\t[185.221.140.39])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 12AFCA57;\n\tWed, 16 Jul 2025 09:10:50 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"FdTeChH+\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1752649851;\n\tbh=rgbpmrC6Man5fEPn1Td6s1LbwIcE6aQZ+PJZnNxNj7M=;\n\th=Date:Subject:To:Cc:References:From:In-Reply-To:From;\n\tb=FdTeChH+8KqKcJQrNcZ+KzwYpnccYPD9FM3/ylbSeNndccWJYgTwdyt1cxHlcSgyU\n\tAJaYP5Q79grcaBcze0THCE2RLQlJPhhe6pRRpuEj0w58l/Od1SzPDHm3QNYMP1Pd6E\n\tPlS67gCsPtdjkUtm0I7KcLC/aUYCdjQ1WquwJQZ4=","Message-ID":"<1c718ccc-15bd-44c2-960f-0b484136980a@ideasonboard.com>","Date":"Wed, 16 Jul 2025 09:11:20 +0200","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [PATCH v1] libcamera: pipeline: rpi: Do not set timestamps to 0\n\tif unavailable","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org,\n\tDavid Plowman <david.plowman@raspberrypi.com>,\n\tNaushir Patuck <naush@raspberrypi.com>","References":"<20250710144316.601640-1-barnabas.pocze@ideasonboard.com>\n\t<20250715182228.GK20231@pendragon.ideasonboard.com>","From":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>","Content-Language":"en-US, hu-HU","In-Reply-To":"<20250715182228.GK20231@pendragon.ideasonboard.com>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"8bit","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]