hlsdemux: lock the fetcher mutex before stopping it

This commit is contained in:
Youness Alaoui 2011-08-25 23:35:55 +00:00 committed by Sebastian Dröge
parent e1a0bdcdf5
commit 39657fa52f

View file

@ -375,7 +375,9 @@ gst_hls_demux_src_event (GstPad * pad, GstEvent * event)
} }
demux->cancelled = TRUE; demux->cancelled = TRUE;
g_mutex_lock (demux->fetcher_lock);
gst_hls_demux_stop_fetcher (demux, TRUE); gst_hls_demux_stop_fetcher (demux, TRUE);
g_mutex_unlock (demux->fetcher_lock);
gst_task_pause (demux->task); gst_task_pause (demux->task);
g_cond_signal (demux->thread_cond); g_cond_signal (demux->thread_cond);
@ -642,7 +644,9 @@ gst_hls_demux_stop_fetcher (GstHLSDemux * demux, gboolean cancelled)
static void static void
gst_hls_demux_stop (GstHLSDemux * demux) gst_hls_demux_stop (GstHLSDemux * demux)
{ {
g_mutex_lock (demux->fetcher_lock);
gst_hls_demux_stop_fetcher (demux, TRUE); gst_hls_demux_stop_fetcher (demux, TRUE);
g_mutex_unlock (demux->fetcher_lock);
if (GST_TASK_STATE (demux->task) != GST_TASK_STOPPED) if (GST_TASK_STATE (demux->task) != GST_TASK_STOPPED)
gst_task_stop (demux->task); gst_task_stop (demux->task);
g_cond_signal (demux->thread_cond); g_cond_signal (demux->thread_cond);