summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Dufresne <nicolas.dufresne@collabora.com>2020-01-21 19:13:05 -0500
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2020-03-07 01:57:45 +0200
commite5f4398c1926dfe153a4c5d6b8b3c6b0be2c0037 (patch)
tree74c22b17d01bb790687f5bb66edeefc793356b3c
parent6d69661c24eb66981c8554a2dfd532057dc1baef (diff)
gst: libcamerasrc: Send stream start event
Prior to sending caps, we need to send a stream-start event. This requires generating a stream and a group id. The stream id is random for live sources and the group id is shared across all pads. Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-rw-r--r--src/gstreamer/gstlibcamerasrc.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/gstreamer/gstlibcamerasrc.cpp b/src/gstreamer/gstlibcamerasrc.cpp
index aa91619f..16803142 100644
--- a/src/gstreamer/gstlibcamerasrc.cpp
+++ b/src/gstreamer/gstlibcamerasrc.cpp
@@ -131,8 +131,19 @@ static void
gst_libcamera_src_task_enter(GstTask *task, GThread *thread, gpointer user_data)
{
GstLibcameraSrc *self = GST_LIBCAMERA_SRC(user_data);
+ GLibRecLocker lock(&self->stream_lock);
+ GstLibcameraSrcState *state = self->state;
GST_DEBUG_OBJECT(self, "Streaming thread has started");
+
+ guint group_id = gst_util_group_id_next();
+ for (GstPad *srcpad : state->srcpads_) {
+ /* Create stream-id and push stream-start. */
+ g_autofree gchar *stream_id = gst_pad_create_stream_id(srcpad, GST_ELEMENT(self), nullptr);
+ GstEvent *event = gst_event_new_stream_start(stream_id);
+ gst_event_set_group_id(event, group_id);
+ gst_pad_push_event(srcpad, event);
+ }
}
static void