decodebin3: fix EOS event sequence

See docs:
https://gstreamer.freedesktop.org/documentation/additional/design/seqnums.html?gi-language=c#seqnums-sequence-numbers

Per docs:
When a sink element receives an EOS event and creates a new EOS
message to post, it should copy the seqnum from the event to the
message because the EOS message is a consequence of the EOS event
being received.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2588>
This commit is contained in:
James Hilliard 2022-06-12 05:35:27 -06:00 committed by GStreamer Marge Bot
parent e72c867bf8
commit f34ee92999
2 changed files with 8 additions and 7 deletions

View file

@ -117,7 +117,7 @@ all_inputs_are_eos (GstDecodebin3 * dbin)
/* WITH SELECTION_LOCK TAKEN! */
static void
check_all_streams_for_eos (GstDecodebin3 * dbin)
check_all_streams_for_eos (GstDecodebin3 * dbin, GstEvent * event)
{
GList *tmp;
GList *outputpads = NULL;
@ -144,7 +144,7 @@ check_all_streams_for_eos (GstDecodebin3 * dbin)
GstPad *peer = (GstPad *) tmp->data;
/* Send EOS and then remove elements */
gst_pad_send_event (peer, gst_event_new_eos ());
gst_pad_send_event (peer, gst_event_ref (event));
GST_FIXME_OBJECT (peer, "Remove input stream");
gst_object_unref (peer);
}
@ -292,7 +292,7 @@ parse_chain_output_probe (GstPad * pad, GstPadProbeInfo * info,
if (all_inputs_are_eos (input->dbin)) {
GST_DEBUG_OBJECT (pad, "real input pad, marking as EOS");
SELECTION_LOCK (input->dbin);
check_all_streams_for_eos (input->dbin);
check_all_streams_for_eos (input->dbin, ev);
SELECTION_UNLOCK (input->dbin);
} else {
GstPad *peer = gst_pad_get_peer (input->srcpad);
@ -553,7 +553,7 @@ parsebin_pending_event_probe (GstPad * pad, GstPadProbeInfo * info,
g_free (ppad);
SELECTION_LOCK (dbin);
check_all_streams_for_eos (dbin);
check_all_streams_for_eos (dbin, ev);
SELECTION_UNLOCK (dbin);
}
break;

View file

@ -1857,7 +1857,7 @@ is_selection_done (GstDecodebin3 * dbin)
/* Must be called with SELECTION_LOCK taken */
static void
check_all_slot_for_eos (GstDecodebin3 * dbin)
check_all_slot_for_eos (GstDecodebin3 * dbin, GstEvent * ev)
{
gboolean all_drained = TRUE;
GList *iter;
@ -1922,6 +1922,7 @@ check_all_slot_for_eos (GstDecodebin3 * dbin)
}
eos = gst_event_new_eos ();
gst_event_set_seqnum (eos, gst_event_get_seqnum (ev));
gst_mini_object_set_qdata (GST_MINI_OBJECT_CAST (eos),
CUSTOM_FINAL_EOS_QUARK, (gchar *) CUSTOM_FINAL_EOS_QUARK_DATA,
NULL);
@ -2052,7 +2053,7 @@ multiqueue_src_probe (GstPad * pad, GstPadProbeInfo * info,
free_multiqueue_slot_async (dbin, slot);
ret = GST_PAD_PROBE_REMOVE;
} else if (!was_drained) {
check_all_slot_for_eos (dbin);
check_all_slot_for_eos (dbin, ev);
}
if (ret == GST_PAD_PROBE_HANDLED)
gst_event_unref (ev);
@ -2097,7 +2098,7 @@ multiqueue_src_probe (GstPad * pad, GstPadProbeInfo * info,
* when all output streams are also eos */
ret = GST_PAD_PROBE_DROP;
SELECTION_LOCK (dbin);
check_all_slot_for_eos (dbin);
check_all_slot_for_eos (dbin, ev);
SELECTION_UNLOCK (dbin);
}
}