adaptivedemux2: stream: Don't take TRACKS_LOCK when sending EOS event

The stream tracks list can't change while we're
iterating it from the scheduling thread,
and the event handler immediately takes the
tracks lock, causing a deadlock.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2650>
This commit is contained in:
Jan Schmidt 2022-06-22 03:30:16 +10:00 committed by GStreamer Marge Bot
parent e9f8c7d33a
commit e1559d26d0

View file

@ -1452,15 +1452,12 @@ gst_adaptive_demux2_stream_push_event (GstAdaptiveDemux2Stream * stream,
* We don't need to care about any other events
*/
if (GST_EVENT_TYPE (event) == GST_EVENT_EOS) {
GstAdaptiveDemux *demux = stream->demux;
GList *iter;
TRACKS_LOCK (demux);
for (iter = stream->tracks; iter; iter = iter->next) {
GstAdaptiveDemuxTrack *track = (GstAdaptiveDemuxTrack *) iter->data;
ret &= gst_pad_send_event (track->sinkpad, gst_event_ref (event));
}
TRACKS_UNLOCK (demux);
}
gst_event_unref (event);