mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-31 19:42:26 +00:00
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).
This commit is contained in:
parent
b579cb1ddc
commit
00400a838b
2 changed files with 14 additions and 0 deletions
|
@ -520,6 +520,7 @@ gst_mss_demux_stop_tasks (GstMssDemux * mssdemux, gboolean immediate)
|
||||||
|
|
||||||
gst_data_queue_set_flushing (stream->dataqueue, TRUE);
|
gst_data_queue_set_flushing (stream->dataqueue, TRUE);
|
||||||
|
|
||||||
|
stream->cancelled = TRUE;
|
||||||
if (immediate)
|
if (immediate)
|
||||||
gst_uri_downloader_cancel (stream->downloader);
|
gst_uri_downloader_cancel (stream->downloader);
|
||||||
gst_task_pause (stream->download_task);
|
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)) {
|
for (iter = mssdemux->streams; iter; iter = g_slist_next (iter)) {
|
||||||
GstMssDemuxStream *stream = iter->data;
|
GstMssDemuxStream *stream = iter->data;
|
||||||
g_static_rec_mutex_lock (&stream->download_lock);
|
g_static_rec_mutex_lock (&stream->download_lock);
|
||||||
|
stream->cancelled = FALSE;
|
||||||
|
stream->download_error_count = 0;
|
||||||
}
|
}
|
||||||
g_static_rec_mutex_lock (&mssdemux->stream_lock);
|
g_static_rec_mutex_lock (&mssdemux->stream_lock);
|
||||||
}
|
}
|
||||||
|
@ -1110,6 +1113,10 @@ gst_mss_demux_download_loop (GstMssDemuxStream * stream)
|
||||||
GST_OBJECT_UNLOCK (mssdemux);
|
GST_OBJECT_UNLOCK (mssdemux);
|
||||||
|
|
||||||
ret = gst_mss_demux_stream_download_fragment (stream, &buffer);
|
ret = gst_mss_demux_stream_download_fragment (stream, &buffer);
|
||||||
|
|
||||||
|
if (stream->cancelled)
|
||||||
|
goto cancelled;
|
||||||
|
|
||||||
switch (ret) {
|
switch (ret) {
|
||||||
case GST_FLOW_OK:
|
case GST_FLOW_OK:
|
||||||
break; /* all is good, let's go */
|
break; /* all is good, let's go */
|
||||||
|
@ -1148,6 +1155,12 @@ error:
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
cancelled:
|
||||||
|
{
|
||||||
|
GST_DEBUG_OBJECT (mssdemux, "Stream %p has been cancelled", stream);
|
||||||
|
gst_task_pause (stream->download_task);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstFlowReturn
|
static GstFlowReturn
|
||||||
|
|
|
@ -74,6 +74,7 @@ struct _GstMssDemuxStream {
|
||||||
|
|
||||||
gboolean eos;
|
gboolean eos;
|
||||||
gboolean have_data;
|
gboolean have_data;
|
||||||
|
gboolean cancelled;
|
||||||
|
|
||||||
GstDownloadRate download_rate;
|
GstDownloadRate download_rate;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue