mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-02 20:42:30 +00:00
hlsdemux: make sure to stop fragments cache if something cancelled it
This commit is contained in:
parent
fe883740c5
commit
b765260098
2 changed files with 10 additions and 2 deletions
|
@ -287,6 +287,7 @@ gst_hls_demux_change_state (GstElement * element, GstStateChange transition)
|
||||||
|
|
||||||
switch (transition) {
|
switch (transition) {
|
||||||
case GST_STATE_CHANGE_PAUSED_TO_READY:
|
case GST_STATE_CHANGE_PAUSED_TO_READY:
|
||||||
|
demux->cancelled = TRUE;
|
||||||
gst_hls_demux_stop_fetcher (demux, TRUE);
|
gst_hls_demux_stop_fetcher (demux, TRUE);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -361,6 +362,7 @@ gst_hls_demux_fetcher_sink_event (GstPad * pad, GstEvent * event)
|
||||||
case GST_EVENT_EOS:{
|
case GST_EVENT_EOS:{
|
||||||
GST_DEBUG_OBJECT (demux, "Got EOS on the fetcher pad");
|
GST_DEBUG_OBJECT (demux, "Got EOS on the fetcher pad");
|
||||||
/* signal we have fetched the URI */
|
/* signal we have fetched the URI */
|
||||||
|
if (!demux->cancelled)
|
||||||
g_cond_signal (demux->fetcher_cond);
|
g_cond_signal (demux->fetcher_cond);
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
@ -572,6 +574,7 @@ gst_hls_demux_reset (GstHLSDemux * demux, gboolean dispose)
|
||||||
demux->thread_return = FALSE;
|
demux->thread_return = FALSE;
|
||||||
demux->accumulated_delay = 0;
|
demux->accumulated_delay = 0;
|
||||||
demux->end_of_playlist = FALSE;
|
demux->end_of_playlist = FALSE;
|
||||||
|
demux->cancelled = FALSE;
|
||||||
|
|
||||||
if (demux->input_caps) {
|
if (demux->input_caps) {
|
||||||
gst_caps_unref (demux->input_caps);
|
gst_caps_unref (demux->input_caps);
|
||||||
|
@ -721,9 +724,13 @@ gst_hls_demux_cache_fragments (GstHLSDemux * demux)
|
||||||
/* Cache the first fragments */
|
/* Cache the first fragments */
|
||||||
for (i = 0; i < demux->fragments_cache - 1; i++) {
|
for (i = 0; i < demux->fragments_cache - 1; i++) {
|
||||||
if (!gst_hls_demux_get_next_fragment (demux, FALSE)) {
|
if (!gst_hls_demux_get_next_fragment (demux, FALSE)) {
|
||||||
|
if (!demux->cancelled)
|
||||||
GST_ERROR_OBJECT (demux, "Error caching the first fragments");
|
GST_ERROR_OBJECT (demux, "Error caching the first fragments");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
/* make sure we stop caching fragments if something cancelled it */
|
||||||
|
if (demux->cancelled)
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_get_current_time (&demux->next_update);
|
g_get_current_time (&demux->next_update);
|
||||||
|
|
|
@ -83,6 +83,7 @@ struct _GstHLSDemux
|
||||||
GTimeVal *timeout;
|
GTimeVal *timeout;
|
||||||
gboolean fetcher_error;
|
gboolean fetcher_error;
|
||||||
gboolean stopping_fetcher;
|
gboolean stopping_fetcher;
|
||||||
|
gboolean cancelled;
|
||||||
GstBuffer *downloaded_uri;
|
GstBuffer *downloaded_uri;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue