tests: souphttpsrc: don't try to connect to dead radio server
authorTim-Philipp Müller <tim@centricular.com>
Fri, 21 Aug 2015 10:52:19 +0000 (11:52 +0100)
committerTim-Philipp Müller <tim@centricular.com>
Fri, 21 Aug 2015 10:52:19 +0000 (11:52 +0100)
tests/check/elements/souphttpsrc.c

index d265d76..c2a7c57 100644 (file)
@@ -387,34 +387,9 @@ GST_START_TEST (test_icy_stream)
   gst_bin_add (GST_BIN (pipe), sink);
   fail_unless (gst_element_link (src, sink));
 
-  /* First try Virgin Radio Ogg stream, to see if there's connectivity and all
-   * (which is an attempt to work around the completely horrid error reporting
-   * and that we can't distinguish different types of failures here). */
-
-  g_object_set (src, "location", "http://ogg2.smgradio.com/vr32.ogg", NULL);
-  g_object_set (src, "num-buffers", 1, NULL);
-  icy_caps = FALSE;
-  gst_element_set_state (pipe, GST_STATE_PLAYING);
-
-  msg = gst_bus_poll (GST_ELEMENT_BUS (pipe),
-      GST_MESSAGE_EOS | GST_MESSAGE_ERROR, -1);
-  if (GST_MESSAGE_TYPE (msg) == GST_MESSAGE_ERROR) {
-    GST_INFO ("looks like there's no net connectivity or sgmradio.com is "
-        "down. In any case, let's just skip this test");
-    gst_message_unref (msg);
-    goto done;
-  }
-  gst_message_unref (msg);
-  msg = NULL;
-  gst_element_set_state (pipe, GST_STATE_NULL);
-
-  /* Now, if the ogg stream works, the mp3 shoutcast stream should work as
-   * well (time will tell if that's true) */
-
   /* Virgin Radio 32kbps mp3 shoutcast stream */
   g_object_set (src, "location", "http://mp3-vr-32.smgradio.com:80/", NULL);
 
-
   /* EOS after the first buffer */
   g_object_set (src, "num-buffers", 1, NULL);
   icy_caps = TRUE;
@@ -422,22 +397,24 @@ GST_START_TEST (test_icy_stream)
   msg = gst_bus_poll (GST_ELEMENT_BUS (pipe),
       GST_MESSAGE_EOS | GST_MESSAGE_ERROR, -1);
 
-  if (GST_MESSAGE_TYPE (msg) == GST_MESSAGE_EOS) {
-    GST_DEBUG ("success, we're done here");
-    gst_message_unref (msg);
-    goto done;
-  }
-
-  {
-    GError *err = NULL;
-
-    gst_message_parse_error (msg, &err, NULL);
-    gst_message_unref (msg);
-    g_error ("Error with ICY mp3 shoutcast stream: %s", err->message);
-    g_error_free (err);
+  switch (GST_MESSAGE_TYPE (msg)) {
+    case GST_MESSAGE_EOS:
+      GST_DEBUG ("success, we're done here");
+      gst_message_unref (msg);
+      break;
+    case GST_MESSAGE_ERROR:{
+      GError *err = NULL;
+
+      gst_message_parse_error (msg, &err, NULL);
+      GST_INFO ("Error with ICY mp3 shoutcast stream: %s", err->message);
+      gst_message_unref (msg);
+      g_clear_error (&err);
+      break;
+    }
+    default:
+      break;
   }
 
-done:
   icy_caps = FALSE;
 
   gst_element_set_state (pipe, GST_STATE_NULL);