mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
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
This commit is contained in:
parent
95a2786741
commit
5a693fdd9d
1 changed files with 10 additions and 11 deletions
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue