[libcamera-devel,v1] gstreamer: Store group_id in GstLibcameraSrcState
diff mbox series

Message ID 20210717182850.737833-1-vedantparanjape160201@gmail.com
State Superseded
Headers show
Series
  • [libcamera-devel,v1] gstreamer: Store group_id in GstLibcameraSrcState
Related show

Commit Message

Vedant Paranjape July 17, 2021, 6:28 p.m. UTC
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 <vedantparanjape160201@gmail.com>
---
 src/gstreamer/gstlibcamerasrc.cpp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Patch
diff mbox series

diff --git a/src/gstreamer/gstlibcamerasrc.cpp b/src/gstreamer/gstlibcamerasrc.cpp
index ea53c2b5..ad3c692f 100644
--- a/src/gstreamer/gstlibcamerasrc.cpp
+++ b/src/gstreamer/gstlibcamerasrc.cpp
@@ -113,6 +113,7 @@  struct GstLibcameraSrcState {
 	std::unique_ptr<CameraConfiguration> config_;
 	std::vector<GstPad *> srcpads_;
 	std::queue<std::unique_ptr<RequestWrap>> requests_;
+	guint group_id_;
 
 	void requestCompleted(Request *request);
 };
@@ -360,7 +361,9 @@  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) {
+		guint group_id = gst_util_group_id_next();
+	}
 	gint stream_id_num = 0;
 	StreamRoles roles;
 	for (GstPad *srcpad : state->srcpads_) {
@@ -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;