From patchwork Sat Jul 17 19:02:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vedant Paranjape X-Patchwork-Id: 13034 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 4A5FEC3228 for ; Sat, 17 Jul 2021 19:02:51 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id B99A768516; Sat, 17 Jul 2021 21:02:50 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="iRfWRDjz"; dkim-atps=neutral Received: from mail-pj1-x102d.google.com (mail-pj1-x102d.google.com [IPv6:2607:f8b0:4864:20::102d]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id EB9736027B for ; Sat, 17 Jul 2021 21:02:49 +0200 (CEST) Received: by mail-pj1-x102d.google.com with SMTP id my10so8593731pjb.1 for ; Sat, 17 Jul 2021 12:02:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=nRScZUmwQF9yc1tIAAzNl3v2hRGKbIpJWJXorRXNlIE=; b=iRfWRDjzzEt+TXQqzrQiWilNQlpBn2LvZGlGHOm9wkrefwCsgsyjd1bwXBAlzc9mw6 gUadyfrgmXxQlrJwuAZetx6vjsTaHJ+DVgUiu/8fCd4epBGtAEFX99mrbJYj3dcyJFED GZ18AgNLBbzrYMnwkkQoMesBJFEhR6vxbXsAdlw6qraiX5ePMNRC2adHd58QS5kdfhB7 JvndVIdosUoF+3xXTnupgLmL7MrhMW6xd4PVpc6FECMhiVTKWBajvhO7ADG7K42Rsb7E U+NJ7KG86YhMpyJmI3c/YFA+po4bFRM36Z/wEb5kzaIdBqj5klN86Ox8T+gkHfzUyHeo 36Ig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=nRScZUmwQF9yc1tIAAzNl3v2hRGKbIpJWJXorRXNlIE=; b=FSTn7n9PD5uk6Zc3Sytg2yhpq3eUXdDgUJCa2yDSGo2s7aTjiHZWG77JWujez5Q84k qaJx7gAA7WWiXcJoYigaF5+UWbSRfw34EoZAkPSNO0+j8KDn0bba9CQy2FbQqkV6JLLW hHRWtAmkfQHYSdZniqbOj5pqoD4w0QQQ6tl0Z5y04RjDFMTL/hcHP5aRYbqwpnunabw2 Aij39hfJdTPqeOcPg2z47aZxA32ARTRyXMzUUNbN2p2Mq5qNZwEwHPDJZX5icIc58o8W cYV/SwcXmHAue3h7wuQJ/vPPPNcJLVtyV9Ua543UwJt9RivMrInYppPJdqgOnPmdX/GD JSCw== X-Gm-Message-State: AOAM530tvqXgyFZdLZsHcs+7MeGRCX1o4Uc9t/XjCVDczG/3ggdq8BEf jJL1DJfVzqyaz/F7z3iFBSmCU3WKxIJOYIiB X-Google-Smtp-Source: ABdhPJzgM6si7eHsCB1ZA2vPZ6MALsomRFc4Qu1ApxA5bcfZNSa1uTijFP/wqta9KZipyHySy3dO1w== X-Received: by 2002:a17:902:c402:b029:12b:229:f4a with SMTP id k2-20020a170902c402b029012b02290f4amr12834923plk.54.1626548567882; Sat, 17 Jul 2021 12:02:47 -0700 (PDT) Received: from localhost.localdomain ([1.186.166.91]) by smtp.googlemail.com with ESMTPSA id i18sm13938760pgb.83.2021.07.17.12.02.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Jul 2021 12:02:47 -0700 (PDT) From: Vedant Paranjape To: libcamera-devel@lists.libcamera.org Date: Sun, 18 Jul 2021 00:32:33 +0530 Message-Id: <20210717190233.763047-1-vedantparanjape160201@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2] gstreamer: Store group_id in GstLibcameraSrcState 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: , Cc: Vedant Paranjape Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" This patch adds group_id in GstLibcameraSrcState, since group_id is something which should be same for all the pads, it can be reused later. Signed-off-by: Vedant Paranjape --- src/gstreamer/gstlibcamerasrc.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/gstreamer/gstlibcamerasrc.cpp b/src/gstreamer/gstlibcamerasrc.cpp index ea53c2b5..79b0d867 100644 --- a/src/gstreamer/gstlibcamerasrc.cpp +++ b/src/gstreamer/gstlibcamerasrc.cpp @@ -113,6 +113,7 @@ struct GstLibcameraSrcState { std::unique_ptr config_; std::vector srcpads_; std::queue> requests_; + guint group_id_; void requestCompleted(Request *request); }; @@ -360,15 +361,17 @@ gst_libcamera_src_task_enter(GstTask *task, [[maybe_unused]] GThread *thread, GST_DEBUG_OBJECT(self, "Streaming thread has started"); - guint group_id = gst_util_group_id_next(); + if (state->group_id_ == 0) { + state->group_id_ = gst_util_group_id_next(); + } gint stream_id_num = 0; StreamRoles roles; for (GstPad *srcpad : state->srcpads_) { /* Create stream-id and push stream-start. */ - g_autofree gchar *stream_id_intermediate = g_strdup_printf("%i%i", group_id, stream_id_num++); + g_autofree gchar *stream_id_intermediate = g_strdup_printf("%i%i", state->group_id_, stream_id_num++); g_autofree gchar *stream_id = gst_pad_create_stream_id(srcpad, GST_ELEMENT(self), stream_id_intermediate); GstEvent *event = gst_event_new_stream_start(stream_id); - gst_event_set_group_id(event, group_id); + gst_event_set_group_id(event, state->group_id_); gst_pad_push_event(srcpad, event); /* Collect the streams roles for the next iteration. */ @@ -636,6 +639,7 @@ gst_libcamera_src_init(GstLibcameraSrc *self) state->srcpads_.push_back(gst_pad_new_from_template(templ, "src")); gst_element_add_pad(GST_ELEMENT(self), state->srcpads_[0]); + state->group_id_ = 0; /* C-style friend. */ state->src_ = self;