gst-plugins-bad: hlsdemux: make sure to stop fragments cache if something cancelled it
Sebastian Dröge
slomo at kemper.freedesktop.org
Wed Mar 30 01:07:41 PDT 2011
Module: gst-plugins-bad
Branch: master
Commit: b76526009849f1529254acb1b9307e796af6862f
URL: http://cgit.freedesktop.org/gstreamer/gst-plugins-bad/commit/?id=b76526009849f1529254acb1b9307e796af6862f
Author: Andoni Morales Alastruey <ylatuya at gmail.com>
Date: Tue Feb 15 22:40:21 2011 +0100
hlsdemux: make sure to stop fragments cache if something cancelled it
---
gst/hls/gsthlsdemux.c | 11 +++++++++--
gst/hls/gsthlsdemux.h | 1 +
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/gst/hls/gsthlsdemux.c b/gst/hls/gsthlsdemux.c
index c155013..c368785 100644
--- a/gst/hls/gsthlsdemux.c
+++ b/gst/hls/gsthlsdemux.c
@@ -287,6 +287,7 @@ gst_hls_demux_change_state (GstElement * element, GstStateChange transition)
switch (transition) {
case GST_STATE_CHANGE_PAUSED_TO_READY:
+ demux->cancelled = TRUE;
gst_hls_demux_stop_fetcher (demux, TRUE);
break;
default:
@@ -361,7 +362,8 @@ gst_hls_demux_fetcher_sink_event (GstPad * pad, GstEvent * event)
case GST_EVENT_EOS:{
GST_DEBUG_OBJECT (demux, "Got EOS on the fetcher pad");
/* signal we have fetched the URI */
- g_cond_signal (demux->fetcher_cond);
+ if (!demux->cancelled)
+ g_cond_signal (demux->fetcher_cond);
}
default:
break;
@@ -572,6 +574,7 @@ gst_hls_demux_reset (GstHLSDemux * demux, gboolean dispose)
demux->thread_return = FALSE;
demux->accumulated_delay = 0;
demux->end_of_playlist = FALSE;
+ demux->cancelled = FALSE;
if (demux->input_caps) {
gst_caps_unref (demux->input_caps);
@@ -721,9 +724,13 @@ gst_hls_demux_cache_fragments (GstHLSDemux * demux)
/* Cache the first fragments */
for (i = 0; i < demux->fragments_cache - 1; i++) {
if (!gst_hls_demux_get_next_fragment (demux, FALSE)) {
- GST_ERROR_OBJECT (demux, "Error caching the first fragments");
+ if (!demux->cancelled)
+ GST_ERROR_OBJECT (demux, "Error caching the first fragments");
return FALSE;
}
+ /* make sure we stop caching fragments if something cancelled it */
+ if (demux->cancelled)
+ return FALSE;
}
g_get_current_time (&demux->next_update);
diff --git a/gst/hls/gsthlsdemux.h b/gst/hls/gsthlsdemux.h
index a486b91..396f2cb 100644
--- a/gst/hls/gsthlsdemux.h
+++ b/gst/hls/gsthlsdemux.h
@@ -83,6 +83,7 @@ struct _GstHLSDemux
GTimeVal *timeout;
gboolean fetcher_error;
gboolean stopping_fetcher;
+ gboolean cancelled;
GstBuffer *downloaded_uri;
};
More information about the gstreamer-commits
mailing list