mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 10:11:08 +00:00
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.
This commit is contained in:
parent
917776730d
commit
5067d7254f
2 changed files with 18 additions and 0 deletions
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue