From 1a30ed81137f29b207cbbb4c5dda2b3b3c771862 Mon Sep 17 00:00:00 2001 From: Edward Hervey Date: Thu, 19 Jan 2023 16:25:51 +0100 Subject: [PATCH] decodebin3: Don't insert parsebin if input is already parsed This is a temporary workaround until we find a generic solution to indicate that a stream has already been "parsed". Part-of: --- subprojects/gst-plugins-base/gst/playback/gstdecodebin3.c | 11 +++++++++++ subprojects/gst-plugins-base/gst/playback/gsturisourcebin.c | 12 ++++++++++++ 2 files changed, 23 insertions(+) diff --git a/subprojects/gst-plugins-base/gst/playback/gstdecodebin3.c b/subprojects/gst-plugins-base/gst/playback/gstdecodebin3.c index 6cff8c4..92e17fb 100644 --- a/subprojects/gst-plugins-base/gst/playback/gstdecodebin3.c +++ b/subprojects/gst-plugins-base/gst/playback/gstdecodebin3.c @@ -302,6 +302,10 @@ struct _DecodebinInput /* TRUE if the input got drained */ gboolean drained; + + /* TEMPORARY HACK for knowing if upstream is already parsed and identity can + * be avoided */ + gboolean input_is_parsed; }; /* Multiqueue Slots */ @@ -1231,6 +1235,9 @@ is_parsebin_required_for_input (GstDecodebin3 * dbin, DecodebinInput * input, /* If the incoming caps match decodebin3 output, no processing is needed */ GST_FIXME_OBJECT (sinkpad, "parsebin not needed (matches output caps) !"); parsebin_needed = FALSE; + } else if (input->input_is_parsed) { + GST_DEBUG_OBJECT (sinkpad, "input is parsed, no parsebin needed"); + parsebin_needed = FALSE; } else { GList *decoder_list; /* If the incoming caps are compatible with a decoder, we don't need to @@ -1301,6 +1308,7 @@ sink_event_function (GstPad * sinkpad, GstDecodebin3 * dbin, GstEvent * event) case GST_EVENT_STREAM_START: { GstQuery *q = gst_query_new_selectable (); + const GstStructure *s = gst_event_get_structure (event); /* Query whether upstream can handle stream selection or not */ if (gst_pad_peer_query (sinkpad, q)) { @@ -1318,6 +1326,9 @@ sink_event_function (GstPad * sinkpad, GstDecodebin3 * dbin, GstEvent * event) if (input->upstream_selected) dbin->upstream_selected = TRUE; + input->input_is_parsed = s + && gst_structure_has_field (s, "urisourcebin-parsed-data"); + /* Make sure group ids will be recalculated */ input->group_id = GST_GROUP_ID_INVALID; INPUT_LOCK (dbin); diff --git a/subprojects/gst-plugins-base/gst/playback/gsturisourcebin.c b/subprojects/gst-plugins-base/gst/playback/gsturisourcebin.c index f108caf..1350824 100644 --- a/subprojects/gst-plugins-base/gst/playback/gsturisourcebin.c +++ b/subprojects/gst-plugins-base/gst/playback/gsturisourcebin.c @@ -844,6 +844,18 @@ demux_pad_events (GstPad * pad, GstPadProbeInfo * info, OutputSlotInfo * slot) } break; case GST_EVENT_STREAM_START: + { + /* This is a temporary hack to notify downstream decodebin3 to *not* + * plug in an extra parsebin */ + if (slot->linked_info && slot->linked_info->demuxer_is_parsebin) { + GstStructure *s; + GST_PAD_PROBE_INFO_DATA (info) = ev = gst_event_make_writable (ev); + s = (GstStructure *) gst_event_get_structure (ev); + gst_structure_set (s, "urisourcebin-parsed-data", G_TYPE_BOOLEAN, TRUE, + NULL); + } + } + /* PASSTHROUGH */ case GST_EVENT_FLUSH_STOP: BUFFERING_LOCK (urisrc); slot->is_eos = FALSE; -- 2.7.4