From 5b0fe8d17468e9cf88eae7f14aaacc4814cc81e4 Mon Sep 17 00:00:00 2001 From: Edward Hervey Date: Tue, 5 Jun 2018 16:58:21 +0200 Subject: [PATCH] bin: Make sure we don't use invalid seqnums on messages There is a possibility that the accumlation functions don't set a seqnum. Make sure we only set/override the seqnum of the new messages if we *have* a valid upstream seqnum to use --- gst/gstbin.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/gst/gstbin.c b/gst/gstbin.c index 596ca16..9491b23 100644 --- a/gst/gstbin.c +++ b/gst/gstbin.c @@ -3513,7 +3513,7 @@ nothing_pending: static void bin_do_eos (GstBin * bin) { - guint32 seqnum = 0; + guint32 seqnum = GST_SEQNUM_INVALID; gboolean eos; GST_OBJECT_LOCK (bin); @@ -3542,7 +3542,8 @@ bin_do_eos (GstBin * bin) GST_OBJECT_UNLOCK (bin); tmessage = gst_message_new_eos (GST_OBJECT_CAST (bin)); - gst_message_set_seqnum (tmessage, seqnum); + if (seqnum != GST_SEQNUM_INVALID) + gst_message_set_seqnum (tmessage, seqnum); GST_DEBUG_OBJECT (bin, "all sinks posted EOS, posting seqnum #%" G_GUINT32_FORMAT, seqnum); gst_element_post_message (GST_ELEMENT_CAST (bin), tmessage); @@ -3555,7 +3556,7 @@ bin_do_eos (GstBin * bin) static void bin_do_stream_start (GstBin * bin) { - guint32 seqnum = 0; + guint32 seqnum = GST_SEQNUM_INVALID; gboolean stream_start; gboolean have_group_id = FALSE; guint group_id = 0; @@ -3575,7 +3576,8 @@ bin_do_stream_start (GstBin * bin) GST_OBJECT_UNLOCK (bin); tmessage = gst_message_new_stream_start (GST_OBJECT_CAST (bin)); - gst_message_set_seqnum (tmessage, seqnum); + if (seqnum != GST_SEQNUM_INVALID) + gst_message_set_seqnum (tmessage, seqnum); if (have_group_id) gst_message_set_group_id (tmessage, group_id); -- 2.7.4