urisourcebin: When streams-aware, remove pads immediately

For the same reason we add them immediately

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1905>
This commit is contained in:
Edward Hervey 2021-06-09 11:25:36 +02:00 committed by GStreamer Marge Bot
parent 8648182fd1
commit a6f213ad62

View file

@ -103,6 +103,7 @@ struct _ChildSrcPadInfo
* the pad owns the ChildSrcPadInfo as qdata */
GstPad *src_pad;
GstCaps *cur_caps; /* holds ref */
GstPad *ghost_pad; /* ghostpad if any */
/* Configured output slot, if any */
OutputSlotInfo *output_slot;
@ -673,11 +674,11 @@ new_demuxer_pad_added_cb (GstElement * element, GstPad * pad,
/* If the demuxer handles buffering and is streams-aware, we can expose it
as-is directly. We still add an event probe to deal with EOS */
if (urisrc->demuxer_handles_buffering && urisrc->source_streams_aware) {
GstPad *ghostpad = create_output_pad (urisrc, pad);
info->ghost_pad = create_output_pad (urisrc, pad);
GST_DEBUG_OBJECT (element,
"New streams-aware demuxer pad %s:%s , exposing directly",
GST_DEBUG_PAD_NAME (pad));
expose_output_pad (urisrc, ghostpad);
expose_output_pad (urisrc, info->ghost_pad);
GST_URI_SOURCE_BIN_UNLOCK (urisrc);
} else {
GST_DEBUG_OBJECT (element, "new demuxer pad, name: <%s>. "
@ -1414,6 +1415,11 @@ pad_removed_cb (GstElement * element, GstPad * pad, GstURISourceBin * urisrc)
remove_output_pad (urisrc, info->output_pad);
} else {
GST_LOG_OBJECT (urisrc, "Removed pad has no output slot or pad");
if (urisrc->source_streams_aware) {
GST_DEBUG_OBJECT (info->ghost_pad,
"Streams-aware, removing pad immediately");
gst_element_remove_pad ((GstElement *) urisrc, info->ghost_pad);
}
}
GST_URI_SOURCE_BIN_UNLOCK (urisrc);