From 1fff4ef6351013dad31084abe950c03818ac6a3d Mon Sep 17 00:00:00 2001 From: James Hilliard Date: Sun, 12 Jun 2022 05:35:27 -0600 Subject: [PATCH] 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: --- .../gst-plugins-base/gst/playback/gstdecodebin3-parse.c | 8 ++++---- subprojects/gst-plugins-base/gst/playback/gstdecodebin3.c | 7 ++++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/subprojects/gst-plugins-base/gst/playback/gstdecodebin3-parse.c b/subprojects/gst-plugins-base/gst/playback/gstdecodebin3-parse.c index 354ddb87cb..d5b0566281 100644 --- a/subprojects/gst-plugins-base/gst/playback/gstdecodebin3-parse.c +++ b/subprojects/gst-plugins-base/gst/playback/gstdecodebin3-parse.c @@ -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; diff --git a/subprojects/gst-plugins-base/gst/playback/gstdecodebin3.c b/subprojects/gst-plugins-base/gst/playback/gstdecodebin3.c index c9c6d8a92f..b5f3859996 100644 --- a/subprojects/gst-plugins-base/gst/playback/gstdecodebin3.c +++ b/subprojects/gst-plugins-base/gst/playback/gstdecodebin3.c @@ -1752,7 +1752,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; @@ -1817,6 +1817,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); @@ -1947,7 +1948,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); @@ -1992,7 +1993,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); } }