From patchwork Thu Jul 25 09:26:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qi Hou X-Patchwork-Id: 20700 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 561FBC323E for ; Thu, 25 Jul 2024 09:26:50 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 1F8DB6336F; Thu, 25 Jul 2024 11:26:49 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=nxp.com header.i=@nxp.com header.b="JPnA2tRW"; dkim-atps=neutral Received: from AS8PR04CU009.outbound.protection.outlook.com (mail-westeuropeazlp170110003.outbound.protection.outlook.com [IPv6:2a01:111:f403:c201::3]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 522BF6199A for ; Thu, 25 Jul 2024 11:26:47 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=lXhgZlIDcM1qz43EZHq0/HSBM2j4OskF2oyUBOY+SGALkaeVoQShUgP2k4hPPsaeJeVpviknKajVpU0QCANavRvlHEOERQR5DX1utVgp5PYcKHNuqmW+I5npY+3l1o8D46k3rGUT+MqUQSiDV15hz85+Zv7ma6vZi1ir+nxWjgWnEvs9/8+WSoVkASdQ+itMj4HDylhZq1zt1gOR2KUzGBd9A5zT+1ndOzctQoi1Iq4t0OC/sf/kHPtEfH0TNI6oGQJ+TWA9qFwGwMZWfEuxX1lcxYARwSDFwNBYnR3DlINVIkjrfOXec0R3irPEyVf2pZcAry3n+OV+wB32+i7CWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=mCvLm8qlXxYWTmSfTbFdARnLJNe8frtmHvu4GaiItPc=; b=PDh4ya5+folICzH7OpxJceEIxrk52bcqOp9GBxqjVOQFhAjLNjx5UwVSfEIxA6CoBCiTrqwxs1asOnGXM5UtIVziD6G4VwIJ8Z802YDDHM4Glgu0FYoYnQGwKRXrqL+finAXzdV+CXsAhBT5TCTaNe362WLTVPFdtaaQlwqxZw3AjHYM69sebBHf5UajpEeQs1NzZ8a5dDhB16pQPEDEx6AARHfc25J8/+3KKK/1HMqqe5dRF+Yktjyj7jnsrfrBhgdslO7pOTSg2E8Unw/3PGaaX5yPo6SEYX1IvwnO3KNcYhSqL5qG7sgdwbI77IVTxO8/FNKDg9ltlps85y08pA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=mCvLm8qlXxYWTmSfTbFdARnLJNe8frtmHvu4GaiItPc=; b=JPnA2tRWb5wIzbxy+wL1hy/EYOlMiD/ejK5F+9VlTAk0IzJUbNHqp+KFSEbT/Y1RondDYbBnLXL3B5qX2TIJ8QZWLNat8WVivj9O/GNQlgWtZZMWE0xAAiJ3V3DeT+70RNPvW/gseLP1hOqJsw1fWvV63z4DoIFXoxZh9Q1H9k6X6WkjmtdcDm2MdvbsQcK8jgPPrdeGlj066V7a+pUfZMABaKzahD54Tk+n9NAuRtZVGj7BQXdCPNyVNRLKVxQr82xiWo76kpJXOLBOcLi3OMxPNmTuM2JNzlmvyOWfT4xq/RIWxEC0OrQ0+WAdy8Poee0TQWzMzdUoP4b1rEMj3w== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB8285.eurprd04.prod.outlook.com (2603:10a6:102:1ca::15) by GV1PR04MB10606.eurprd04.prod.outlook.com (2603:10a6:150:207::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7784.20; Thu, 25 Jul 2024 09:26:45 +0000 Received: from PAXPR04MB8285.eurprd04.prod.outlook.com ([fe80::e003:8fb:64ea:acfd]) by PAXPR04MB8285.eurprd04.prod.outlook.com ([fe80::e003:8fb:64ea:acfd%4]) with mapi id 15.20.7784.017; Thu, 25 Jul 2024 09:26:45 +0000 From: Hou Qi To: libcamera-devel@lists.libcamera.org Cc: jared.hu@nxp.com, qi.hou@nxp.com, julien.vuillaumier@nxp.com Subject: [PATCH v2] gstreamer: Fix critical warning "gst_value_set_int_range_step: assertion 'start < end' failed" Date: Thu, 25 Jul 2024 18:26:22 +0900 Message-Id: <20240725092622.3835420-1-qi.hou@nxp.com> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: SG2PR04CA0212.apcprd04.prod.outlook.com (2603:1096:4:187::8) To PAXPR04MB8285.eurprd04.prod.outlook.com (2603:10a6:102:1ca::15) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8285:EE_|GV1PR04MB10606:EE_ X-MS-Office365-Filtering-Correlation-Id: 8787114a-6133-41db-3870-08dcac8be6dd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|52116014|376014|366016|38350700014; X-Microsoft-Antispam-Message-Info: gJWxF1UZ3mj7iNvLB0VUSb9h/ZRbOOlCOjJTcqzf5y/42xhgod8VuRsaVbOi4uXW0SyNjUlS3D5z5QeV3ETPkdHUlSmkBHtRLSxFv8JOWIDl4MbGAxTWpNEtDiGz6mLJ4V4u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+T2Zu1MGHgTju4vsM/h6eda+gEA9CH6vDkogHl1mB0WfxhpfYrijxzrbaMQDgvz9HRAf3Ewso+utMiqLTD1rd8fRwEUSGdsxU+etttTjyBuMGde5Sc92M8PijaVXTB4x5a3kSdFOfzT2mf31IjKrI5YcqiBso7K18TY+q66j5TIU1tUmxRJktLn/5pjsDBb/Z92BjA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PAXPR04MB8285.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(52116014)(376014)(366016)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: n53ialL1Uq9Xp9FZHXDT6nROH+ayGh5pIiVn0AGwYFBDFcmPmM3cK1j2h4Bz+Rwm4Iw9x/k5BxFid1epDGVMCw5LdV5HqUzpx4FCGyO4IOUH67+/SgGTpRL1CtPkCBJWgpaGXZ2wYBDleCSgfFuBgCb1h6yTTwKAFTBHngCU+1rs7rkiYwDJRDOe4EVP5qwIwD1zv5QTlmBocAfqCMtdIS65v3DbisEmY/TuFzniQ7MrkVHWsYKqBvnitMqvRHZ6B9ZvDyVvmf+LCokZkNtQtKoAbTdVfXpXMVziVorHs4Y3ufb0IJu7uHtKfWmeLm6/VSH9PhsBbI2x/k42Mul/0m0ZlIskepvz3mT6FxPYxWhblAgtaUTube1uHXAgh36X/Q59BYwhAFDOvI2Yifcc0m42IAPAEHax8kG1vVsdlhutYp1UcNefMaeJUkJunhTV3OM3EHyPywVQ2ujP1jrUPuN/xxiYEEhqmQQCeTNj82SjLE5R2a6d10q2hgKHRyeuVluCdSetFOXv0YumcV9hSSm+n20NpsSF4ylYjpwp8EXmdQTJqN1D27bKkK8oDp5ApuEoav1PypGi8mZD7LL14Gmevyv3rwNlUsI8HbBATDCTjZ0adHvgRxCjobcyAJrWsB11F5sCjLOfG7z2XdhnQJ8Xcbdbx5PAH1yA+a711+aogZMYm+9+SsKvZCefRHkz7JP3ucpoM7AIgOR+e1dfWiy23BSgtOvEbwt3TMXW/4mo+oKJxCnyQj+XmRYUEXZ6nL/qigkmWvYMIEtgaAn4xH4TSeqo9OaSrwvO7iqeEnRvY9li+N7hfI8moaoX/ChDwoNJHDHHlnq08ZYyu9usTwNAa3taXZjY6FOgu4LLw9a6rDkk2kYweN0I3sHtOTl6c/cyjoGhkVGYPriKZw06Bu4ZhJVUQDH/v1yTNrgW/wyy1mdk3nZDGhslc18y+AwCG0LnBdQbRaYeQ84GZe6h6jDfEdjPc+KmzUNFPxfdlg6TGc0l0Hetp+ruCVnPwO0Y+B0Gk4wNP7tbc8Yff+PfDfto1h+D0/YR32jRBvm/Wx4r5DFihBBLowvEY16xxGw0WYghpcz0CKW6CIIL19ab/V/1dswfM+TqN9W/hc5grHSmifA0p9JNp29dvrp+L545AwTBhUjUr1DyoR90BNKf0/cop0Qlz7a9yFJqXnVS5Kgu1wExdHTlLkWK8QsElVfyfT82H/o7bY381zW+uC8QTZJy1p7q+A4gS70f9rBVzPCDLCs3YbU+q/GRaSaOKNnhgsJss70+s8v25nCuD6kd3nP8Dc1lxViUw6qPMuwqd9oR1740MorRpy5/VVKzZ8pprg/nAFRpK/L95vL+Onj33ND4TmLB5+2zzq3nZFQ9Iabc8B2PoodPJhaUoch0JdCQ5gh3oEz4gxAnU24kHARokyOJ59s5yTT1D+MEFJEkHafn4w8hw+t66Cgutm+EyriFznNz3ACJi/ZxTS0h3dCLHmWiNN+GS34+jTcCi8uEveaayk2yzGfSh8nCNgpzdu8rEE1eJ+ozKAXGJfOKoQ2oB3LVrRfrDtyo2pAOAW7bw0s= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8787114a-6133-41db-3870-08dcac8be6dd X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8285.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jul 2024 09:26:45.6175 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: gK2rdWq1ze70giEsVvuJ5M1hVUkvtSO20fH7Rg5qBPt2jxYDg58Bt8P4usMH/fk7 X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV1PR04MB10606 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" This changes is fixing critical error message "gst_value_set_int_range_step: assertion 'start < end' failed" observed when building GStreamer caps from a stream configuration whose size range holds a single size. GStreamer range step definition requires distinct min and max values definitions, otherwise above error message is output. libcamera SizeRange instance may return a single size leading to identical min and max values. Add a conditional check where the min and max of the range are distinct during iterating the supported sizes for each pixelformat. Signed-off-by: Hou Qi Reviewed-by: Kieran Bingham Acked-by: Jacopo Mondi Reviewed-by: Nicolas Dufresne --- src/gstreamer/gstlibcamera-utils.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/gstreamer/gstlibcamera-utils.cpp b/src/gstreamer/gstlibcamera-utils.cpp index ec4da435..79f71246 100644 --- a/src/gstreamer/gstlibcamera-utils.cpp +++ b/src/gstreamer/gstlibcamera-utils.cpp @@ -359,13 +359,21 @@ gst_libcamera_stream_formats_to_caps(const StreamFormats &formats) GValue val = G_VALUE_INIT; g_value_init(&val, GST_TYPE_INT_RANGE); - gst_value_set_int_range_step(&val, range.min.width, range.max.width, range.hStep); - gst_structure_set_value(s, "width", &val); - gst_value_set_int_range_step(&val, range.min.height, range.max.height, range.vStep); - gst_structure_set_value(s, "height", &val); + if (range.min.width == range.max.width) { + gst_structure_set(s, "width", G_TYPE_INT, range.min.width, nullptr); + } else { + gst_value_set_int_range_step(&val, range.min.width, range.max.width, range.hStep); + gst_structure_set_value(s, "width", &val); + } + if (range.min.height == range.max.height) { + gst_structure_set(s, "height", G_TYPE_INT, range.min.height, nullptr); + } else { + gst_value_set_int_range_step(&val, range.min.height, range.max.height, range.vStep); + gst_structure_set_value(s, "height", &val); + } g_value_unset(&val); - gst_caps_append_structure(caps, s); + caps = gst_caps_merge_structure(caps, s); } }