gst-plugins-bad: hlsdemux: handle 404 from the source element

Sebastian Dröge slomo at kemper.freedesktop.org
Wed Mar 30 01:07:40 PDT 2011


Module: gst-plugins-bad
Branch: master
Commit: 8a683fc035ef0d96bc021ccee36b1ac0f98bf147
URL:    http://cgit.freedesktop.org/gstreamer/gst-plugins-bad/commit/?id=8a683fc035ef0d96bc021ccee36b1ac0f98bf147

Author: Andoni Morales Alastruey <ylatuya at gmail.com>
Date:   Tue Feb 15 03:42:29 2011 +0100

hlsdemux: handle 404 from the source element

---

 gst/hls/gsthlsdemux.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/gst/hls/gsthlsdemux.c b/gst/hls/gsthlsdemux.c
index 173ca2b..4927dd3 100644
--- a/gst/hls/gsthlsdemux.c
+++ b/gst/hls/gsthlsdemux.c
@@ -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,



More information about the gstreamer-commits mailing list