mssdemux: add a maximum error count for downloads
authorThiago Santos <thiago.sousa.santos@collabora.com>
Thu, 7 Feb 2013 06:10:46 +0000 (03:10 -0300)
committerThiago Santos <thiago.sousa.santos@collabora.com>
Wed, 8 May 2013 00:09:48 +0000 (21:09 -0300)
mssdemux will tolerate a few download errors before emitting an
error message to the bus

ext/smoothstreaming/gstmssdemux.c
ext/smoothstreaming/gstmssdemux.h

index 8127a4d..0b4e622 100644 (file)
@@ -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;
   }
 }
index 2c48aac..5e4f185 100644 (file)
@@ -74,6 +74,8 @@ struct _GstMssDemuxStream {
   gboolean have_data;
 
   GstDownloadRate download_rate;
+
+  guint download_error_count;
 };
 
 struct _GstMssDemux {