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
This commit is contained in:
Edward Hervey 2018-06-05 16:58:21 +02:00 committed by Edward Hervey
parent ac7f8b6337
commit 5b0fe8d174

View file

@ -3513,7 +3513,7 @@ nothing_pending:
static void static void
bin_do_eos (GstBin * bin) bin_do_eos (GstBin * bin)
{ {
guint32 seqnum = 0; guint32 seqnum = GST_SEQNUM_INVALID;
gboolean eos; gboolean eos;
GST_OBJECT_LOCK (bin); GST_OBJECT_LOCK (bin);
@ -3542,6 +3542,7 @@ bin_do_eos (GstBin * bin)
GST_OBJECT_UNLOCK (bin); GST_OBJECT_UNLOCK (bin);
tmessage = gst_message_new_eos (GST_OBJECT_CAST (bin)); tmessage = gst_message_new_eos (GST_OBJECT_CAST (bin));
if (seqnum != GST_SEQNUM_INVALID)
gst_message_set_seqnum (tmessage, seqnum); gst_message_set_seqnum (tmessage, seqnum);
GST_DEBUG_OBJECT (bin, GST_DEBUG_OBJECT (bin,
"all sinks posted EOS, posting seqnum #%" G_GUINT32_FORMAT, seqnum); "all sinks posted EOS, posting seqnum #%" G_GUINT32_FORMAT, seqnum);
@ -3555,7 +3556,7 @@ bin_do_eos (GstBin * bin)
static void static void
bin_do_stream_start (GstBin * bin) bin_do_stream_start (GstBin * bin)
{ {
guint32 seqnum = 0; guint32 seqnum = GST_SEQNUM_INVALID;
gboolean stream_start; gboolean stream_start;
gboolean have_group_id = FALSE; gboolean have_group_id = FALSE;
guint group_id = 0; guint group_id = 0;
@ -3575,6 +3576,7 @@ bin_do_stream_start (GstBin * bin)
GST_OBJECT_UNLOCK (bin); GST_OBJECT_UNLOCK (bin);
tmessage = gst_message_new_stream_start (GST_OBJECT_CAST (bin)); tmessage = gst_message_new_stream_start (GST_OBJECT_CAST (bin));
if (seqnum != GST_SEQNUM_INVALID)
gst_message_set_seqnum (tmessage, seqnum); gst_message_set_seqnum (tmessage, seqnum);
if (have_group_id) if (have_group_id)
gst_message_set_group_id (tmessage, group_id); gst_message_set_group_id (tmessage, group_id);