summaryrefslogtreecommitdiff
path: root/gst-libs/gst/adaptivedemux
diff options
context:
space:
mode:
authorThiago Santos <thiagossantos@gmail.com>2017-05-29 22:28:21 -0700
committerEdward Hervey <bilboed@bilboed.com>2017-06-01 15:27:07 +0200
commit5a693fdd9dc1e7e227309424503e3e0e78f9e9c0 (patch)
tree591b66953733e7b3564474d6e682b75190cb4d11 /gst-libs/gst/adaptivedemux
parent95a27867411826549119711a3c35b3493ab3070e (diff)
adaptivedemux: do not erase data while updates-loop is running
Make sure the manifest update loop is stopped before proceeding with the resetting of the manifest data. Otherwise, the updates loop will try to use it and it leads to a segfault https://bugzilla.gnome.org/show_bug.cgi?id=783028
Diffstat (limited to 'gst-libs/gst/adaptivedemux')
-rw-r--r--gst-libs/gst/adaptivedemux/gstadaptivedemux.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/gst-libs/gst/adaptivedemux/gstadaptivedemux.c b/gst-libs/gst/adaptivedemux/gstadaptivedemux.c
index 7b82653a2..0d7f4228f 100644
--- a/gst-libs/gst/adaptivedemux/gstadaptivedemux.c
+++ b/gst-libs/gst/adaptivedemux/gstadaptivedemux.c
@@ -283,7 +283,8 @@ static void gst_adaptive_demux_start_manifest_update_task (GstAdaptiveDemux *
static void gst_adaptive_demux_start_tasks (GstAdaptiveDemux * demux,
gboolean start_preroll_streams);
-static void gst_adaptive_demux_stop_tasks (GstAdaptiveDemux * demux);
+static void gst_adaptive_demux_stop_tasks (GstAdaptiveDemux * demux,
+ gboolean stop_updates);
static GstFlowReturn gst_adaptive_demux_combine_flows (GstAdaptiveDemux *
demux);
static void
@@ -561,13 +562,7 @@ gst_adaptive_demux_change_state (GstElement * element,
GST_MANIFEST_LOCK (demux);
demux->running = FALSE;
gst_adaptive_demux_reset (demux);
- gst_adaptive_demux_stop_manifest_update_task (demux);
GST_MANIFEST_UNLOCK (demux);
-
- /* demux->priv->updates_task value never changes, so it is safe to read it
- * outside critical section
- */
- gst_task_join (demux->priv->updates_task);
break;
case GST_STATE_CHANGE_READY_TO_PAUSED:
GST_MANIFEST_LOCK (demux);
@@ -775,7 +770,7 @@ gst_adaptive_demux_reset (GstAdaptiveDemux * demux)
old_streams = demux->priv->old_streams;
demux->priv->old_streams = NULL;
- gst_adaptive_demux_stop_tasks (demux);
+ gst_adaptive_demux_stop_tasks (demux, TRUE);
if (klass->reset)
klass->reset (demux);
@@ -1641,11 +1636,11 @@ gst_adaptive_demux_handle_seek_event (GstAdaptiveDemux * demux, GstPad * pad,
gst_adaptive_demux_push_src_event (demux, fevent);
GST_MANIFEST_LOCK (demux);
- gst_adaptive_demux_stop_tasks (demux);
+ gst_adaptive_demux_stop_tasks (demux, FALSE);
} else if ((rate > 0 && start_type != GST_SEEK_TYPE_NONE) ||
(rate < 0 && stop_type != GST_SEEK_TYPE_NONE)) {
- gst_adaptive_demux_stop_tasks (demux);
+ gst_adaptive_demux_stop_tasks (demux, FALSE);
}
GST_ADAPTIVE_DEMUX_SEGMENT_LOCK (demux);
@@ -2048,12 +2043,14 @@ gst_adaptive_demux_start_manifest_update_task (GstAdaptiveDemux * demux)
* the demux element.
*/
static void
-gst_adaptive_demux_stop_tasks (GstAdaptiveDemux * demux)
+gst_adaptive_demux_stop_tasks (GstAdaptiveDemux * demux, gboolean stop_updates)
{
GList *iter;
GST_LOG_OBJECT (demux, "Stopping tasks");
+ if (stop_updates)
+ gst_adaptive_demux_stop_manifest_update_task (demux);
for (iter = demux->streams; iter; iter = g_list_next (iter)) {
GstAdaptiveDemuxStream *stream = iter->data;
@@ -2097,6 +2094,8 @@ gst_adaptive_demux_stop_tasks (GstAdaptiveDemux * demux)
}
GST_MANIFEST_UNLOCK (demux);
+ if (stop_updates)
+ gst_task_join (demux->priv->updates_task);
GST_MANIFEST_LOCK (demux);