mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 10:11:08 +00:00
videomixer2: Merge tag events to send them in collected.
Otherwise there were race conditions where we would send tags on a flushing srcpad. We have a test for that in GES, but this should be tested systematically with harness in the future as I believe it is useful for exactly that kind of cases. https://bugzilla.gnome.org/show_bug.cgi?id=708165
This commit is contained in:
parent
a45d470236
commit
83f8ee1d41
2 changed files with 30 additions and 0 deletions
|
@ -1238,6 +1238,11 @@ gst_videomixer2_collected (GstCollectPads * pads, GstVideoMixer2 * mix)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (G_UNLIKELY (mix->pending_tags)) {
|
||||||
|
gst_pad_push_event (mix->srcpad, gst_event_new_tag (mix->pending_tags));
|
||||||
|
mix->pending_tags = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (mix->segment.stop != -1)
|
if (mix->segment.stop != -1)
|
||||||
output_end_time = MIN (output_end_time, mix->segment.stop);
|
output_end_time = MIN (output_end_time, mix->segment.stop);
|
||||||
|
|
||||||
|
@ -1922,6 +1927,10 @@ gst_videomixer2_sink_event (GstCollectPads * pads, GstCollectData * cdata,
|
||||||
g_atomic_int_set (&mix->flush_stop_pending, FALSE);
|
g_atomic_int_set (&mix->flush_stop_pending, FALSE);
|
||||||
ret = gst_collect_pads_event_default (pads, cdata, event, discard);
|
ret = gst_collect_pads_event_default (pads, cdata, event, discard);
|
||||||
event = NULL;
|
event = NULL;
|
||||||
|
if (mix->pending_tags) {
|
||||||
|
gst_tag_list_unref (mix->pending_tags);
|
||||||
|
mix->pending_tags = NULL;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case GST_EVENT_FLUSH_STOP:
|
case GST_EVENT_FLUSH_STOP:
|
||||||
mix->newseg_pending = TRUE;
|
mix->newseg_pending = TRUE;
|
||||||
|
@ -1945,6 +1954,19 @@ gst_videomixer2_sink_event (GstCollectPads * pads, GstCollectData * cdata,
|
||||||
mix->ts_offset = 0;
|
mix->ts_offset = 0;
|
||||||
mix->nframes = 0;
|
mix->nframes = 0;
|
||||||
break;
|
break;
|
||||||
|
case GST_EVENT_TAG:
|
||||||
|
{
|
||||||
|
/* collect tags here so we can push them out when we collect data */
|
||||||
|
GstTagList *tags;
|
||||||
|
|
||||||
|
gst_event_parse_tag (event, &tags);
|
||||||
|
tags = gst_tag_list_merge (mix->pending_tags, tags, GST_TAG_MERGE_APPEND);
|
||||||
|
if (mix->pending_tags)
|
||||||
|
gst_tag_list_unref (mix->pending_tags);
|
||||||
|
mix->pending_tags = tags;
|
||||||
|
event = NULL;
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -2166,6 +2188,11 @@ gst_videomixer2_dispose (GObject * o)
|
||||||
videomixer_videoconvert_convert_free (mixpad->convert);
|
videomixer_videoconvert_convert_free (mixpad->convert);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mix->pending_tags) {
|
||||||
|
gst_tag_list_unref (mix->pending_tags);
|
||||||
|
mix->pending_tags = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
gst_caps_replace (&mix->current_caps, NULL);
|
gst_caps_replace (&mix->current_caps, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2295,6 +2322,7 @@ gst_videomixer2_init (GstVideoMixer2 * mix)
|
||||||
mix->collect = gst_collect_pads_new ();
|
mix->collect = gst_collect_pads_new ();
|
||||||
mix->background = DEFAULT_BACKGROUND;
|
mix->background = DEFAULT_BACKGROUND;
|
||||||
mix->current_caps = NULL;
|
mix->current_caps = NULL;
|
||||||
|
mix->pending_tags = NULL;
|
||||||
|
|
||||||
gst_collect_pads_set_function (mix->collect,
|
gst_collect_pads_set_function (mix->collect,
|
||||||
(GstCollectPadsFunction) GST_DEBUG_FUNCPTR (gst_videomixer2_collected),
|
(GstCollectPadsFunction) GST_DEBUG_FUNCPTR (gst_videomixer2_collected),
|
||||||
|
|
|
@ -120,6 +120,8 @@ struct _GstVideoMixer2
|
||||||
FillColorFunction fill_color;
|
FillColorFunction fill_color;
|
||||||
|
|
||||||
gboolean send_stream_start;
|
gboolean send_stream_start;
|
||||||
|
|
||||||
|
GstTagList *pending_tags;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GstVideoMixer2Class
|
struct _GstVideoMixer2Class
|
||||||
|
|
Loading…
Reference in a new issue