[{"id":18230,"web_url":"https://patchwork.libcamera.org/comment/18230/","msgid":"<6ca73beb6be2f11626742c7e0d334df407b9c5e9.camel@ndufresne.ca>","date":"2021-07-19T13:26:56","subject":"Re: [libcamera-devel] [PATCH v2] gstreamer: Store group_id in\n\tGstLibcameraSrcState","submitter":{"id":30,"url":"https://patchwork.libcamera.org/api/people/30/","name":"Nicolas Dufresne","email":"nicolas@ndufresne.ca"},"content":"Le dimanche 18 juillet 2021 à 00:32 +0530, Vedant Paranjape a écrit :\n> This patch adds group_id in GstLibcameraSrcState, since group_id is\n> something which should be same for all the pads, it can be reused\n> later.\n> \n> Signed-off-by: Vedant Paranjape <vedantparanjape160201@gmail.com>\n> ---\n>  src/gstreamer/gstlibcamerasrc.cpp | 10 +++++++---\n>  1 file changed, 7 insertions(+), 3 deletions(-)\n> \n> diff --git a/src/gstreamer/gstlibcamerasrc.cpp b/src/gstreamer/gstlibcamerasrc.cpp\n> index ea53c2b5..79b0d867 100644\n> --- a/src/gstreamer/gstlibcamerasrc.cpp\n> +++ b/src/gstreamer/gstlibcamerasrc.cpp\n> @@ -113,6 +113,7 @@ struct GstLibcameraSrcState {\n>  \tstd::unique_ptr<CameraConfiguration> config_;\n>  \tstd::vector<GstPad *> srcpads_;\n>  \tstd::queue<std::unique_ptr<RequestWrap>> requests_;\n> +\tguint group_id_;\n>  \n>  \tvoid requestCompleted(Request *request);\n>  };\n> @@ -360,15 +361,17 @@ gst_libcamera_src_task_enter(GstTask *task, [[maybe_unused]] GThread *thread,\n>  \n>  \tGST_DEBUG_OBJECT(self, \"Streaming thread has started\");\n>  \n> -\tguint group_id = gst_util_group_id_next();\n> +\tif (state->group_id_ == 0) {\n> +\t\tstate->group_id_ = gst_util_group_id_next();\n> +\t}\n\nAs you never reset this group ID, why don't you pick an ID directly in the\nconstructor ? (libcamera_src_init() function). Or perhaps we need to read again\nthe semantic of that group ID, and then grab a new one everything we cycle\nthrough READ state ?\n\n>  \tgint stream_id_num = 0;\n>  \tStreamRoles roles;\n>  \tfor (GstPad *srcpad : state->srcpads_) {\n>  \t\t/* Create stream-id and push stream-start. */\n> -\t\tg_autofree gchar *stream_id_intermediate = g_strdup_printf(\"%i%i\", group_id, stream_id_num++);\n> +\t\tg_autofree gchar *stream_id_intermediate = g_strdup_printf(\"%i%i\", state->group_id_, stream_id_num++);\n>  \t\tg_autofree gchar *stream_id = gst_pad_create_stream_id(srcpad, GST_ELEMENT(self), stream_id_intermediate);\n>  \t\tGstEvent *event = gst_event_new_stream_start(stream_id);\n> -\t\tgst_event_set_group_id(event, group_id);\n> +\t\tgst_event_set_group_id(event, state->group_id_);\n>  \t\tgst_pad_push_event(srcpad, event);\n>  \n>  \t\t/* Collect the streams roles for the next iteration. */\n> @@ -636,6 +639,7 @@ gst_libcamera_src_init(GstLibcameraSrc *self)\n>  \n>  \tstate->srcpads_.push_back(gst_pad_new_from_template(templ, \"src\"));\n>  \tgst_element_add_pad(GST_ELEMENT(self), state->srcpads_[0]);\n> +\tstate->group_id_ = 0;\n\nnit: Optional, GObject are initialized to 0.\n\n>  \n>  \t/* C-style friend. */\n>  \tstate->src_ = self;","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 E037DC322B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 19 Jul 2021 13:27:00 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 2C5C66853E;\n\tMon, 19 Jul 2021 15:27:00 +0200 (CEST)","from mail-qt1-x82a.google.com (mail-qt1-x82a.google.com\n\t[IPv6:2607:f8b0:4864:20::82a])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 15A5C6851F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 19 Jul 2021 15:26:59 +0200 (CEST)","by mail-qt1-x82a.google.com with SMTP id q15so7966666qtp.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 19 Jul 2021 06:26:58 -0700 (PDT)","from nicolas-tpx395.localdomain (173-246-12-168.qc.cable.ebox.net.\n\t[173.246.12.168]) by smtp.gmail.com with ESMTPSA id\n\tq9sm4362110qkj.28.2021.07.19.06.26.57\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 19 Jul 2021 06:26:57 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=ndufresne-ca.20150623.gappssmtp.com\n\theader.i=@ndufresne-ca.20150623.gappssmtp.com\n\theader.b=\"L6piTUxI\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=ndufresne-ca.20150623.gappssmtp.com; s=20150623;\n\th=message-id:subject:from:to:date:in-reply-to:references:user-agent\n\t:mime-version:content-transfer-encoding;\n\tbh=Nwja1nARA9tUJYmgKvT81jHmawpnUiF42gLcVNDsIIY=;\n\tb=L6piTUxIflFRwEG2MG7f9U8u9K2iXZLeAONkpzTd+yBXqwPjAIfpXXPN7uwJFvaVFI\n\ti5je4tei9mgXmANjTGQ+pkqyw8mxPYeNg2e8hnow21XvKweHLoHP9Q4Sk5rUAszxiMK3\n\tZsFRU4wY4sUBto/xsF8n9+6i7jdUlVgnR9zxoREuCfRAMoW5i+pz53obXU6iPNEARgm5\n\tnhzfp3cMKn7JmO5tBs0j43vX7/NpuXQqF0vdbRl/rs9RGo3xZakXLf9tn87OlkEbyFzR\n\tL4YBQ7qVGFaFI5hsfmx58gTgA084H8iMi8dmugYMhsLaLc9oJIWByH8Xt/3Tz05jfL/n\n\tKDWA==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:message-id:subject:from:to:date:in-reply-to\n\t:references:user-agent:mime-version:content-transfer-encoding;\n\tbh=Nwja1nARA9tUJYmgKvT81jHmawpnUiF42gLcVNDsIIY=;\n\tb=Yg7scFITkgQfbEM+L+mBDvRZQAiY0OHtuEFjJ8CnyyRL1NQ/pZpkV33tVcAujopHu3\n\tYQb1y5WPvlkbntUriy4KoLFs/McL++esgsanFaxVtOaik0i1+sBnZowm30n/qnHaQde5\n\t95Xs6sgXdaBLcKslIo2Wy8CM9180mnQG8K18rrwlNmx0067yugvYg6ewFA+Xam8/EhMr\n\tXGiX4oJaX3t3i/wR7f56KkzOiGmychwekDUao73g21/jMChTtLgJke5Fdp4UZPqWQEjO\n\t50XKAMVbGVy1i4bGD9IikD0uyFDMlsiGtSyxnUgeN6Rru6uES49TF9+OxeQ0bMzdKe61\n\tBMVg==","X-Gm-Message-State":"AOAM531yoxtwL1S7YtGSPw5DOR5zCLF5DhyKS13JTAVk2d1cumax4Mhc\n\tSuWUptFC2SoD16rYUxGuigKtxv0xepMnqw==","X-Google-Smtp-Source":"ABdhPJws9F3xWhIl0OxGtfUXtRBxqLJRJD4HUmVrs4u6SVtA4t2twsjuCd3reizqAophIv1/YcVU3w==","X-Received":"by 2002:a05:622a:1653:: with SMTP id\n\ty19mr7558140qtj.305.1626701217737; \n\tMon, 19 Jul 2021 06:26:57 -0700 (PDT)","Message-ID":"<6ca73beb6be2f11626742c7e0d334df407b9c5e9.camel@ndufresne.ca>","From":"Nicolas Dufresne <nicolas@ndufresne.ca>","To":"Vedant Paranjape <vedantparanjape160201@gmail.com>, \n\tlibcamera-devel@lists.libcamera.org","Date":"Mon, 19 Jul 2021 09:26:56 -0400","In-Reply-To":"<20210717190233.763047-1-vedantparanjape160201@gmail.com>","References":"<20210717190233.763047-1-vedantparanjape160201@gmail.com>","Content-Type":"text/plain; charset=\"UTF-8\"","User-Agent":"Evolution 3.40.3 (3.40.3-1.fc34) ","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"Re: [libcamera-devel] [PATCH v2] gstreamer: Store group_id in\n\tGstLibcameraSrcState","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>"}}]