From 025b4a2f8d7cf98a361da93e78fbc48825241b80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?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 | 9 +++++++-- .../gst/multifile/gstsplitmuxpartreader.h | 4 ++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/subprojects/gst-plugins-good/gst/multifile/gstsplitmuxpartreader.c b/subprojects/gst-plugins-good/gst/multifile/gstsplitmuxpartreader.c index 2feffd9a2c..b3ea7da61c 100644 --- a/subprojects/gst-plugins-good/gst/multifile/gstsplitmuxpartreader.c +++ b/subprojects/gst-plugins-good/gst/multifile/gstsplitmuxpartreader.c @@ -687,8 +687,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) @@ -745,6 +744,8 @@ create_elements (GstSplitMuxPartReader * reader) static void gst_splitmux_part_reader_init (GstSplitMuxPartReader * reader) { + GstBus *bus; + reader->prep_state = PART_STATE_NULL; reader->need_duration_measuring = TRUE; @@ -759,6 +760,10 @@ gst_splitmux_part_reader_init (GstSplitMuxPartReader * reader) g_mutex_init (&reader->lock); 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); } static void diff --git a/subprojects/gst-plugins-good/gst/multifile/gstsplitmuxpartreader.h b/subprojects/gst-plugins-good/gst/multifile/gstsplitmuxpartreader.h index dc387921ec..0de865c698 100644 --- a/subprojects/gst-plugins-good/gst/multifile/gstsplitmuxpartreader.h +++ b/subprojects/gst-plugins-good/gst/multifile/gstsplitmuxpartreader.h @@ -63,7 +63,7 @@ struct _GstSplitMuxPartReaderInfo struct _GstSplitMuxPartReader { - GstPipeline parent; + GstBin parent; GstSplitMuxPartState prep_state; gboolean need_duration_measuring; @@ -105,7 +105,7 @@ struct _GstSplitMuxPartReader struct _GstSplitMuxPartReaderClass { - GstPipelineClass parent_class; + GstBinClass parent_class; void (*prepared) (GstSplitMuxPartReader *reader); void (*end_of_part) (GstSplitMuxPartReader *reader);