[{"id":30483,"web_url":"https://patchwork.libcamera.org/comment/30483/","msgid":"<172190538971.392292.13361132129634465544@ping.linuxembedded.co.uk>","date":"2024-07-25T11:03:09","subject":"Re: [PATCH v2] gstreamer: Fix critical warning\n\t\"gst_value_set_int_range_step: assertion 'start < end' failed\"","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Hi,\n\nI would probably suggest we shorten the $SUBJECT/$TITLE to:\n\n \"gstreamer: Fix width and height range handling\"\n\nwhich is a bit more succinct and describes what the patch does rather\nthan the error message.\n\nQuoting Hou Qi (2024-07-25 10:26:22)\n> This changes is fixing critical error message\n> \"gst_value_set_int_range_step: assertion 'start < end' failed\" observed\n> when building GStreamer caps from a stream configuration whose size\n> range holds a single size.\n> \n> GStreamer range step definition requires distinct min and max values\n> definitions, otherwise above error message is output.\n> \n> libcamera SizeRange instance may return a single size leading to\n> identical min and max values. Add a conditional check where the min and\n> max of the range are distinct during iterating the supported sizes for\n> each pixelformat.\n> \n> Signed-off-by: Hou Qi <qi.hou@nxp.com>\n\nOtherwise,\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n\n> ---\n>  src/gstreamer/gstlibcamera-utils.cpp | 18 +++++++++++++-----\n>  1 file changed, 13 insertions(+), 5 deletions(-)\n> \n> diff --git a/src/gstreamer/gstlibcamera-utils.cpp b/src/gstreamer/gstlibcamera-utils.cpp\n> index ec4da435..79f71246 100644\n> --- a/src/gstreamer/gstlibcamera-utils.cpp\n> +++ b/src/gstreamer/gstlibcamera-utils.cpp\n> @@ -359,13 +359,21 @@ gst_libcamera_stream_formats_to_caps(const StreamFormats &formats)\n>                         GValue val = G_VALUE_INIT;\n>  \n>                         g_value_init(&val, GST_TYPE_INT_RANGE);\n> -                       gst_value_set_int_range_step(&val, range.min.width, range.max.width, range.hStep);\n> -                       gst_structure_set_value(s, \"width\", &val);\n> -                       gst_value_set_int_range_step(&val, range.min.height, range.max.height, range.vStep);\n> -                       gst_structure_set_value(s, \"height\", &val);\n> +                       if (range.min.width == range.max.width) {\n> +                               gst_structure_set(s, \"width\", G_TYPE_INT, range.min.width, nullptr);\n> +                       } else {\n> +                               gst_value_set_int_range_step(&val, range.min.width, range.max.width, range.hStep);\n> +                               gst_structure_set_value(s, \"width\", &val);\n> +                       }\n> +                       if (range.min.height == range.max.height) {\n> +                               gst_structure_set(s, \"height\", G_TYPE_INT, range.min.height, nullptr);\n> +                       } else {\n> +                               gst_value_set_int_range_step(&val, range.min.height, range.max.height, range.vStep);\n> +                               gst_structure_set_value(s, \"height\", &val);\n> +                       }\n>                         g_value_unset(&val);\n>  \n> -                       gst_caps_append_structure(caps, s);\n> +                       caps = gst_caps_merge_structure(caps, s);\n>                 }\n>         }\n>  \n> -- \n> 2.34.1\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 0DE1FBDB1C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 25 Jul 2024 11:03:16 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id AFB1A6336F;\n\tThu, 25 Jul 2024 13:03:14 +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 F37AB6199E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 25 Jul 2024 13:03:12 +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 3477B45B;\n\tThu, 25 Jul 2024 13:02:29 +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=\"JlaXccHD\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1721905349;\n\tbh=AFAeXr2Kfo1G8v1Xfs8OX/gbon+XQMrbfBiqJxu7Gkk=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=JlaXccHDEjn/70R5L5HPum45WPnU4Ps8UTWyYfP9J4YoPX57uYDLxNqKMiY816aEH\n\tLjFz6sMbpIXk3sep9Fm4p0oxBGBSKsb/4fIJaWt8pE836OPaOEbQTBWNtjVfzA9KJ8\n\tGcRKSwaDc+pt4P08NewdiYd8jCvjRS96VblHGGcY=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20240725092622.3835420-1-qi.hou@nxp.com>","References":"<20240725092622.3835420-1-qi.hou@nxp.com>","Subject":"Re: [PATCH v2] gstreamer: Fix critical warning\n\t\"gst_value_set_int_range_step: assertion 'start < end' failed\"","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"jared.hu@nxp.com, qi.hou@nxp.com, julien.vuillaumier@nxp.com","To":"Hou Qi <qi.hou@nxp.com>, libcamera-devel@lists.libcamera.org","Date":"Thu, 25 Jul 2024 12:03:09 +0100","Message-ID":"<172190538971.392292.13361132129634465544@ping.linuxembedded.co.uk>","User-Agent":"alot/0.10","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":30485,"web_url":"https://patchwork.libcamera.org/comment/30485/","msgid":"<podhl357nkxhrigjkiwehijabz6eeo5bnrrezs6e2rb6hrvxof@cjrs3warw5qq>","date":"2024-07-25T11:09:22","subject":"Re: [PATCH v2] gstreamer: Fix critical warning\n\t\"gst_value_set_int_range_step: assertion 'start < end' failed\"","submitter":{"id":143,"url":"https://patchwork.libcamera.org/api/people/143/","name":"Jacopo Mondi","email":"jacopo.mondi@ideasonboard.com"},"content":"Hi Hou\n\nOn Thu, Jul 25, 2024 at 06:26:22PM GMT, Hou Qi wrote:\n> This changes is fixing critical error message\n> \"gst_value_set_int_range_step: assertion 'start < end' failed\" observed\n> when building GStreamer caps from a stream configuration whose size\n> range holds a single size.\n>\n> GStreamer range step definition requires distinct min and max values\n> definitions, otherwise above error message is output.\n>\n> libcamera SizeRange instance may return a single size leading to\n> identical min and max values. Add a conditional check where the min and\n> max of the range are distinct during iterating the supported sizes for\n> each pixelformat.\n>\n> Signed-off-by: Hou Qi <qi.hou@nxp.com>\n> ---\n>  src/gstreamer/gstlibcamera-utils.cpp | 18 +++++++++++++-----\n>  1 file changed, 13 insertions(+), 5 deletions(-)\n>\n> diff --git a/src/gstreamer/gstlibcamera-utils.cpp b/src/gstreamer/gstlibcamera-utils.cpp\n> index ec4da435..79f71246 100644\n> --- a/src/gstreamer/gstlibcamera-utils.cpp\n> +++ b/src/gstreamer/gstlibcamera-utils.cpp\n> @@ -359,13 +359,21 @@ gst_libcamera_stream_formats_to_caps(const StreamFormats &formats)\n>  \t\t\tGValue val = G_VALUE_INIT;\n>\n>  \t\t\tg_value_init(&val, GST_TYPE_INT_RANGE);\n> -\t\t\tgst_value_set_int_range_step(&val, range.min.width, range.max.width, range.hStep);\n> -\t\t\tgst_structure_set_value(s, \"width\", &val);\n> -\t\t\tgst_value_set_int_range_step(&val, range.min.height, range.max.height, range.vStep);\n> -\t\t\tgst_structure_set_value(s, \"height\", &val);\n> +\t\t\tif (range.min.width == range.max.width) {\n> +\t\t\t\tgst_structure_set(s, \"width\", G_TYPE_INT, range.min.width, nullptr);\n> +\t\t\t} else {\n> +\t\t\t\tgst_value_set_int_range_step(&val, range.min.width, range.max.width, range.hStep);\n> +\t\t\t\tgst_structure_set_value(s, \"width\", &val);\n> +\t\t\t}\n> +\t\t\tif (range.min.height == range.max.height) {\n> +\t\t\t\tgst_structure_set(s, \"height\", G_TYPE_INT, range.min.height, nullptr);\n> +\t\t\t} else {\n> +\t\t\t\tgst_value_set_int_range_step(&val, range.min.height, range.max.height, range.vStep);\n> +\t\t\t\tgst_structure_set_value(s, \"height\", &val);\n> +\t\t\t}\n>  \t\t\tg_value_unset(&val);\n>\n> -\t\t\tgst_caps_append_structure(caps, s);\n> +\t\t\tcaps = gst_caps_merge_structure(caps, s);\n\nThe patch seems logically correct, but I defer the call on the\ngstreamer api usage to people with more knwoledge in that area.\n\nWith the commit message updated as Kieran's suggested\nAcked-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n\n>  \t\t}\n>  \t}\n>\n> --\n> 2.34.1\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 5A2D9C323E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 25 Jul 2024 11:09:29 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 348F963372;\n\tThu, 25 Jul 2024 13:09:28 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 7B9CD6336F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 25 Jul 2024 13:09:26 +0200 (CEST)","from ideasonboard.com (mob-5-90-42-5.net.vodafone.it [5.90.42.5])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 91F7E45B;\n\tThu, 25 Jul 2024 13:08:42 +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=\"i+PO9NpP\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1721905722;\n\tbh=Y0LSy900O4hVgd0gemi5LFp15QSHqTqKQt9WUYXdFNc=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=i+PO9NpPnwhvV1B5nSgv2lQLNs8SJQysNEbdnGAYzHGtC4PIR5XmqwhIH5sq/4O9+\n\tM87qr2bVcQAUYgwRMWMnG4JtnhLJbkf7g39SvPt0nxwYKk9eMsH0jsuu0zjhH4yTWb\n\tPulq2WkFINjI9SH7xUBzgGhro109xDw31Dos9gXQ=","Date":"Thu, 25 Jul 2024 13:09:22 +0200","From":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>","To":"Hou Qi <qi.hou@nxp.com>","Cc":"libcamera-devel@lists.libcamera.org, jared.hu@nxp.com, \n\tjulien.vuillaumier@nxp.com","Subject":"Re: [PATCH v2] gstreamer: Fix critical warning\n\t\"gst_value_set_int_range_step: assertion 'start < end' failed\"","Message-ID":"<podhl357nkxhrigjkiwehijabz6eeo5bnrrezs6e2rb6hrvxof@cjrs3warw5qq>","References":"<20240725092622.3835420-1-qi.hou@nxp.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20240725092622.3835420-1-qi.hou@nxp.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":30486,"web_url":"https://patchwork.libcamera.org/comment/30486/","msgid":"<d7292ab677ee0eb40079563e9a42f4b2ea4978f6.camel@ndufresne.ca>","date":"2024-07-25T16:51:25","subject":"Re: [PATCH v2] gstreamer: Fix critical warning\n\t\"gst_value_set_int_range_step: assertion 'start < end' failed\"","submitter":{"id":30,"url":"https://patchwork.libcamera.org/api/people/30/","name":"Nicolas Dufresne","email":"nicolas@ndufresne.ca"},"content":"Hi,\n\nLe jeudi 25 juillet 2024 à 18:26 +0900, Hou Qi a écrit :\n> This changes is fixing critical error message\n> \"gst_value_set_int_range_step: assertion 'start < end' failed\" observed\n> when building GStreamer caps from a stream configuration whose size\n> range holds a single size.\n> \n> GStreamer range step definition requires distinct min and max values\n> definitions, otherwise above error message is output.\n> \n> libcamera SizeRange instance may return a single size leading to\n> identical min and max values. Add a conditional check where the min and\n> max of the range are distinct during iterating the supported sizes for\n> each pixelformat.\n> \n> Signed-off-by: Hou Qi <qi.hou@nxp.com>\n> ---\n>  src/gstreamer/gstlibcamera-utils.cpp | 18 +++++++++++++-----\n>  1 file changed, 13 insertions(+), 5 deletions(-)\n> \n> diff --git a/src/gstreamer/gstlibcamera-utils.cpp b/src/gstreamer/gstlibcamera-utils.cpp\n> index ec4da435..79f71246 100644\n> --- a/src/gstreamer/gstlibcamera-utils.cpp\n> +++ b/src/gstreamer/gstlibcamera-utils.cpp\n> @@ -359,13 +359,21 @@ gst_libcamera_stream_formats_to_caps(const StreamFormats &formats)\n>  \t\t\tGValue val = G_VALUE_INIT;\n>  \n>  \t\t\tg_value_init(&val, GST_TYPE_INT_RANGE);\n> -\t\t\tgst_value_set_int_range_step(&val, range.min.width, range.max.width, range.hStep);\n> -\t\t\tgst_structure_set_value(s, \"width\", &val);\n> -\t\t\tgst_value_set_int_range_step(&val, range.min.height, range.max.height, range.vStep);\n> -\t\t\tgst_structure_set_value(s, \"height\", &val);\n> +\t\t\tif (range.min.width == range.max.width) {\n> +\t\t\t\tgst_structure_set(s, \"width\", G_TYPE_INT, range.min.width, nullptr);\n> +\t\t\t} else {\n> +\t\t\t\tgst_value_set_int_range_step(&val, range.min.width, range.max.width, range.hStep);\n> +\t\t\t\tgst_structure_set_value(s, \"width\", &val);\n> +\t\t\t}\n> +\t\t\tif (range.min.height == range.max.height) {\n> +\t\t\t\tgst_structure_set(s, \"height\", G_TYPE_INT, range.min.height, nullptr);\n> +\t\t\t} else {\n> +\t\t\t\tgst_value_set_int_range_step(&val, range.min.height, range.max.height, range.vStep);\n> +\t\t\t\tgst_structure_set_value(s, \"height\", &val);\n> +\t\t\t}\n>  \t\t\tg_value_unset(&val);\n>  \n> -\t\t\tgst_caps_append_structure(caps, s);\n> +\t\t\tcaps = gst_caps_merge_structure(caps, s);\n\nYou omitted to document this part of the change in the commit message, though\nfunctionally it make sense. Perhaps something could be briefly added suggesting\nthat we now use gst_caps_merge_structure() to avoid appending structure that are\nalready expressed in the caps. That being said, the changes seems good to me.\n\nReviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>\n\n\n>  \t\t}\n>  \t}\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 5B74BC323E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 25 Jul 2024 16:51:30 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 982166199E;\n\tThu, 25 Jul 2024 18:51:29 +0200 (CEST)","from mail-qk1-x736.google.com (mail-qk1-x736.google.com\n\t[IPv6:2607:f8b0:4864:20::736])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B71036199E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 25 Jul 2024 18:51:27 +0200 (CEST)","by mail-qk1-x736.google.com with SMTP id\n\taf79cd13be357-7a1dcba8142so21258285a.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 25 Jul 2024 09:51:27 -0700 (PDT)","from nicolas-tpx395.lan ([2606:6d00:15:820c::580])\n\tby smtp.gmail.com with ESMTPSA id\n\t6a1803df08f44-6bb3fb17327sm8728236d6.145.2024.07.25.09.51.25\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 25 Jul 2024 09:51:26 -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=\"FTnYLm8O\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=ndufresne-ca.20230601.gappssmtp.com; s=20230601; t=1721926286;\n\tx=1722531086; darn=lists.libcamera.org; \n\th=mime-version:user-agent:content-transfer-encoding:references\n\t:in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject\n\t:date:message-id:reply-to;\n\tbh=/nfWFr4bwM4DEkxYjSrVw/aZ7EYZAhCTGhNUX1upLh0=;\n\tb=FTnYLm8OWTgMa8DCX7jzwdv8jjJfuKHnlTEjZbQN2va4odIFIqfg8lnsYZRLMc2MIt\n\t8mIoyho01T4F/vvp8XH8th9Y3gqHhopQ5tEh7Hdq2X6FOQ8ZKdLvR0Me7Z37XUIPFecW\n\t0L9F9fkTR+CoMsPBaZEeezigUkDTgrpiTFWG2Us2EpsEUVBnUYf1Kv8G/0Sl5HwurulQ\n\tgrRzTpZmmrr3Z4y7lAImH22Oct/tgVe9ZMnz1lIZ18rOBMDF1X5TFo8i4guOs1cpt7Ft\n\tLmUmbepjh7HVRTvffZmJW65hmupbYIa8ETQCMI/qE0esU61gGN7B6MfhalBQH/gVmPxr\n\txIQg==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1721926286; x=1722531086;\n\th=mime-version:user-agent:content-transfer-encoding:references\n\t:in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state\n\t:from:to:cc:subject:date:message-id:reply-to;\n\tbh=/nfWFr4bwM4DEkxYjSrVw/aZ7EYZAhCTGhNUX1upLh0=;\n\tb=reYO58a4hgykRtRy+/kMrXJqRcsqg2j7BYYLHpsdjVE7uaG/k1eoVIdMHy0l/SDRtC\n\tOgX+FcmFraYQPNJEEkkrpX097Q/V5mNAkMSg9qrk0HoOH1zucw1MUYtXszISrMsn9Ixz\n\txzIKSzYgWtG6cfAgnhMC+EWm3/WBWhG3gfQXSq3VfN8ELy0dRpFZaxvQZ9rVuv6rFNCR\n\t4a1r6Lv63Tgm9XYIssDzNJS1cd61TvPm3quzdEg5IiIxh76EwkHgOEvbKgFO+oI6vPeL\n\t5vJ6z6ddGa4+bw/Ih2/Vcs/gy96zxN1N68QOB2y0BT5xsuD9Awblkd/tT7O3AigvfXaA\n\tmJbg==","X-Forwarded-Encrypted":"i=1;\n\tAJvYcCVZ1p1+an9S5m4BLoQBLH19fblBo/OzSDT1xrhlDh5MTvl+adLz+EbUiOuQ3UEuEhaedGEH0TtfPMQ148+gklDfQ3NXz89n95MQvZtaLg8KLIjPWA==","X-Gm-Message-State":"AOJu0YyCmlkEOyHE4csmwdaIQk4tarmG6YE0Cz6L0pgOjiYfRD7Fug5Y\n\tmoLLObmRVnjmNFlQfPH84F2oaAIeZbCnGJZoXAbOUMkfZQxLD/kNTN7kc+XsmsQ=","X-Google-Smtp-Source":"AGHT+IFgf0Mpm6U4611CebJp/Qq8mZ1PcaqPHDe+6SCjJoZQo9vL7jzUX/3Oi9BZDN6hIFmQk3wbMg==","X-Received":"by 2002:a0c:e792:0:b0:6b5:2de3:32b0 with SMTP id\n\t6a1803df08f44-6b99129edadmr92671936d6.7.1721926286467; \n\tThu, 25 Jul 2024 09:51:26 -0700 (PDT)","Message-ID":"<d7292ab677ee0eb40079563e9a42f4b2ea4978f6.camel@ndufresne.ca>","Subject":"Re: [PATCH v2] gstreamer: Fix critical warning\n\t\"gst_value_set_int_range_step: assertion 'start < end' failed\"","From":"Nicolas Dufresne <nicolas@ndufresne.ca>","To":"Hou Qi <qi.hou@nxp.com>, libcamera-devel@lists.libcamera.org","Cc":"jared.hu@nxp.com, julien.vuillaumier@nxp.com","Date":"Thu, 25 Jul 2024 12:51:25 -0400","In-Reply-To":"<20240725092622.3835420-1-qi.hou@nxp.com>","References":"<20240725092622.3835420-1-qi.hou@nxp.com>","Content-Type":"text/plain; charset=\"UTF-8\"","Content-Transfer-Encoding":"quoted-printable","User-Agent":"Evolution 3.52.2 (3.52.2-1.fc40) ","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>"}},{"id":30487,"web_url":"https://patchwork.libcamera.org/comment/30487/","msgid":"<172193842063.1084283.11023773639770009242@ping.linuxembedded.co.uk>","date":"2024-07-25T20:13:40","subject":"Re: [PATCH v2] gstreamer: Fix critical warning\n\t\"gst_value_set_int_range_step: assertion 'start < end' failed\"","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Nicolas Dufresne (2024-07-25 17:51:25)\n> Hi,\n> \n> Le jeudi 25 juillet 2024 à 18:26 +0900, Hou Qi a écrit :\n> > This changes is fixing critical error message\n> > \"gst_value_set_int_range_step: assertion 'start < end' failed\" observed\n> > when building GStreamer caps from a stream configuration whose size\n> > range holds a single size.\n> > \n> > GStreamer range step definition requires distinct min and max values\n> > definitions, otherwise above error message is output.\n> > \n> > libcamera SizeRange instance may return a single size leading to\n> > identical min and max values. Add a conditional check where the min and\n> > max of the range are distinct during iterating the supported sizes for\n> > each pixelformat.\n> > \n> > Signed-off-by: Hou Qi <qi.hou@nxp.com>\n> > ---\n> >  src/gstreamer/gstlibcamera-utils.cpp | 18 +++++++++++++-----\n> >  1 file changed, 13 insertions(+), 5 deletions(-)\n> > \n> > diff --git a/src/gstreamer/gstlibcamera-utils.cpp b/src/gstreamer/gstlibcamera-utils.cpp\n> > index ec4da435..79f71246 100644\n> > --- a/src/gstreamer/gstlibcamera-utils.cpp\n> > +++ b/src/gstreamer/gstlibcamera-utils.cpp\n> > @@ -359,13 +359,21 @@ gst_libcamera_stream_formats_to_caps(const StreamFormats &formats)\n> >                       GValue val = G_VALUE_INIT;\n> >  \n> >                       g_value_init(&val, GST_TYPE_INT_RANGE);\n> > -                     gst_value_set_int_range_step(&val, range.min.width, range.max.width, range.hStep);\n> > -                     gst_structure_set_value(s, \"width\", &val);\n> > -                     gst_value_set_int_range_step(&val, range.min.height, range.max.height, range.vStep);\n> > -                     gst_structure_set_value(s, \"height\", &val);\n> > +                     if (range.min.width == range.max.width) {\n> > +                             gst_structure_set(s, \"width\", G_TYPE_INT, range.min.width, nullptr);\n> > +                     } else {\n> > +                             gst_value_set_int_range_step(&val, range.min.width, range.max.width, range.hStep);\n> > +                             gst_structure_set_value(s, \"width\", &val);\n> > +                     }\n> > +                     if (range.min.height == range.max.height) {\n> > +                             gst_structure_set(s, \"height\", G_TYPE_INT, range.min.height, nullptr);\n> > +                     } else {\n> > +                             gst_value_set_int_range_step(&val, range.min.height, range.max.height, range.vStep);\n> > +                             gst_structure_set_value(s, \"height\", &val);\n> > +                     }\n> >                       g_value_unset(&val);\n> >  \n> > -                     gst_caps_append_structure(caps, s);\n> > +                     caps = gst_caps_merge_structure(caps, s);\n> \n> You omitted to document this part of the change in the commit message, though\n> functionally it make sense. Perhaps something could be briefly added suggesting\n> that we now use gst_caps_merge_structure() to avoid appending structure that are\n> already expressed in the caps. That being said, the changes seems good to me.\n\nI can add that to the commit message then:\n\n\"To prevent appending structures that are already expressed with this\nupdate, gst_caps_merge_structure() is used in place of\ngst_caps_append_structure().\"\n\nif that's correct ?\n\n--\nKieran\n\n\n> \n> Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>\n> \n> \n> >               }\n> >       }\n> >  \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 1AA18BDB1C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 25 Jul 2024 20:13:46 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 0939363369;\n\tThu, 25 Jul 2024 22:13:45 +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 B61926199E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 25 Jul 2024 22:13:43 +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 B69E1471;\n\tThu, 25 Jul 2024 22:12:59 +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=\"nIu4MZe2\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1721938379;\n\tbh=QZvVG/OQazB1T5cvyhvd8IeoqlvVYmWkQV1fNjOdm0A=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=nIu4MZe2fH7ZVpezH7yq6bSkpSg9FIyAfPifpOKL5zgLEMNhJqLIO/ZbfRS7DFOzL\n\tWNHyn3Pf8pK+PdH2+MqylvprG9XzQUfvpr2w1lICibIiNoFHsdTb1ZEU0vHW3LpWAj\n\t4cIXaINh9+X3BzIqJK4rHA+EOrlYrb6p8PDcjJb4=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<d7292ab677ee0eb40079563e9a42f4b2ea4978f6.camel@ndufresne.ca>","References":"<20240725092622.3835420-1-qi.hou@nxp.com>\n\t<d7292ab677ee0eb40079563e9a42f4b2ea4978f6.camel@ndufresne.ca>","Subject":"Re: [PATCH v2] gstreamer: Fix critical warning\n\t\"gst_value_set_int_range_step: assertion 'start < end' failed\"","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"jared.hu@nxp.com, julien.vuillaumier@nxp.com","To":"Hou Qi <qi.hou@nxp.com>, Nicolas Dufresne <nicolas@ndufresne.ca>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Thu, 25 Jul 2024 21:13:40 +0100","Message-ID":"<172193842063.1084283.11023773639770009242@ping.linuxembedded.co.uk>","User-Agent":"alot/0.10","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":30495,"web_url":"https://patchwork.libcamera.org/comment/30495/","msgid":"<995a5560890bd71619aa2cea1aa2bb76d4a90995.camel@ndufresne.ca>","date":"2024-07-29T21:11:21","subject":"Re: [PATCH v2] gstreamer: Fix critical warning\n\t\"gst_value_set_int_range_step: assertion 'start < end' failed\"","submitter":{"id":30,"url":"https://patchwork.libcamera.org/api/people/30/","name":"Nicolas Dufresne","email":"nicolas@ndufresne.ca"},"content":"Le jeudi 25 juillet 2024 à 21:13 +0100, Kieran Bingham a écrit :\n> Quoting Nicolas Dufresne (2024-07-25 17:51:25)\n> > Hi,\n> > \n> > Le jeudi 25 juillet 2024 à 18:26 +0900, Hou Qi a écrit :\n> > > This changes is fixing critical error message\n> > > \"gst_value_set_int_range_step: assertion 'start < end' failed\" observed\n> > > when building GStreamer caps from a stream configuration whose size\n> > > range holds a single size.\n> > > \n> > > GStreamer range step definition requires distinct min and max values\n> > > definitions, otherwise above error message is output.\n> > > \n> > > libcamera SizeRange instance may return a single size leading to\n> > > identical min and max values. Add a conditional check where the min and\n> > > max of the range are distinct during iterating the supported sizes for\n> > > each pixelformat.\n> > > \n> > > Signed-off-by: Hou Qi <qi.hou@nxp.com>\n> > > ---\n> > >  src/gstreamer/gstlibcamera-utils.cpp | 18 +++++++++++++-----\n> > >  1 file changed, 13 insertions(+), 5 deletions(-)\n> > > \n> > > diff --git a/src/gstreamer/gstlibcamera-utils.cpp b/src/gstreamer/gstlibcamera-utils.cpp\n> > > index ec4da435..79f71246 100644\n> > > --- a/src/gstreamer/gstlibcamera-utils.cpp\n> > > +++ b/src/gstreamer/gstlibcamera-utils.cpp\n> > > @@ -359,13 +359,21 @@ gst_libcamera_stream_formats_to_caps(const StreamFormats &formats)\n> > >                       GValue val = G_VALUE_INIT;\n> > >  \n> > >                       g_value_init(&val, GST_TYPE_INT_RANGE);\n> > > -                     gst_value_set_int_range_step(&val, range.min.width, range.max.width, range.hStep);\n> > > -                     gst_structure_set_value(s, \"width\", &val);\n> > > -                     gst_value_set_int_range_step(&val, range.min.height, range.max.height, range.vStep);\n> > > -                     gst_structure_set_value(s, \"height\", &val);\n> > > +                     if (range.min.width == range.max.width) {\n> > > +                             gst_structure_set(s, \"width\", G_TYPE_INT, range.min.width, nullptr);\n> > > +                     } else {\n> > > +                             gst_value_set_int_range_step(&val, range.min.width, range.max.width, range.hStep);\n> > > +                             gst_structure_set_value(s, \"width\", &val);\n> > > +                     }\n> > > +                     if (range.min.height == range.max.height) {\n> > > +                             gst_structure_set(s, \"height\", G_TYPE_INT, range.min.height, nullptr);\n> > > +                     } else {\n> > > +                             gst_value_set_int_range_step(&val, range.min.height, range.max.height, range.vStep);\n> > > +                             gst_structure_set_value(s, \"height\", &val);\n> > > +                     }\n> > >                       g_value_unset(&val);\n> > >  \n> > > -                     gst_caps_append_structure(caps, s);\n> > > +                     caps = gst_caps_merge_structure(caps, s);\n> > \n> > You omitted to document this part of the change in the commit message, though\n> > functionally it make sense. Perhaps something could be briefly added suggesting\n> > that we now use gst_caps_merge_structure() to avoid appending structure that are\n> > already expressed in the caps. That being said, the changes seems good to me.\n> \n> I can add that to the commit message then:\n> \n> \"To prevent appending structures that are already expressed with this\n> update, gst_caps_merge_structure() is used in place of\n> gst_caps_append_structure().\"\n> \n> if that's correct ?\n\nAck.\n\n> \n> --\n> Kieran\n> \n> \n> > \n> > Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>\n> > \n> > \n> > >               }\n> > >       }\n> > >  \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 EF52BBDC71\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 29 Jul 2024 21:11:26 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 1AB3D63370;\n\tMon, 29 Jul 2024 23:11:26 +0200 (CEST)","from mail-oo1-xc2b.google.com (mail-oo1-xc2b.google.com\n\t[IPv6:2607:f8b0:4864:20::c2b])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 4EAB861984\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 29 Jul 2024 23:11:24 +0200 (CEST)","by mail-oo1-xc2b.google.com with SMTP id\n\t006d021491bc7-5d5de0e47b9so1136944eaf.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 29 Jul 2024 14:11:24 -0700 (PDT)","from nicolas-tpx395.lan ([2606:6d00:15:820c::580])\n\tby smtp.gmail.com with ESMTPSA id\n\t6a1803df08f44-6bb3f8d8269sm55829386d6.20.2024.07.29.14.11.22\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 29 Jul 2024 14:11:22 -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=\"u9/Pe3HG\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=ndufresne-ca.20230601.gappssmtp.com; s=20230601; t=1722287483;\n\tx=1722892283; darn=lists.libcamera.org; \n\th=mime-version:user-agent:content-transfer-encoding:references\n\t:in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject\n\t:date:message-id:reply-to;\n\tbh=aeIclfkIWcS+72nYmRmHi2NdS07XB9remLHGXkKvvK8=;\n\tb=u9/Pe3HGOw9nsmAwkpTLCfpIAwr2D4KhEwzPW190xya2X6zwbPhpQnYjSDBdfR1hp3\n\tN5wtDA81AbPdwdVWZp8cBuiFqLXEfNWcIh+kbmL2DhOxm+juDhUA+IulgFueaedgOXkE\n\tr8BfAMbhW8AxHv9AhtKlydN8ZFEwsG+hmt9y352xm3XLJ2gq8nj7TRlyaGi6l8VFVNgS\n\tuwp0flFMNxrStyD8mTkDjy/E9DCi6B9QhSun0VrdjAEuj+7/aLu31/ozbW+i94CuSVVN\n\t7dJWlitucqP4ml2EHP7LR0T0Teb4YR0WJbARm7GijPmV56P+9IMohHG0Jw9f/7wy461w\n\tyxUA==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1722287483; x=1722892283;\n\th=mime-version:user-agent:content-transfer-encoding:references\n\t:in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state\n\t:from:to:cc:subject:date:message-id:reply-to;\n\tbh=aeIclfkIWcS+72nYmRmHi2NdS07XB9remLHGXkKvvK8=;\n\tb=u1hnexZizZQx+ONrrvH50YU2nmJfpW2fKFK4v4P3HE6SL+n6xxk7F7ilw1MgKNNxMZ\n\tTOE9FlC1Q1hUdmhY5lMJwMW4qOyC4zTPlnDr38cD95ofdOKdF2Yn3w1GoWfvkMToEjnm\n\tjRf7yK1dyGpe8nsnHieTG03zAC2qQOOGFN866rCsrnUGgOTmBlFnAzEKWqoTc4BehEGV\n\tHnWqdzthTp5b9YUo60JUkXrxQSQeGo1xn/ZaySc1ww4tsKThcUAWq7BdtQmJMaYv9ONS\n\ts9LtQWTMPqc8WVpgfgIVl9Lh47h4GkylEYjSpSwEvD1KSwiITmuuEihD6AVeDPts51wG\n\tYViA==","X-Forwarded-Encrypted":"i=1;\n\tAJvYcCWmzp1Sh2BlyNqFUDiiQvsNi/cyRgu5MA5L2O4KZ878CX0UFkIIvWHrurIs+RenlGHMB1svgnhBIWTFszQGwT561GHmr7HeOB2uLpyMFI7R1jQEog==","X-Gm-Message-State":"AOJu0YwDu+Zlj3p+QWbweVGPqWwTIw8fXQaA+NyOYDqxsX6mAom+zvit\n\tMX4cg+ZgBoqvjnJSvz17oxoBjDKpakLTw1Bs5m+1ZZoOFlGqU2uo6hfWJ566ibg=","X-Google-Smtp-Source":"AGHT+IH7BAlfW7nCeEEN83DxSEAFMIyWgH2cXm7rbtGi/QjNACZ29ztEJazpgmwdfMATHIPcfnWw7A==","X-Received":"by 2002:a05:6358:939d:b0:1a6:9982:5dd5 with SMTP id\n\te5c5f4694b2df-1adbbecfc2emr1007780355d.10.1722287482843; \n\tMon, 29 Jul 2024 14:11:22 -0700 (PDT)","Message-ID":"<995a5560890bd71619aa2cea1aa2bb76d4a90995.camel@ndufresne.ca>","Subject":"Re: [PATCH v2] gstreamer: Fix critical warning\n\t\"gst_value_set_int_range_step: assertion 'start < end' failed\"","From":"Nicolas Dufresne <nicolas@ndufresne.ca>","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>, Hou Qi\n\t<qi.hou@nxp.com>,  libcamera-devel@lists.libcamera.org","Cc":"jared.hu@nxp.com, julien.vuillaumier@nxp.com","Date":"Mon, 29 Jul 2024 17:11:21 -0400","In-Reply-To":"<172193842063.1084283.11023773639770009242@ping.linuxembedded.co.uk>","References":"<20240725092622.3835420-1-qi.hou@nxp.com>\n\t<d7292ab677ee0eb40079563e9a42f4b2ea4978f6.camel@ndufresne.ca>\n\t<172193842063.1084283.11023773639770009242@ping.linuxembedded.co.uk>","Content-Type":"text/plain; charset=\"UTF-8\"","Content-Transfer-Encoding":"quoted-printable","User-Agent":"Evolution 3.52.2 (3.52.2-1.fc40) ","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>"}}]