diff options
author | Jan Schmidt <jan@centricular.com> | 2016-08-23 01:57:55 +1000 |
---|---|---|
committer | Jan Schmidt <jan@centricular.com> | 2016-08-23 01:57:55 +1000 |
commit | 389e35d03225731552964dd56ee4ea1c0c624245 (patch) | |
tree | 6263816ee87e93dab1813cb38a7a368bf9274cd5 | |
parent | 0a63569fd16354464df9b3e3629fb56c4f9b3c43 (diff) |
adaptivedemux: Fix broken updates loop on live streams
Prevent the manifest update loop from looping endlessly
after a seek event, by clearing the variable that tells
the task function not to immediately exit.
-rw-r--r-- | gst-libs/gst/adaptivedemux/gstadaptivedemux.c | 3 | ||||
-rw-r--r-- | gst-libs/gst/adaptivedemux/gstadaptivedemux.c.rej | 39 | ||||
-rw-r--r-- | gst-libs/gst/adaptivedemux/set_state_keep.patch | 13 |
3 files changed, 55 insertions, 0 deletions
diff --git a/gst-libs/gst/adaptivedemux/gstadaptivedemux.c b/gst-libs/gst/adaptivedemux/gstadaptivedemux.c index 3341c98a3..536d51214 100644 --- a/gst-libs/gst/adaptivedemux/gstadaptivedemux.c +++ b/gst-libs/gst/adaptivedemux/gstadaptivedemux.c @@ -679,6 +679,9 @@ gst_adaptive_demux_sink_event (GstPad * pad, GstObject * parent, gst_adaptive_demux_is_live (demux)); gst_adaptive_demux_start_tasks (demux); if (gst_adaptive_demux_is_live (demux)) { + g_mutex_lock (&demux->priv->updates_timed_lock); + demux->priv->stop_updates_task = FALSE; + g_mutex_unlock (&demux->priv->updates_timed_lock); /* Task to periodically update the manifest */ gst_task_start (demux->priv->updates_task); } diff --git a/gst-libs/gst/adaptivedemux/gstadaptivedemux.c.rej b/gst-libs/gst/adaptivedemux/gstadaptivedemux.c.rej new file mode 100644 index 000000000..82fcc2c42 --- /dev/null +++ b/gst-libs/gst/adaptivedemux/gstadaptivedemux.c.rej @@ -0,0 +1,39 @@ +--- gst-libs/gst/adaptivedemux/gstadaptivedemux.c ++++ gst-libs/gst/adaptivedemux/gstadaptivedemux.c +@@ -1821,12 +1926,36 @@ gst_adaptive_demux_stream_push_buffer (GstAdaptiveDemuxStream * stream, + gst_caps_unref (stream->pending_caps); + stream->pending_caps = NULL; + } ++ ++ if (stream->do_block) { ++ ++ g_mutex_lock (&demux->priv->preroll_lock); ++ GST_MANIFEST_UNLOCK (demux); ++ ++ gst_adaptive_demux_handle_preroll (demux, stream); ++ ++ while (stream->do_block && !stream->cancelled) { ++ GST_LOG_OBJECT (demux, "Stream %p sleeping for preroll", stream); ++ g_cond_wait (&demux->priv->preroll_cond, &demux->priv->preroll_lock); ++ } ++ if (stream->cancelled) { ++ GST_LOG_OBJECT (demux, "stream %p cancelled", stream); ++ gst_buffer_unref (buffer); ++ g_mutex_unlock (&demux->priv->preroll_lock); ++ return GST_FLOW_FLUSHING; ++ } ++ ++ g_mutex_unlock (&demux->priv->preroll_lock); ++ GST_MANIFEST_LOCK (demux); ++ } ++ + if (G_UNLIKELY (stream->pending_segment)) { + GST_DEBUG_OBJECT (stream->pad, "Sending pending seg: %" GST_PTR_FORMAT, + stream->pending_segment); + gst_pad_push_event (stream->pad, stream->pending_segment); + stream->pending_segment = NULL; + } ++ + if (G_UNLIKELY (stream->pending_tags || stream->bitrate_changed)) { + GstTagList *tags = stream->pending_tags; + diff --git a/gst-libs/gst/adaptivedemux/set_state_keep.patch b/gst-libs/gst/adaptivedemux/set_state_keep.patch new file mode 100644 index 000000000..e9a7bd8e4 --- /dev/null +++ b/gst-libs/gst/adaptivedemux/set_state_keep.patch @@ -0,0 +1,13 @@ +diff --git a/gst-libs/gst/adaptivedemux/gstadaptivedemux.c b/gst-libs/gst/adaptivedemux/gstadaptivedemux.c +index a7cf6c0..34ea3aa 100644 +--- a/gst-libs/gst/adaptivedemux/gstadaptivedemux.c ++++ b/gst-libs/gst/adaptivedemux/gstadaptivedemux.c +@@ -2533,6 +2533,8 @@ gst_adaptive_demux_stream_download_uri (GstAdaptiveDemux * demux, + return ret; + } + ++ gst_element_set_state (stream->src, GST_STATE_PLAYING); ++ + /* wait for the fragment to be completely downloaded */ + GST_DEBUG_OBJECT (stream->pad, + "Waiting for fragment download to finish: %s", uri); |