From b1f3e4d0cfcd9a5940955232a38b6be35e31c89f Mon Sep 17 00:00:00 2001 From: Mark Nauwelaerts Date: Tue, 23 Mar 2010 17:47:48 +0100 Subject: [PATCH] matroskademux: only seek when in proper state ... and data structures can be thread-safely accessed. See #601617. --- gst/matroska/matroska-demux.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/gst/matroska/matroska-demux.c b/gst/matroska/matroska-demux.c index 9375717..d7d69e9 100644 --- a/gst/matroska/matroska-demux.c +++ b/gst/matroska/matroska-demux.c @@ -2090,7 +2090,6 @@ gst_matroska_demux_send_event (GstMatroskaDemux * demux, GstEvent * 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; @@ -2153,7 +2152,6 @@ gst_matroska_demux_get_seek_track (GstMatroskaDemux * demux, if (track && track->type == GST_MATROSKA_TRACK_TYPE_VIDEO) return track; - /* FIXME thread safety */ for (i = 0; i < demux->src->len; i++) { GstMatroskaTrackContext *stream; @@ -2231,6 +2229,12 @@ gst_matroska_demux_handle_seek_event (GstMatroskaDemux * demux, GstSegment seeksegment = { 0, }; gboolean update; + /* no seeking until we are (safely) ready */ + if (demux->state != GST_MATROSKA_DEMUX_STATE_DATA) { + GST_DEBUG_OBJECT (demux, "not ready for seeking yet"); + return FALSE; + } + if (pad) track = gst_pad_get_element_private (pad); -- 2.7.4