summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Schmidt <jan@centricular.com>2016-10-26 14:32:48 +1100
committerJan Schmidt <jan@centricular.com>2016-10-26 20:17:40 +1100
commit5067d7254f16f9426c6b5dcd5a7c292d13752ba8 (patch)
tree55dad9b3d13c1795ba441db472497baedcef9f7c
parent917776730d6995f1a3b6321a26777e29df6bcd2c (diff)
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.
-rw-r--r--gst/multifile/gstsplitmuxsink.c16
-rw-r--r--gst/multifile/gstsplitmuxsink.h2
2 files changed, 18 insertions, 0 deletions
diff --git a/gst/multifile/gstsplitmuxsink.c b/gst/multifile/gstsplitmuxsink.c
index a1e784058..12b2cac76 100644
--- a/gst/multifile/gstsplitmuxsink.c
+++ b/gst/multifile/gstsplitmuxsink.c
@@ -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 */
diff --git a/gst/multifile/gstsplitmuxsink.h b/gst/multifile/gstsplitmuxsink.h
index aeda8a587..fe832a54b 100644
--- a/gst/multifile/gstsplitmuxsink.h
+++ b/gst/multifile/gstsplitmuxsink.h
@@ -129,6 +129,8 @@ struct _GstSplitMuxSink {
gboolean opening_first_fragment;
gboolean switching_fragment;
+
+ gboolean have_video;
};
struct _GstSplitMuxSinkClass {