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: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3754>
This commit is contained in:
Edward Hervey 2023-01-19 16:25:51 +01:00 committed by GStreamer Marge Bot
parent f983ec50b5
commit 1a30ed8113
2 changed files with 23 additions and 0 deletions

View file

@ -302,6 +302,10 @@ struct _DecodebinInput
/* TRUE if the input got drained */ /* TRUE if the input got drained */
gboolean drained; gboolean drained;
/* TEMPORARY HACK for knowing if upstream is already parsed and identity can
* be avoided */
gboolean input_is_parsed;
}; };
/* Multiqueue Slots */ /* 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 */ /* If the incoming caps match decodebin3 output, no processing is needed */
GST_FIXME_OBJECT (sinkpad, "parsebin not needed (matches output caps) !"); GST_FIXME_OBJECT (sinkpad, "parsebin not needed (matches output caps) !");
parsebin_needed = FALSE; parsebin_needed = FALSE;
} else if (input->input_is_parsed) {
GST_DEBUG_OBJECT (sinkpad, "input is parsed, no parsebin needed");
parsebin_needed = FALSE;
} else { } else {
GList *decoder_list; GList *decoder_list;
/* If the incoming caps are compatible with a decoder, we don't need to /* 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: case GST_EVENT_STREAM_START:
{ {
GstQuery *q = gst_query_new_selectable (); GstQuery *q = gst_query_new_selectable ();
const GstStructure *s = gst_event_get_structure (event);
/* Query whether upstream can handle stream selection or not */ /* Query whether upstream can handle stream selection or not */
if (gst_pad_peer_query (sinkpad, q)) { if (gst_pad_peer_query (sinkpad, q)) {
@ -1318,6 +1326,9 @@ sink_event_function (GstPad * sinkpad, GstDecodebin3 * dbin, GstEvent * event)
if (input->upstream_selected) if (input->upstream_selected)
dbin->upstream_selected = TRUE; dbin->upstream_selected = TRUE;
input->input_is_parsed = s
&& gst_structure_has_field (s, "urisourcebin-parsed-data");
/* Make sure group ids will be recalculated */ /* Make sure group ids will be recalculated */
input->group_id = GST_GROUP_ID_INVALID; input->group_id = GST_GROUP_ID_INVALID;
INPUT_LOCK (dbin); INPUT_LOCK (dbin);

View file

@ -844,6 +844,18 @@ demux_pad_events (GstPad * pad, GstPadProbeInfo * info, OutputSlotInfo * slot)
} }
break; break;
case GST_EVENT_STREAM_START: 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: case GST_EVENT_FLUSH_STOP:
BUFFERING_LOCK (urisrc); BUFFERING_LOCK (urisrc);
slot->is_eos = FALSE; slot->is_eos = FALSE;