From patchwork Tue Jul 22 10:39:29 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jaslo Ziska X-Patchwork-Id: 23898 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 16D17BDCC1 for ; Tue, 22 Jul 2025 10:57:21 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id C454969037; Tue, 22 Jul 2025 12:57:20 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=ziska.de header.i=@ziska.de header.b="GIBZJ3mF"; dkim=permerror (0-bit key) header.d=ziska.de header.i=@ziska.de header.b="GRAAWw46"; dkim-atps=neutral Received: from mo4-p00-ob.smtp.rzone.de (mo4-p00-ob.smtp.rzone.de [85.215.255.24]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 947E169030 for ; Tue, 22 Jul 2025 12:57:18 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; t=1753181835; cv=none; d=strato.com; s=strato-dkim-0002; b=mhBQGHcNKt7ozxlChGYYV8t1DmcVPRo7nPNeJDjk1tkFiCQTzoQ5QpaJGVD8i7OKgh 5ocPNZTBLu/zC+cpKUOurOO0aZnjpuTq8qngiZHIS8g8Sf/dDZTZyqkwx3VhFKLQdi2M DI96JUgS9ZuRIfiG/A+WBjV1Jz+gYs1s4ATzjOymVyZcHELuTNAoZ1KYnQOrffXn0+KY 0QnTeZ6/BEbXc2TFFsXBRS1YAwxUNOxgWf5GacBtyJmmDkRpWIfz8Bh0ZRN35BcFcRWT nAsldlXZ/gPA/0Ho/E7KjDhhPJ/q0ckO68BXjAmEAOlm1173b71IUmYTtxvty+wKt5lI NcPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; t=1753181835; s=strato-dkim-0002; d=strato.com; h=References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Cc:Date: From:Subject:Sender; bh=uAE5TKYpSwi8OZn439sRZrIo2ufj+EvR+7N8E2PXpUY=; b=gF6kbCasNgWJsysuvA13G5I5IxyQn5rCING6k6C9vqv+XEJnHl4CeJ3INR5kJubICW bI2WsDYiBc7Hk3mJxLZANqGhniMVYgCekqR6mnsfEqB3t91g8u4wdBcerRKArfqxxrAy zCGCOGH18ef6rw8YMjLKUgVr1G6l5ds8rCyJty/FCRXYkntorjcv9pME94/2Hi1ybGjY RXPpTJRb/+p5C5+YfJ3kuia/w//ab6DrTOBasuFtSPwLAZpFACyfdGBdoQKOu/OQ4h8o H+5LADH/+8wL4RHtcF3U+6mLQQSO2EJ4XejlED7nOC2D/9dMffolWCE+C6/Im1YdpsUL jdDg== ARC-Authentication-Results: i=1; strato.com; arc=none; dkim=none X-RZG-CLASS-ID: mo00 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1753181835; s=strato-dkim-0002; d=ziska.de; h=References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Cc:Date: From:Subject:Sender; bh=uAE5TKYpSwi8OZn439sRZrIo2ufj+EvR+7N8E2PXpUY=; b=GIBZJ3mFXwUeOPzB4k+FGpS/PyYCj2LqMkM3fJ2ewLYH/VOxaCv7ZLyB+9sWdDTiHq 6xIHwMP+yrbE6qFm+kxd0tKPIzMPbMlmQutrkjpGhLvIJVdry5s55JAwzKn//f7/oLSd vMfq/rjlvCxYd7Lrl/+GLHIl2LViQ1cjSmVR9a+mV8dK4mqyjCTu7PVrDySCZQb5sJq0 dLhctFRhWnU+08mkyHyE0rg/+jVc1uYRz9dfCihb4NvbojqgfNlqJwaZaBjflhAO65k+ DfE3Vg+xbFvTHs1XMfnBWxeq9UI61bsNdObmCXPEx4PjzWoD7a04RrQqizuTJM9lZ+r3 y5Sw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; t=1753181835; s=strato-dkim-0003; d=ziska.de; h=References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Cc:Date: From:Subject:Sender; bh=uAE5TKYpSwi8OZn439sRZrIo2ufj+EvR+7N8E2PXpUY=; b=GRAAWw46CkFinckzCfsRtPrz4siKA4nqNLENsfIlfn6+YK7WRWDXCYQk55wKbFdxD4 kWcAHnekDjX5fdb1ENBw== X-RZG-AUTH: ":Jm0XeU+IYfb0x77LHmrjN5Wlb7TBwusDqIM6Hizy8VdfzvKi4yoFC9cF0Yq5V/JaauwvHLbqWsUkNwDmHGDXQ5TkbZSP" Received: from archlinux.fritz.box by smtp.strato.de (RZmta 52.1.2 AUTH) with ESMTPSA id z685ee16MAvFHgZ (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Tue, 22 Jul 2025 12:57:15 +0200 (CEST) From: Jaslo Ziska To: libcamera-devel@lists.libcamera.org Cc: Jaslo Ziska , Nicolas Dufresne Subject: [PATCH v2 2/3] gstreamer: Log and check adjusted camera configuration Date: Tue, 22 Jul 2025 12:39:29 +0200 Message-ID: <20250722105627.11961-3-jaslo@ziska.de> X-Mailer: git-send-email 2.50.0 In-Reply-To: <20250722105627.11961-1-jaslo@ziska.de> References: <20250722105627.11961-1-jaslo@ziska.de> 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" As CameraConfiguration::validate() might alter the configuration previously negotiated with downstream, log an info when this happens as GStreamer source elements are not supposed to do that. Also check if downstream can accept this new stream configuration and if not, return a not-negotiated error. Signed-off-by: Jaslo Ziska Reviewed-by: Nicolas Dufresne Reviewed-by: Kieran Bingham Reviewed-by: Umang Jain --- src/gstreamer/gstlibcamerasrc.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/gstreamer/gstlibcamerasrc.cpp b/src/gstreamer/gstlibcamerasrc.cpp index 7f4a39ec..79a025a5 100644 --- a/src/gstreamer/gstlibcamerasrc.cpp +++ b/src/gstreamer/gstlibcamerasrc.cpp @@ -617,8 +617,13 @@ gst_libcamera_src_negotiate(GstLibcameraSrc *self) } /* Validate the configuration. */ - if (state->config_->validate() == CameraConfiguration::Invalid) + CameraConfiguration::Status status = state->config_->validate(); + if (status == CameraConfiguration::Invalid) return false; + else if (status == CameraConfiguration::Adjusted) + GST_ELEMENT_INFO(self, RESOURCE, SETTINGS, + ("Configuration was adjusted"), + ("CameraConfiguration::validate() returned CameraConfiguration::Adjusted")); int ret = state->cam_->configure(state->config_.get()); if (ret) { @@ -643,6 +648,10 @@ gst_libcamera_src_negotiate(GstLibcameraSrc *self) g_autoptr(GstCaps) caps = gst_libcamera_stream_configuration_to_caps(stream_cfg, transfer[i]); gst_libcamera_framerate_to_caps(caps, element_caps); + if (status == CameraConfiguration::Adjusted && + !gst_pad_peer_query_accept_caps(srcpad, caps)) + return false; + if (!gst_pad_push_event(srcpad, gst_event_new_caps(caps))) return false; }