[{"id":35022,"web_url":"https://patchwork.libcamera.org/comment/35022/","msgid":"<175318695790.50296.8822197615568666102@ping.linuxembedded.co.uk>","date":"2025-07-22T12:22:37","subject":"Re: [PATCH v2 2/3] gstreamer: Log and check adjusted camera\n\tconfiguration","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Jaslo Ziska (2025-07-22 11:39:29)\n> As CameraConfiguration::validate() might alter the configuration\n> previously negotiated with downstream, log an info when this happens as\n> GStreamer source elements are not supposed to do that.\n> \n> Also check if downstream can accept this new stream configuration and if\n> not, return a not-negotiated error.\n> \n> Signed-off-by: Jaslo Ziska <jaslo@ziska.de>\n> Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>\n\nAha, I didn't need to add Nicolas to the previous patch :-)\n\nThis seems like a good addition and verifiaction.\n\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n> ---\n>  src/gstreamer/gstlibcamerasrc.cpp | 11 ++++++++++-\n>  1 file changed, 10 insertions(+), 1 deletion(-)\n> \n> diff --git a/src/gstreamer/gstlibcamerasrc.cpp b/src/gstreamer/gstlibcamerasrc.cpp\n> index 7f4a39ec..79a025a5 100644\n> --- a/src/gstreamer/gstlibcamerasrc.cpp\n> +++ b/src/gstreamer/gstlibcamerasrc.cpp\n> @@ -617,8 +617,13 @@ gst_libcamera_src_negotiate(GstLibcameraSrc *self)\n>         }\n>  \n>         /* Validate the configuration. */\n> -       if (state->config_->validate() == CameraConfiguration::Invalid)\n> +       CameraConfiguration::Status status = state->config_->validate();\n> +       if (status == CameraConfiguration::Invalid)\n>                 return false;\n> +       else if (status == CameraConfiguration::Adjusted)\n> +               GST_ELEMENT_INFO(self, RESOURCE, SETTINGS,\n> +                                (\"Configuration was adjusted\"),\n> +                                (\"CameraConfiguration::validate() returned CameraConfiguration::Adjusted\"));\n>  \n>         int ret = state->cam_->configure(state->config_.get());\n>         if (ret) {\n> @@ -643,6 +648,10 @@ gst_libcamera_src_negotiate(GstLibcameraSrc *self)\n>                 g_autoptr(GstCaps) caps = gst_libcamera_stream_configuration_to_caps(stream_cfg, transfer[i]);\n>                 gst_libcamera_framerate_to_caps(caps, element_caps);\n>  \n> +               if (status == CameraConfiguration::Adjusted &&\n> +                   !gst_pad_peer_query_accept_caps(srcpad, caps))\n> +                       return false;\n> +\n>                 if (!gst_pad_push_event(srcpad, gst_event_new_caps(caps)))\n>                         return false;\n>         }\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 4B70BBDCC1\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 22 Jul 2025 12:22:44 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 334D369035;\n\tTue, 22 Jul 2025 14:22:43 +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 4042F68F93\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 22 Jul 2025 14:22:41 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 7445579D4;\n\tTue, 22 Jul 2025 14:22:03 +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=\"V+zKKUQ8\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1753186923;\n\tbh=2lHybiEasvEvnJbkwKHCpaGUfmcjODqMPk0KN/b1DlU=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=V+zKKUQ878hQL+EIVvX1RSJFkbuNmnWvIHxUS4relkDRZ2W1egaFQmh2uLE5cd+Zd\n\tf9rP3LyqhvyQM9f28TJLk/HrzmgaQV4sFfGU0s65AR5Ue1An8x/3blQeDmHwUf6aDZ\n\tWiSEa7bd7On1HxziZ1c4c+xMPH20FcGg7reLoY0s=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20250722105627.11961-3-jaslo@ziska.de>","References":"<20250722105627.11961-1-jaslo@ziska.de>\n\t<20250722105627.11961-3-jaslo@ziska.de>","Subject":"Re: [PATCH v2 2/3] gstreamer: Log and check adjusted camera\n\tconfiguration","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"Jaslo Ziska <jaslo@ziska.de>,\n\tNicolas Dufresne <nicolas.dufresne@collabora.com>","To":"Jaslo Ziska <jaslo@ziska.de>, libcamera-devel@lists.libcamera.org","Date":"Tue, 22 Jul 2025 13:22:37 +0100","Message-ID":"<175318695790.50296.8822197615568666102@ping.linuxembedded.co.uk>","User-Agent":"alot/0.9.1","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":35032,"web_url":"https://patchwork.libcamera.org/comment/35032/","msgid":"<7hzmukwgmrndoxuroacvea6ndv4owaxkoegawtk7lzjh5s7njj@yo7tu3xls4wd>","date":"2025-07-23T07:19:16","subject":"Re: [PATCH v2 2/3] gstreamer: Log and check adjusted camera\n\tconfiguration","submitter":{"id":232,"url":"https://patchwork.libcamera.org/api/people/232/","name":"Umang Jain","email":"uajain@igalia.com"},"content":"On Tue, Jul 22, 2025 at 12:39:29PM +0200, Jaslo Ziska wrote:\n> As CameraConfiguration::validate() might alter the configuration\n> previously negotiated with downstream, log an info when this happens as\n> GStreamer source elements are not supposed to do that.\n> \n> Also check if downstream can accept this new stream configuration and if\n> not, return a not-negotiated error.\n> \n> Signed-off-by: Jaslo Ziska <jaslo@ziska.de>\n> Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>\n\n\nReviewed-by: Umang Jain <uajain@igalia.com>\n> ---\n>  src/gstreamer/gstlibcamerasrc.cpp | 11 ++++++++++-\n>  1 file changed, 10 insertions(+), 1 deletion(-)\n> \n> diff --git a/src/gstreamer/gstlibcamerasrc.cpp b/src/gstreamer/gstlibcamerasrc.cpp\n> index 7f4a39ec..79a025a5 100644\n> --- a/src/gstreamer/gstlibcamerasrc.cpp\n> +++ b/src/gstreamer/gstlibcamerasrc.cpp\n> @@ -617,8 +617,13 @@ gst_libcamera_src_negotiate(GstLibcameraSrc *self)\n>  \t}\n>  \n>  \t/* Validate the configuration. */\n> -\tif (state->config_->validate() == CameraConfiguration::Invalid)\n> +\tCameraConfiguration::Status status = state->config_->validate();\n> +\tif (status == CameraConfiguration::Invalid)\n>  \t\treturn false;\n> +\telse if (status == CameraConfiguration::Adjusted)\n> +\t\tGST_ELEMENT_INFO(self, RESOURCE, SETTINGS,\n> +\t\t\t\t (\"Configuration was adjusted\"),\n> +\t\t\t\t (\"CameraConfiguration::validate() returned CameraConfiguration::Adjusted\"));\n>  \n>  \tint ret = state->cam_->configure(state->config_.get());\n>  \tif (ret) {\n> @@ -643,6 +648,10 @@ gst_libcamera_src_negotiate(GstLibcameraSrc *self)\n>  \t\tg_autoptr(GstCaps) caps = gst_libcamera_stream_configuration_to_caps(stream_cfg, transfer[i]);\n>  \t\tgst_libcamera_framerate_to_caps(caps, element_caps);\n>  \n> +\t\tif (status == CameraConfiguration::Adjusted &&\n> +\t\t    !gst_pad_peer_query_accept_caps(srcpad, caps))\n> +\t\t\treturn false;\n> +\n>  \t\tif (!gst_pad_push_event(srcpad, gst_event_new_caps(caps)))\n>  \t\t\treturn false;\n>  \t}\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 48AEAC3237\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 23 Jul 2025 07:19:13 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 47F1369047;\n\tWed, 23 Jul 2025 09:19:12 +0200 (CEST)","from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 8EE2168FB6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 23 Jul 2025 09:19:10 +0200 (CEST)","from [49.36.71.87] (helo=uajain) by fanzine2.igalia.com with\n\tesmtpsa \n\t(Cipher TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256)\n\t(Exim) id 1ueTkr-002TYm-9J; Wed, 23 Jul 2025 09:19:09 +0200"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=igalia.com header.i=@igalia.com\n\theader.b=\"RWQJJB8N\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com;\n\ts=20170329;\n\th=In-Reply-To:Content-Type:MIME-Version:References:Message-ID:\n\tSubject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID:\n\tContent-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc\n\t:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe:\n\tList-Post:List-Owner:List-Archive;\n\tbh=ISqrajuqz3g71rzlbWHeV2l6//zeyZaaKLSHIVERA0k=;\n\tb=RWQJJB8NhcaUvKxLWlm84yLxaE\n\tuK+TlhMLNrz74KL99xFg5T4ZkCbGPE2AfRWyDCKukf6i4otkSoQxkHR7MxOhKjBDwE4+mc54kl4fJ\n\tcAzA/UVlt4gETH4rKIBYDpgml/t/NbVG9Fz0UgvEBlSlU4q+XROM1G5kwdmP+ecYelh5GdoUhZaDP\n\t9V7WfMWVKM+47X+KW/tk6SjhbiFumSS+TJWdmnewFk3MUYRGEe6GJUrUTs4GAUolBCQeeyGQD5taS\n\tBdWYhbGJ3+hBO7ePJqSs+I3OKdKACsdSK9x0wXArbdik4fKkYP2UXMU+WXKrbKNESuFQOz7s6EhDd\n\tPxOHLeEA==;","Date":"Wed, 23 Jul 2025 12:49:16 +0530","From":"Umang Jain <uajain@igalia.com>","To":"Jaslo Ziska <jaslo@ziska.de>","Cc":"libcamera-devel@lists.libcamera.org, \n\tNicolas Dufresne <nicolas.dufresne@collabora.com>","Subject":"Re: [PATCH v2 2/3] gstreamer: Log and check adjusted camera\n\tconfiguration","Message-ID":"<7hzmukwgmrndoxuroacvea6ndv4owaxkoegawtk7lzjh5s7njj@yo7tu3xls4wd>","References":"<20250722105627.11961-1-jaslo@ziska.de>\n\t<20250722105627.11961-3-jaslo@ziska.de>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<20250722105627.11961-3-jaslo@ziska.de>","User-Agent":"NeoMutt/20250510-dirty","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>"}}]