From 6c4f52ea20ce27730501348c6e575b8d35580239 Mon Sep 17 00:00:00 2001 From: Edward Hervey Date: Wed, 29 May 2024 10:31:19 +0200 Subject: [PATCH] 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: --- .../gst/playback/gstdecodebin3.c | 25 ++++--------------- 1 file changed, 5 insertions(+), 20 deletions(-) diff --git a/subprojects/gst-plugins-base/gst/playback/gstdecodebin3.c b/subprojects/gst-plugins-base/gst/playback/gstdecodebin3.c index d69eddf268..1985395313 100644 --- a/subprojects/gst-plugins-base/gst/playback/gstdecodebin3.c +++ b/subprojects/gst-plugins-base/gst/playback/gstdecodebin3.c @@ -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) {