Commit 5067d725 authored by Jan Schmidt's avatar Jan Schmidt

splitmuxsink: Only allow one video request pad

The pacing of the overall muxing is controlled
by the video GOPs arriving, so we can only handle
1 video stream, and the request pad is named accordingly.

Ignore a request for a 2nd video pad if there's already
an active one.
parent 91777673
......@@ -1371,6 +1371,9 @@ gst_splitmux_sink_request_new_pad (GstElement * element,
if (templ->name_template) {
if (g_str_equal (templ->name_template, "video")) {
if (splitmux->have_video)
goto already_have_video;
/* FIXME: Look for a pad template with matching caps, rather than by name */
mux_template =
gst_element_class_get_pad_template (GST_ELEMENT_GET_CLASS
......@@ -1454,14 +1457,22 @@ gst_splitmux_sink_request_new_pad (GstElement * element,
gst_object_unref (mq_sink);
gst_object_unref (mq_src);
if (is_video)
splitmux->have_video = TRUE;
gst_pad_set_active (res, TRUE);
gst_element_add_pad (element, res);
GST_SPLITMUX_UNLOCK (splitmux);
return res;
fail:
GST_SPLITMUX_UNLOCK (splitmux);
return NULL;
already_have_video:
GST_DEBUG_OBJECT (splitmux, "video sink pad already requested");
GST_SPLITMUX_UNLOCK (splitmux);
return NULL;
}
static void
......@@ -1507,6 +1518,11 @@ gst_splitmux_sink_release_pad (GstElement * element, GstPad * pad)
gst_object_unref (mqsrc);
gst_object_unref (muxpad);
if (GST_PAD_PAD_TEMPLATE (pad) &&
g_str_equal (GST_PAD_TEMPLATE_NAME_TEMPLATE (GST_PAD_PAD_TEMPLATE (pad)),
"video"))
splitmux->have_video = FALSE;
gst_element_remove_pad (element, pad);
/* Reset the internal elements only after all request pads are released */
......
......@@ -129,6 +129,8 @@ struct _GstSplitMuxSink {
gboolean opening_first_fragment;
gboolean switching_fragment;
gboolean have_video;
};
struct _GstSplitMuxSinkClass {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment