splitmuxsrc: Convert part reader to a bin with a non-async bus
authorSebastian Dröge <sebastian@centricular.com>
Mon, 25 Nov 2024 12:25:52 +0000 (14:25 +0200)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Mon, 25 Nov 2024 17:01:07 +0000 (17:01 +0000)
A pipeline always has an async bus, which involves allocating an fd pair. As
splitmuxsrc only uses the bus' sync handler, this is not required and can easily
cause splitmuxsrc to exceed the fd limit for no good reason.

The other features of GstPipeline are also not needed here, e.g. clock selection.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7957>

subprojects/gst-plugins-good/gst/multifile/gstsplitmuxpartreader.c
subprojects/gst-plugins-good/gst/multifile/gstsplitmuxpartreader.h

index b7d79fb6a7ff9f54195dae4622e3b50e52351fd4..13ab57a5fdb262d4492252540fde48a8fbde5bc6 100644 (file)
@@ -650,8 +650,7 @@ static void splitmux_part_reader_finalize (GObject * object);
 static void splitmux_part_reader_reset (GstSplitMuxPartReader * reader);
 
 #define gst_splitmux_part_reader_parent_class parent_class
-G_DEFINE_TYPE (GstSplitMuxPartReader, gst_splitmux_part_reader,
-    GST_TYPE_PIPELINE);
+G_DEFINE_TYPE (GstSplitMuxPartReader, gst_splitmux_part_reader, GST_TYPE_BIN);
 
 static void
 gst_splitmux_part_reader_class_init (GstSplitMuxPartReaderClass * klass)
@@ -676,6 +675,7 @@ static void
 gst_splitmux_part_reader_init (GstSplitMuxPartReader * reader)
 {
   GstElement *typefind;
+  GstBus *bus;
 
   reader->active = FALSE;
   reader->duration = GST_CLOCK_TIME_NONE;
@@ -685,6 +685,10 @@ gst_splitmux_part_reader_init (GstSplitMuxPartReader * reader)
   g_mutex_init (&reader->type_lock);
   g_mutex_init (&reader->msg_lock);
 
+  bus = g_object_new (GST_TYPE_BUS, "enable-async", FALSE, NULL);
+  gst_element_set_bus (GST_ELEMENT_CAST (reader), bus);
+  gst_object_unref (bus);
+
   /* FIXME: Create elements on a state change */
   reader->src = gst_element_factory_make ("filesrc", NULL);
   if (reader->src == NULL) {
index 78ecc6eb5a778716a62b452949084d55789fd252..13fd66419c3202778adcbec8e537e4cdb478dcb6 100644 (file)
@@ -54,7 +54,7 @@ typedef GstPad *(*GstSplitMuxPartReaderPadCb)(GstSplitMuxPartReader *reader, Gst
 
 struct _GstSplitMuxPartReader
 {
-  GstPipeline parent;
+  GstBin parent;
 
   GstSplitMuxPartState prep_state;
 
@@ -88,7 +88,7 @@ struct _GstSplitMuxPartReader
 
 struct _GstSplitMuxPartReaderClass
 {
-  GstPipelineClass parent_class;
+  GstBinClass parent_class;
 
   void (*prepared)  (GstSplitMuxPartReader *reader);
   void (*end_of_part) (GstSplitMuxPartReader *reader);