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: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7952>
This commit is contained in:
Sebastian Dröge 2024-11-25 14:25:52 +02:00
parent 18b941dfd5
commit 025b4a2f8d
2 changed files with 9 additions and 4 deletions

View file

@ -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

View file

@ -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);