From: Sebastian Dröge Date: Mon, 15 Oct 2012 08:32:47 +0000 (+0200) Subject: hlsdemux: Fix another race condition by holding the mutex that the condition variable... X-Git-Tag: 1.19.3~507^2~14823 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=443703a08ea1d0379c149f4dbfdbf97d80ca7a44;p=platform%2Fupstream%2Fgstreamer.git hlsdemux: Fix another race condition by holding the mutex that the condition variable uses Conflicts: gst/hls/gsthlsdemux.c --- diff --git a/gst/hls/gsthlsdemux.c b/gst/hls/gsthlsdemux.c index 5f56651fde..2ebf84b140 100644 --- a/gst/hls/gsthlsdemux.c +++ b/gst/hls/gsthlsdemux.c @@ -140,9 +140,11 @@ gst_hls_demux_dispose (GObject * obj) if (GST_TASK_STATE (demux->updates_task) != GST_TASK_STOPPED) { GST_DEBUG_OBJECT (demux, "Leaving updates task"); gst_task_stop (demux->updates_task); + g_mutex_lock (&demux->updates_timed_lock); GST_TASK_SIGNAL (demux->updates_task); g_rec_mutex_lock (&demux->updates_lock); g_rec_mutex_unlock (&demux->updates_lock); + g_mutex_unlock (&demux->updates_timed_lock); gst_task_join (demux->updates_task); } gst_object_unref (demux->updates_task); @@ -322,7 +324,9 @@ gst_hls_demux_change_state (GstElement * element, GstStateChange transition) switch (transition) { case GST_STATE_CHANGE_PLAYING_TO_PAUSED: gst_task_stop (demux->updates_task); + g_mutex_lock (&demux->updates_timed_lock); GST_TASK_SIGNAL (demux->updates_task); + g_mutex_unlock (&demux->updates_timed_lock); g_rec_mutex_lock (&demux->updates_lock); g_rec_mutex_unlock (&demux->updates_lock); break; @@ -406,7 +410,9 @@ gst_hls_demux_src_event (GstPad * pad, GstObject * parent, GstEvent * event) gst_task_pause (demux->stream_task); gst_uri_downloader_cancel (demux->downloader); gst_task_stop (demux->updates_task); + g_mutex_lock (&demux->updates_timed_lock); GST_TASK_SIGNAL (demux->updates_task); + g_mutex_unlock (&demux->updates_timed_lock); g_rec_mutex_lock (&demux->updates_lock); g_rec_mutex_unlock (&demux->updates_lock); gst_task_pause (demux->stream_task); @@ -603,7 +609,9 @@ gst_hls_demux_pause_tasks (GstHLSDemux * demux) if (GST_TASK_STATE (demux->updates_task) != GST_TASK_STOPPED) { demux->stop_stream_task = TRUE; gst_task_pause (demux->updates_task); + g_mutex_lock (&demux->updates_timed_lock); GST_TASK_SIGNAL (demux->updates_task); + g_mutex_unlock (&demux->updates_timed_lock); } if (GST_TASK_STATE (demux->stream_task) != GST_TASK_STOPPED) { @@ -619,7 +627,9 @@ gst_hls_demux_stop (GstHLSDemux * demux) if (GST_TASK_STATE (demux->updates_task) != GST_TASK_STOPPED) { demux->stop_stream_task = TRUE; gst_task_stop (demux->updates_task); + g_mutex_lock (&demux->updates_timed_lock); GST_TASK_SIGNAL (demux->updates_task); + g_mutex_unlock (&demux->updates_timed_lock); g_rec_mutex_lock (&demux->updates_lock); g_rec_mutex_unlock (&demux->updates_lock); }