From f204d17ec9966a4cc1c4629e2dae0c97d95c55f9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sebastian=20Dr=C3=B6ge?= Date: Mon, 25 Nov 2024 14:25:52 +0200 Subject: [PATCH] splitmuxsrc: Convert part reader to a bin with a non-async bus 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: --- .../gst/multifile/gstsplitmuxpartreader.c | 8 ++++++-- .../gst/multifile/gstsplitmuxpartreader.h | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/subprojects/gst-plugins-good/gst/multifile/gstsplitmuxpartreader.c b/subprojects/gst-plugins-good/gst/multifile/gstsplitmuxpartreader.c index b7d79fb6a7..13ab57a5fd 100644 --- a/subprojects/gst-plugins-good/gst/multifile/gstsplitmuxpartreader.c +++ b/subprojects/gst-plugins-good/gst/multifile/gstsplitmuxpartreader.c @@ -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) { diff --git a/subprojects/gst-plugins-good/gst/multifile/gstsplitmuxpartreader.h b/subprojects/gst-plugins-good/gst/multifile/gstsplitmuxpartreader.h index 78ecc6eb5a..13fd66419c 100644 --- a/subprojects/gst-plugins-good/gst/multifile/gstsplitmuxpartreader.h +++ b/subprojects/gst-plugins-good/gst/multifile/gstsplitmuxpartreader.h @@ -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); -- 2.34.1