mssdemux: add some more error handling
authorThiago Santos <thiago.sousa.santos@collabora.com>
Fri, 21 Dec 2012 19:42:11 +0000 (16:42 -0300)
committerThiago Santos <thiago.sousa.santos@collabora.com>
Wed, 8 May 2013 00:05:11 +0000 (21:05 -0300)
Post error in some more scenarios:
* when the manifest has no streams
* when getting the fragment url fails

ext/smoothstreaming/gstmssdemux.c

index 243a40e..a12e2dd 100644 (file)
@@ -301,7 +301,10 @@ gst_mss_demux_create_streams (GstMssDemux * mssdemux)
 
   if (streams == NULL) {
     GST_INFO_OBJECT (mssdemux, "No streams found in the manifest");
-    /* TODO  post eos? */
+    GST_ELEMENT_ERROR (mssdemux, STREAM, DEMUX,
+        (_("This file contains no playable streams.")),
+        ("no streams found at the Manifest"));
+    return;
   }
 
   for (iter = streams; iter; iter = g_slist_next (iter)) {
@@ -434,7 +437,7 @@ gst_mss_demux_stream_loop (GstMssDemuxStream * stream)
       break;
   }
   if (!path) {
-    /* TODO */
+    goto no_url_error;
   }
   GST_DEBUG_OBJECT (mssdemux, "Got url path '%s' for stream %p", path, stream);
 
@@ -448,7 +451,7 @@ gst_mss_demux_stream_loop (GstMssDemuxStream * stream)
   buffer = gst_buffer_make_metadata_writable (buffer);
   gst_buffer_set_caps (buffer, GST_PAD_CAPS (stream->pad));
 
-  ret = gst_pad_push (stream->pad, buffer);     /* TODO check return */
+  ret = gst_pad_push (stream->pad, buffer);
   switch (ret) {
     case GST_FLOW_UNEXPECTED:
       goto eos;                 /* EOS ? */
@@ -473,6 +476,14 @@ eos:
     gst_task_stop (stream->stream_task);
     return;
   }
+no_url_error:
+  {
+    GST_ELEMENT_ERROR (mssdemux, STREAM, DEMUX,
+        (_("Failed to get fragment URL.")),
+        ("An error happened when getting fragment URL"));
+    gst_task_stop (stream->stream_task);
+    return;
+  }
 error:
   {
     GST_WARNING_OBJECT (mssdemux, "Error while pushing fragment");