[{"id":33990,"web_url":"https://patchwork.libcamera.org/comment/33990/","msgid":"<363e9a9c22c264f5387ddd292f56f6499e5ad2ac.camel@ndufresne.ca>","date":"2025-04-22T14:34:14","subject":"Re: [PATCH 2/4] gstreamer: Log and check adjusted camera\n\tconfiguration","submitter":{"id":30,"url":"https://patchwork.libcamera.org/api/people/30/","name":"Nicolas Dufresne","email":"nicolas@ndufresne.ca"},"content":"Hi,\n\nLe mardi 22 avril 2025 à 16:10 +0200, Jaslo Ziska a écrit :\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> ---\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 12bf8de0..2d9db342 100644\n> --- a/src/gstreamer/gstlibcamerasrc.cpp\n> +++ b/src/gstreamer/gstlibcamerasrc.cpp\n> @@ -455,8 +455,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\nNot sure if others would prefer a switch, I don't have a strong\npreference here.\n\n>  \n>  \tint ret = state->cam_->configure(state->config_.get());\n>  \tif (ret) {\n> @@ -481,6 +486,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\nSeems fair to me.\n\nReviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>\n\n>  \t\tif (!gst_pad_push_event(srcpad, gst_event_new_caps(caps)))\n>  \t\t\treturn false;\n>  \t}","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 E6B74C327D\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 22 Apr 2025 14:34:24 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 04D0C68ACB;\n\tTue, 22 Apr 2025 16:34:24 +0200 (CEST)","from mail-qt1-x835.google.com (mail-qt1-x835.google.com\n\t[IPv6:2607:f8b0:4864:20::835])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 2EAED617E3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 22 Apr 2025 16:34:22 +0200 (CEST)","by mail-qt1-x835.google.com with SMTP id\n\td75a77b69052e-47663aeff1bso48278051cf.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 22 Apr 2025 07:34:22 -0700 (PDT)","from ?IPv6:2606:6d00:15:9913::5ac? ([2606:6d00:15:9913::5ac])\n\tby smtp.gmail.com with ESMTPSA id\n\td75a77b69052e-47ae9c4cdc4sm58171211cf.42.2025.04.22.07.34.16\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 22 Apr 2025 07:34:16 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=ndufresne-ca.20230601.gappssmtp.com\n\theader.i=@ndufresne-ca.20230601.gappssmtp.com\n\theader.b=\"DDMCSp3a\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=ndufresne-ca.20230601.gappssmtp.com; s=20230601; t=1745332461;\n\tx=1745937261; darn=lists.libcamera.org; \n\th=mime-version:user-agent:content-transfer-encoding:references\n\t:in-reply-to:date:to:from:subject:message-id:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=TsfK7SV4b++ui8eW+bW4l/8o3pBItwS3QuoxK0WKKG8=;\n\tb=DDMCSp3axbPCAveARhU+x3/7dKn1Vc9d3x9zjLOCPpRPleYF60lT+hummuO8AxT9X8\n\tQYdHkv6qn3h2xHr+4hvTi/y/jRYinNH7K6HMcSgyIwOcjr7SpmZGRlsr9kSiKmLMNJFJ\n\t8gj3rrVcWmJ1kiHOLRrU3T56MayMlC4bi3z4BWPJ5VQGPvfaBTXpGm6jWiCK4nRv0eEj\n\t0Fya63RLX8aDPu1dFHwR+Q2/XKSurh/BdBkGU/OuTKkDksuqsNSYUUq5uYO4YjDqizrw\n\tiZdXJkJRZFlr/puQ0N8KsPbARLUH0Djl1807TZGaK6FER9vnamGFmE2cr+LBBknRGoR/\n\tyJUw==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1745332461; x=1745937261;\n\th=mime-version:user-agent:content-transfer-encoding:references\n\t:in-reply-to:date:to:from:subject:message-id:x-gm-message-state:from\n\t:to:cc:subject:date:message-id:reply-to;\n\tbh=TsfK7SV4b++ui8eW+bW4l/8o3pBItwS3QuoxK0WKKG8=;\n\tb=de0zv1m40Mlv0WwImjdOkF/do0TeRv6fNyQTCAN8QHYN1oN2QJ4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05:622a:18aa:b0:476:838c:b0ce with SMTP id\n\td75a77b69052e-47aec3a735dmr315300361cf.13.1745332457113; \n\tTue, 22 Apr 2025 07:34:17 -0700 (PDT)","Message-ID":"<363e9a9c22c264f5387ddd292f56f6499e5ad2ac.camel@ndufresne.ca>","Subject":"Re: [PATCH 2/4] gstreamer: Log and check adjusted camera\n\tconfiguration","From":"Nicolas Dufresne <nicolas@ndufresne.ca>","To":"Jaslo Ziska <jaslo@ziska.de>, libcamera-devel@lists.libcamera.org","Date":"Tue, 22 Apr 2025 10:34:14 -0400","In-Reply-To":"<20250422142010.13064-3-jaslo@ziska.de>","References":"<20250422142010.13064-1-jaslo@ziska.de>\n\t<20250422142010.13064-3-jaslo@ziska.de>","Content-Type":"text/plain; charset=\"UTF-8\"","Content-Transfer-Encoding":"quoted-printable","User-Agent":"Evolution 3.56.0 (3.56.0-1.fc42) ","MIME-Version":"1.0","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>"}}]