decodebin3: Avoid usage of parsebin even more

When dealing with push-based inputs, we are now delaying the creation of
parsebin/identity until we get all pre-buffer events.

We therefore can simplify the handling of new pads being linked and only have to
check if upstream can handle pull-based or not.

Avoids creating parsebin for parsed upstream data altogether

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6953>
This commit is contained in:
Edward Hervey 2024-05-29 10:31:19 +02:00
parent 013026b06a
commit 6c4f52ea20

View file

@ -1633,7 +1633,6 @@ gst_decodebin3_input_pad_link (GstPad * pad, GstObject * parent, GstPad * peer)
GstDecodebin3 *dbin = (GstDecodebin3 *) parent;
GstQuery *query;
gboolean pull_mode = FALSE;
gboolean has_caps = TRUE;
GstPadLinkReturn res = GST_PAD_LINK_OK;
DecodebinInput *input = g_object_get_data (G_OBJECT (pad), "decodebin.input");
@ -1650,26 +1649,12 @@ gst_decodebin3_input_pad_link (GstPad * pad, GstObject * parent, GstPad * peer)
GST_DEBUG_OBJECT (dbin, "Upstream can do pull-based : %d", pull_mode);
if (!pull_mode) {
/* If push-based, query if it will provide some caps */
query = gst_query_new_caps (NULL);
if (gst_pad_query (peer, query)) {
GstCaps *rescaps = NULL;
gst_query_parse_caps_result (query, &rescaps);
if (!rescaps || gst_caps_is_any (rescaps) || gst_caps_is_empty (rescaps)) {
GST_DEBUG_OBJECT (dbin, "Upstream can't provide caps");
has_caps = FALSE;
}
}
gst_query_unref (query);
}
/* If upstream *can* do pull-based OR it doesn't have any caps, we always use
* a parsebin. If not, we will delay that decision to a later stage
* (caps/stream/collection event processing) to figure out if one is really
* needed or whether an identity element will be enough */
/* If upstream *can* do pull-based we always use a parsebin. If not, we will
* delay that decision to a later stage (caps/stream/collection event
* processing) to figure out if one is really needed or whether an identity
* element will be enough */
INPUT_LOCK (dbin);
if (pull_mode || !has_caps) {
if (pull_mode) {
if (!gst_decodebin_input_ensure_parsebin (input))
res = GST_PAD_LINK_REFUSED;
else if (input->identity) {