Commit e301606e authored by Alicia Boya García's avatar Alicia Boya García

matroskademux: Guard event deferring with locks

When handling seek events, the demuxer object lock must be taken before
checking the read state and storing the event in order to avoid
potential races in case the streaming thread is in the middle of a read
state transition.
parent 753b7c17
Pipeline #9151 passed with stages
in 1 minute and 49 seconds
......@@ -1902,6 +1902,7 @@ gst_matroska_demux_element_send_event (GstElement * element, GstEvent * event)
if (GST_EVENT_TYPE (event) == GST_EVENT_SEEK) {
/* no seeking until we are (safely) ready */
GST_OBJECT_LOCK (demux);
if (demux->common.state != GST_MATROSKA_READ_STATE_DATA) {
GST_DEBUG_OBJECT (demux,
"not ready for seeking yet, deferring seek: %" GST_PTR_FORMAT, event);
......@@ -1909,8 +1910,10 @@ gst_matroska_demux_element_send_event (GstElement * element, GstEvent * event)
gst_event_unref (demux->deferred_seek_event);
demux->deferred_seek_event = event;
demux->deferred_seek_pad = NULL;
GST_OBJECT_UNLOCK (demux);
return TRUE;
}
GST_OBJECT_UNLOCK (demux);
res = gst_matroska_demux_handle_seek_event (demux, NULL, event);
} else {
GST_WARNING_OBJECT (demux, "Unhandled event of type %s",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment