hlsdemux: handle 404 from the source element
authorAndoni Morales Alastruey <ylatuya@gmail.com>
Tue, 15 Feb 2011 02:42:29 +0000 (03:42 +0100)
committerSebastian Dröge <sebastian.droege@collabora.co.uk>
Wed, 30 Mar 2011 07:19:21 +0000 (09:19 +0200)
gst/hls/gsthlsdemux.c

index 173ca2bf6aebaae4c93241a57f0d348555e7bc90..4927dd308c8ad30998ebdd5f2f0724e356fb1841 100644 (file)
@@ -336,8 +336,14 @@ gst_hls_demux_sink_event (GstPad * pad, GstEvent * event)
 
       playlist = g_strndup ((gchar *) GST_BUFFER_DATA (demux->playlist),
           GST_BUFFER_SIZE (demux->playlist));
-      gst_m3u8_client_update (demux->client, playlist);
       gst_buffer_unref (demux->playlist);
+      if (!gst_m3u8_client_update (demux->client, playlist)) {
+        /* In most cases, this will happen when if we set a wrong url in the
+         * source element and we have received the 404 HTML response instead of
+         * the playlist */
+        GST_ELEMENT_ERROR (demux, STREAM, DECODE, ("Invalid playlist."), NULL);
+        return FALSE;
+      }
 
       if (!ret && gst_m3u8_client_is_live (demux->client)) {
         GST_ELEMENT_ERROR (demux, RESOURCE, NOT_FOUND,