From 62ddd348071bc205529fd4b17e281d8772f0d200 Mon Sep 17 00:00:00 2001 From: Gil Pedersen Date: Fri, 11 May 2012 13:58:28 +0200 Subject: [PATCH] hlsdemux: don't pause task when it is stopped This fixes a potential dead-lock situation from GstTask https://bugzilla.gnome.org/show_bug.cgi?id=675869 --- ext/hls/gsthlsdemux.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/ext/hls/gsthlsdemux.c b/ext/hls/gsthlsdemux.c index 638360fb2c..5242977c8e 100644 --- a/ext/hls/gsthlsdemux.c +++ b/ext/hls/gsthlsdemux.c @@ -791,7 +791,9 @@ end_of_playlist: cache_error: { - gst_task_pause (demux->stream_task); + /* Pausing a stopped task will start it */ + if (GST_TASK_STATE (demux->stream_task) != GST_TASK_STOPPED) + gst_task_pause (demux->stream_task); if (!demux->cancelled) { GST_ELEMENT_ERROR (demux, RESOURCE, NOT_FOUND, ("Could not cache the first fragments"), (NULL)); @@ -802,12 +804,9 @@ cache_error: type_not_found: { - gst_task_pause (demux->stream_task); - if (!demux->cancelled) { - GST_ELEMENT_ERROR (demux, STREAM, TYPE_NOT_FOUND, - ("Could not determine type of stream"), (NULL)); - gst_hls_demux_pause_tasks (demux, FALSE); - } + GST_ELEMENT_ERROR (demux, STREAM, TYPE_NOT_FOUND, + ("Could not determine type of stream"), (NULL)); + gst_hls_demux_pause_tasks (demux, FALSE); return; } @@ -828,7 +827,9 @@ error_pushing: pause_task: { GST_DEBUG_OBJECT (demux, "Pause task"); - gst_task_pause (demux->stream_task); + /* Pausing a stopped task will start it */ + if (GST_TASK_STATE (demux->stream_task) != GST_TASK_STOPPED) + gst_task_pause (demux->stream_task); return; } }