diff options
author | Thiago Santos <thiagossantos@gmail.com> | 2017-10-14 13:22:18 -0700 |
---|---|---|
committer | Edward Hervey <bilboed@bilboed.com> | 2017-12-01 10:48:45 +0100 |
commit | a8fa876d00bb6dee3dca11b43b396f1f4613baf1 (patch) | |
tree | 7e3102e923edfa09d2378d3b7912ae9c7b01eb89 | |
parent | 6e20998a949e5a925240882cfd4c640afb3ddd50 (diff) | |
download | gstreamer-plugins-bad-a8fa876d00bb6dee3dca11b43b396f1f4613baf1.tar.gz |
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
-rw-r--r-- | gst-libs/gst/adaptivedemux/gstadaptivedemux.c | 5 | ||||
-rw-r--r-- | gst-libs/gst/adaptivedemux/gstadaptivedemux.h | 3 |
2 files changed, 7 insertions, 1 deletions
diff --git a/gst-libs/gst/adaptivedemux/gstadaptivedemux.c b/gst-libs/gst/adaptivedemux/gstadaptivedemux.c index a0f400712..6e5243e87 100644 --- a/gst-libs/gst/adaptivedemux/gstadaptivedemux.c +++ b/gst-libs/gst/adaptivedemux/gstadaptivedemux.c @@ -1260,6 +1260,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); } @@ -1923,6 +1924,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); } @@ -3639,6 +3641,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) { diff --git a/gst-libs/gst/adaptivedemux/gstadaptivedemux.h b/gst-libs/gst/adaptivedemux/gstadaptivedemux.h index 830171467..642b06c68 100644 --- a/gst-libs/gst/adaptivedemux/gstadaptivedemux.h +++ b/gst-libs/gst/adaptivedemux/gstadaptivedemux.h @@ -157,7 +157,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; |