From bf0ea5d5617ddf65e306f67490f9d84908459a86 Mon Sep 17 00:00:00 2001 From: Thiago Santos Date: Thu, 7 Feb 2013 03:10:46 -0300 Subject: [PATCH] mssdemux: add a maximum error count for downloads mssdemux will tolerate a few download errors before emitting an error message to the bus --- ext/smoothstreaming/gstmssdemux.c | 9 ++++++++- ext/smoothstreaming/gstmssdemux.h | 2 ++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/ext/smoothstreaming/gstmssdemux.c b/ext/smoothstreaming/gstmssdemux.c index 8127a4db93..0b4e6229c4 100644 --- a/ext/smoothstreaming/gstmssdemux.c +++ b/ext/smoothstreaming/gstmssdemux.c @@ -84,6 +84,7 @@ GST_DEBUG_CATEGORY (mssdemux_debug); #define DEFAULT_BITRATE_LIMIT 0.8 #define DOWNLOAD_RATE_MAX_HISTORY_LENGTH 5 +#define MAX_DOWNLOAD_ERROR_COUNT 3 enum { @@ -1223,6 +1224,8 @@ gst_mss_demux_download_loop (GstMssDemuxStream * stream) break; } + stream->download_error_count = 0; + if (buffer) { gst_mss_stream_advance_fragment (stream->manifest_stream); } @@ -1241,7 +1244,11 @@ eos: error: { GST_WARNING_OBJECT (mssdemux, "Error while pushing fragment"); - gst_task_pause (stream->download_task); + if (++stream->download_error_count >= DOWNLOAD_RATE_MAX_HISTORY_LENGTH) { + GST_ELEMENT_ERROR (mssdemux, RESOURCE, NOT_FOUND, + (_("Couldn't download fragments")), + ("fragment downloading has failed too much consecutive times")); + } return; } } diff --git a/ext/smoothstreaming/gstmssdemux.h b/ext/smoothstreaming/gstmssdemux.h index 2c48aac364..5e4f18502c 100644 --- a/ext/smoothstreaming/gstmssdemux.h +++ b/ext/smoothstreaming/gstmssdemux.h @@ -74,6 +74,8 @@ struct _GstMssDemuxStream { gboolean have_data; GstDownloadRate download_rate; + + guint download_error_count; }; struct _GstMssDemux { -- 2.34.1