summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim.muller@collabora.co.uk>2009-12-03 08:58:08 +0000
committerTim-Philipp Müller <tim.muller@collabora.co.uk>2009-12-04 11:13:31 +0000
commitd0b25845ec6f2da545aeea550ad37d06d765f764 (patch)
tree871f443cc0bac6d71fba4968a8b2291bfd86552f
parentff4ac9ddf6f65c98f0aabbd21bcd5cb5480de3e6 (diff)
matroskademux: only send pending tags with newsegment events
Send pending tags only from the streaming thread, just after we've sent the newsegment event, not with e.g. flush-start. This not only does the right thing, but also makes sure we're not trampling over variables set up in the streaming thread from the seeking thread in case someone tries to issue a seek just as the demuxer is parsing the headers. Fixes #601617. Spotted by Ognyan Tonchev.
-rw-r--r--gst/matroska/matroska-demux.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/gst/matroska/matroska-demux.c b/gst/matroska/matroska-demux.c
index 1246e42db..c55790c06 100644
--- a/gst/matroska/matroska-demux.c
+++ b/gst/matroska/matroska-demux.c
@@ -2042,6 +2042,7 @@ gst_matroska_demux_found_global_tag (GstMatroskaDemux * demux,
static gboolean
gst_matroska_demux_send_event (GstMatroskaDemux * demux, GstEvent * event)
{
+ gboolean is_newsegment;
gboolean ret = TRUE;
gint i;
@@ -2050,6 +2051,9 @@ gst_matroska_demux_send_event (GstMatroskaDemux * demux, GstEvent * event)
GST_DEBUG_OBJECT (demux, "Sending event of type %s to all source pads",
GST_EVENT_TYPE_NAME (event));
+ is_newsegment = (GST_EVENT_TYPE (event) == GST_EVENT_NEWSEGMENT);
+
+ /* FIXME: access to demux->src is not thread-safe here */
g_assert (demux->src->len == demux->num_streams);
for (i = 0; i < demux->src->len; i++) {
GstMatroskaTrackContext *stream;
@@ -2058,7 +2062,8 @@ gst_matroska_demux_send_event (GstMatroskaDemux * demux, GstEvent * event)
gst_event_ref (event);
gst_pad_push_event (stream->pad, event);
- if (G_UNLIKELY (stream->pending_tags)) {
+ /* FIXME: send global tags before stream tags */
+ if (G_UNLIKELY (is_newsegment && stream->pending_tags != NULL)) {
GST_DEBUG_OBJECT (demux, "Sending pending_tags %p for pad %s:%s : %"
GST_PTR_FORMAT, stream->pending_tags,
GST_DEBUG_PAD_NAME (stream->pad), stream->pending_tags);
@@ -2068,7 +2073,7 @@ gst_matroska_demux_send_event (GstMatroskaDemux * demux, GstEvent * event)
}
}
- if (G_UNLIKELY (demux->global_tags)) {
+ if (G_UNLIKELY (is_newsegment && demux->global_tags != NULL)) {
gst_tag_list_add (demux->global_tags, GST_TAG_MERGE_REPLACE,
GST_TAG_CONTAINER_FORMAT, "Matroska", NULL);
GST_DEBUG_OBJECT (demux, "Sending global_tags %p : %" GST_PTR_FORMAT,