Commit c2d34d1e authored by Thiago Santos's avatar Thiago Santos

adaptivedemux: add replaced flag to not error out on bitrate change

When switching bitrates we set the old streams as cancelled, but it
could also be confused with a cancel due to other reasons (as an error)
and it would lead the element to stop the pipeline mistankely. This
would happen when the stream being replaced was waiting for a manifest
update on live. Ss make it sure that we are stopping for switching
bitrates to avoid erroring out.

https://bugzilla.gnome.org/show_bug.cgi?id=789457
parent ee2d4c95
......@@ -1266,6 +1266,7 @@ gst_adaptive_demux_expose_streams (GstAdaptiveDemux * demux)
gst_task_stop (stream->download_task);
g_mutex_lock (&stream->fragment_download_lock);
stream->cancelled = TRUE;
stream->replaced = TRUE;
g_cond_signal (&stream->fragment_download_cond);
g_mutex_unlock (&stream->fragment_download_lock);
}
......@@ -2010,6 +2011,7 @@ gst_adaptive_demux_start_tasks (GstAdaptiveDemux * demux,
if (!start_preroll_streams) {
g_mutex_lock (&stream->fragment_download_lock);
stream->cancelled = FALSE;
stream->replaced = FALSE;
g_mutex_unlock (&stream->fragment_download_lock);
}
......@@ -3778,6 +3780,9 @@ gst_adaptive_demux_stream_download_loop (GstAdaptiveDemuxStream * stream)
goto end;
}
gst_task_stop (stream->download_task);
if (stream->replaced) {
goto end;
}
} else {
gst_task_stop (stream->download_task);
if (gst_adaptive_demux_combine_flows (demux) == GST_FLOW_EOS) {
......
......@@ -160,7 +160,8 @@ struct _GstAdaptiveDemuxStream
GMutex fragment_download_lock;
GCond fragment_download_cond;
gboolean download_finished; /* protected by fragment_download_lock */
gboolean cancelled; /* protected by fragment_download_lock */
gboolean cancelled; /* protected by fragment_download_lock */
gboolean replaced; /* replaced in a bitrate switch (used with cancelled) */
gboolean src_at_ready; /* protected by fragment_download_lock */
gboolean starting_fragment;
gboolean first_fragment_buffer;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment