From patchwork Tue Jul 20 16:00:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vedant Paranjape X-Patchwork-Id: 13061 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 B8F14C322B for ; Tue, 20 Jul 2021 16:00:55 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id DB5736852A; Tue, 20 Jul 2021 18:00:54 +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="UINU/V9P"; dkim-atps=neutral Received: from mail-pf1-x42f.google.com (mail-pf1-x42f.google.com [IPv6:2607:f8b0:4864:20::42f]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 5A64B68521 for ; Tue, 20 Jul 2021 18:00:53 +0200 (CEST) Received: by mail-pf1-x42f.google.com with SMTP id d12so19966025pfj.2 for ; Tue, 20 Jul 2021 09:00:53 -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=uxLXfe0QPpmC7ilWCQ31eA3NGCZI5Yd/zRFYfCPaTyg=; b=UINU/V9P3jakR/s3v89sbqaPttApzS9536pdz2Bhow3iZpJemccC9sX4MJ+l3G5HCy jRV8UOkBVWwc4GZUpaFQ5tKmbPa5t6bIWZVwxBaiUSOpIaCx9LBCPQUYK9TZSo65TzL6 GLMp1cMF37NkteCnHdz0fNkaL6ruihC3f1SwT2qs6jjAd/luV5pwSbnJaFjdD/7k9Tvc ZI+kb+0vjyiBZjyquWnX0kkaNHyUEgpixeJYEwIdzRgZ02cHAIMGBgvLyLFhLxQY1OaX /VM56pOADD4DZtZ4V2ow0ZmjV4C5T0qCm5+ZLhC7TOGWekiwmoO58uCfms8XvTClA25K hFhw== 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=uxLXfe0QPpmC7ilWCQ31eA3NGCZI5Yd/zRFYfCPaTyg=; b=ArtjwSvnPlzEy5eY5xVIGVcjdH1vYa0dvorHjbjGEF7hoN69nNSuRbEb5dxi91KuR0 k3zr5YB2l/CLoU2A0lBD4fyx20ovzkuPqWKEZzM9+Mt0B2f09WRpxOkJORGGdRwHPNCd LWnVDS/fItOEfkqgUC/tUoIDGU9RjLP1Fe7kt0RoUYYqNiN0qmImhTlsLUCQJWIszQB8 4TFHo4JVbNMvwlkldL4LKr0iMZnRgiTIaTszT2NDbS9YcF0V0WgImHvjHawL9uglXkp6 xWmc53FpWqx4NVdMPbxWZQX4SdrHcyKdD2sBDuF/pZbB8HoVZT0vBz2JqC7mOLe9TFtT cDSw== X-Gm-Message-State: AOAM532BkYdZTu840wFEJNdDgTACIvMAKRnFOMGrbUv7YbP45Lvf9tmE cY2k22g2SaJ+/IhE2aenGHLHL/VwLIxf5g== X-Google-Smtp-Source: ABdhPJwMN9aAoaekiSazAg1de0IVLsBuKVBtXOOvck2SOWdMwugfE/piFeAlez5v8EP3Q4eVRUaDyg== X-Received: by 2002:a63:1d47:: with SMTP id d7mr19756391pgm.44.1626796851294; Tue, 20 Jul 2021 09:00:51 -0700 (PDT) Received: from localhost.localdomain ([1.186.165.221]) by smtp.googlemail.com with ESMTPSA id u16sm27018010pgh.53.2021.07.20.09.00.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Jul 2021 09:00:50 -0700 (PDT) From: Vedant Paranjape To: libcamera-devel@lists.libcamera.org Date: Tue, 20 Jul 2021 21:30:34 +0530 Message-Id: <20210720160034.233363-1-vedantparanjape160201@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v4] 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 Reviewed-by: Nicolas Dufresne Reviewed-by: Paul Elder --- 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..b18f1efb 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. */ @@ -578,6 +578,7 @@ gst_libcamera_src_change_state(GstElement *element, GstStateChange transition) break; case GST_STATE_CHANGE_READY_TO_PAUSED: /* This needs to be called after pads activation.*/ + self->state->group_id_ = gst_util_group_id_next(); if (!gst_task_pause(self->task)) return GST_STATE_CHANGE_FAILURE; ret = GST_STATE_CHANGE_NO_PREROLL;