From patchwork Mon Jul 19 14:34:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vedant Paranjape X-Patchwork-Id: 13043 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 A361FC0109 for ; Mon, 19 Jul 2021 14:35:08 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id BEDB16853C; Mon, 19 Jul 2021 16:35:07 +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="iDV/Sy4z"; dkim-atps=neutral Received: from mail-pf1-x435.google.com (mail-pf1-x435.google.com [IPv6:2607:f8b0:4864:20::435]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id E6C1C6851F for ; Mon, 19 Jul 2021 16:35:05 +0200 (CEST) Received: by mail-pf1-x435.google.com with SMTP id p36so16633104pfw.11 for ; Mon, 19 Jul 2021 07:35:05 -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=VPF5JYauVk6bCLhEzJm7QdoiutNZyZgZSTcsTTk4/Uc=; b=iDV/Sy4zv+xpcoM671yjqZjJZChZzhGsqGuBIpqND9ucr6+6TVRo4slup5gj9HeT1f S6xAz7pAG+11Djop/OZ41CoUZR/WdfCCiYILlNc+e3J5bJw2n/uLx9l28dY9VCbs6k5w VHz7bbQWQuSryyeOYI+Lu3LG/8PROG6oaeq/xnDRyybfzbC/y/obf/DT3DPBCS/FRBjb yrwpoFRK+BUkQ3crm2xl42Q7HfB5uXiJaihZPxXp6m5W6080fDdVJC7Ht0i4oL69V1kE h7GVXEYVIcnRf+IBWXH+p0vrLkXtlJmbxNzJkUdQ2pmHzI+0s8K4iw8/rjlgYvY+KTPP HgWg== 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=VPF5JYauVk6bCLhEzJm7QdoiutNZyZgZSTcsTTk4/Uc=; b=awedCBCj+eNgRc3MsSRSuGtnoffkVOb8Gv+nu5imHNN/0VxoVj6WGHlnl8ToswpZCc 9g734qs8OQxKGFpvaIgVc2OpGxgzneH+1JBfEP1t62GnfxtRyspV22H1PrCaub1bm0va BRdZ6HhoVbOfDWe1J5aVbtEk0amX7h4Db/7L53UA3qMVJRi9QVq8wZDyhN+jyUbwcvqD 3IRvRXOFm3h8gxlQKkZmhN4Mkp5dUUIkc9wMdyLzdsDAYoLl4D4BBdkqR2g5Fp5utKvq dzWko4QF+A1BIdOAUuHx+fvTbYpl5e5qctFfMCIQIEhVnTA+CWQOxIPszb9N7gSPi3xm Bo/A== X-Gm-Message-State: AOAM531hmefEMh0TmNku1IZriymvKVGggZ55R4GekOuZ+wTBqkb4TdkK KbFpYjcSFR5t435If47xWKQkWUfhtfUAWT4x X-Google-Smtp-Source: ABdhPJwg/g/rFjQQFvyLYhntT/8YETjuR460sV+Bgss4S7nrHeg4TU1O/bdxxWqy1W7+nFkNkk6Hrg== X-Received: by 2002:a05:6a00:1822:b029:32b:cf78:405 with SMTP id y34-20020a056a001822b029032bcf780405mr26348881pfa.80.1626705303766; Mon, 19 Jul 2021 07:35:03 -0700 (PDT) Received: from localhost.localdomain ([1.186.166.226]) by smtp.googlemail.com with ESMTPSA id ce15sm17262691pjb.3.2021.07.19.07.35.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Jul 2021 07:35:03 -0700 (PDT) From: Vedant Paranjape To: libcamera-devel@lists.libcamera.org Date: Mon, 19 Jul 2021 20:04:42 +0530 Message-Id: <20210719143442.1328281-1-vedantparanjape160201@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3] 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 | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/gstreamer/gstlibcamerasrc.cpp b/src/gstreamer/gstlibcamerasrc.cpp index ea53c2b5..37ddf78d 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,14 @@ 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(); 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 +636,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_ = gst_util_group_id_next(); /* C-style friend. */ state->src_ = self;