hlsdemux: stop the threads in the proper order

first pause the task, then stop all fetchers, then stop the update thread
then pause the task again, since it might have been restarted by
another thread in the meantime
This commit is contained in:
Youness Alaoui 2011-08-25 23:37:47 +00:00 committed by Sebastian Dröge
parent 015d1e11e2
commit 46ac6a2589

View file

@ -375,13 +375,14 @@ gst_hls_demux_src_event (GstPad * pad, GstEvent * event)
} }
demux->cancelled = TRUE; demux->cancelled = TRUE;
gst_task_pause (demux->task);
g_mutex_lock (demux->fetcher_lock); 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); g_mutex_unlock (demux->fetcher_lock);
gst_task_pause (demux->task);
g_mutex_lock (demux->thread_lock); g_mutex_lock (demux->thread_lock);
g_cond_signal (demux->thread_cond); g_cond_signal (demux->thread_cond);
g_mutex_unlock (demux->thread_lock); g_mutex_unlock (demux->thread_lock);
gst_task_pause (demux->task);
/* wait for streaming to finish */ /* wait for streaming to finish */
g_static_rec_mutex_lock (&demux->task_lock); g_static_rec_mutex_lock (&demux->task_lock);