From: Louis-Francis Ratté-Boulianne Date: Tue, 19 Feb 2013 18:17:53 +0000 (-0500) Subject: mssdemux: avoid streaming to fail when download is cancelled X-Git-Tag: 1.19.3~507^2~13687 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=00400a838ba82533310a2ad9744c7f61072f297b;p=platform%2Fupstream%2Fgstreamer.git mssdemux: avoid streaming to fail when download is cancelled When download was failing repeatedly, it was causing streaming to fail even though it was cancelled on purpose (stopping tasks). --- diff --git a/ext/smoothstreaming/gstmssdemux.c b/ext/smoothstreaming/gstmssdemux.c index bc6ad70..41ab253 100644 --- a/ext/smoothstreaming/gstmssdemux.c +++ b/ext/smoothstreaming/gstmssdemux.c @@ -520,6 +520,7 @@ gst_mss_demux_stop_tasks (GstMssDemux * mssdemux, gboolean immediate) gst_data_queue_set_flushing (stream->dataqueue, TRUE); + stream->cancelled = TRUE; if (immediate) gst_uri_downloader_cancel (stream->downloader); gst_task_pause (stream->download_task); @@ -529,6 +530,8 @@ gst_mss_demux_stop_tasks (GstMssDemux * mssdemux, gboolean immediate) for (iter = mssdemux->streams; iter; iter = g_slist_next (iter)) { GstMssDemuxStream *stream = iter->data; g_static_rec_mutex_lock (&stream->download_lock); + stream->cancelled = FALSE; + stream->download_error_count = 0; } g_static_rec_mutex_lock (&mssdemux->stream_lock); } @@ -1110,6 +1113,10 @@ gst_mss_demux_download_loop (GstMssDemuxStream * stream) GST_OBJECT_UNLOCK (mssdemux); ret = gst_mss_demux_stream_download_fragment (stream, &buffer); + + if (stream->cancelled) + goto cancelled; + switch (ret) { case GST_FLOW_OK: break; /* all is good, let's go */ @@ -1148,6 +1155,12 @@ error: } return; } +cancelled: + { + GST_DEBUG_OBJECT (mssdemux, "Stream %p has been cancelled", stream); + gst_task_pause (stream->download_task); + return; + } } static GstFlowReturn diff --git a/ext/smoothstreaming/gstmssdemux.h b/ext/smoothstreaming/gstmssdemux.h index 0b8eec8..061f1d1 100644 --- a/ext/smoothstreaming/gstmssdemux.h +++ b/ext/smoothstreaming/gstmssdemux.h @@ -74,6 +74,7 @@ struct _GstMssDemuxStream { gboolean eos; gboolean have_data; + gboolean cancelled; GstDownloadRate download_rate;