(uri)decodebin3: Ensure group-id consistency

Make sure that group-id of a given play item are made consistent from the
start (sources) and all the way through the output.

This ensures that we can reliably detect that we have switched to the next play
item on the output of decodebin3 (and we can therefore properly free/release it)

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3457>
This commit is contained in:
Edward Hervey 2022-08-09 16:31:26 +02:00 committed by GStreamer Marge Bot
parent 353691602e
commit 734a4554f3
2 changed files with 20 additions and 1 deletions

View file

@ -1036,6 +1036,10 @@ gst_decodebin3_input_pad_unlink (GstPad * pad, GstPad * peer,
GST_DEBUG_OBJECT (dbin, "Resetting parsebin since it's pull-based");
reset_input_parsebin (dbin, input);
}
/* In all cases we will be receiving new stream-start and data */
input->group_id = GST_GROUP_ID_INVALID;
input->drained = FALSE;
recalculate_group_id (dbin);
INPUT_UNLOCK (dbin);
}

View file

@ -688,7 +688,7 @@ add_output_pad (GstURIDecodeBin3 * dec, GstPad * target_pad)
output->uridecodebin = dec;
output->target_pad = target_pad;
output->current_group_id = (guint) - 1;
output->current_group_id = GST_GROUP_ID_INVALID;
pad_name = gst_pad_get_name (target_pad);
output->ghost_pad = gst_ghost_pad_new (pad_name, target_pad);
g_free (pad_name);
@ -1173,7 +1173,22 @@ uri_src_probe (GstPad * pad, GstPadProbeInfo * info, GstSourcePad * srcpad)
case GST_EVENT_STREAM_START:
{
GstStream *stream = NULL;
guint group_id = GST_GROUP_ID_INVALID;
srcpad->saw_eos = FALSE;
gst_event_parse_group_id (event, &group_id);
/* Unify group id */
if (handler->play_item->group_id == GST_GROUP_ID_INVALID) {
GST_DEBUG_OBJECT (pad,
"Setting play item to group_id %" G_GUINT32_FORMAT, group_id);
handler->play_item->group_id = group_id;
} else if (handler->play_item->group_id != group_id) {
GST_DEBUG_OBJECT (pad, "Updating event group-id to %" G_GUINT32_FORMAT,
handler->play_item->group_id);
event = gst_event_make_writable (event);
GST_PAD_PROBE_INFO_DATA (info) = event;
gst_event_set_group_id (event, handler->play_item->group_id);
}
gst_event_parse_stream (event, &stream);
if (stream) {
GST_DEBUG_OBJECT (srcpad->src_pad, "Got GstStream %" GST_PTR_FORMAT,