hlsdemux: Make sure to ignore \r in line endings in every case
authorSebastian Dröge <sebastian@centricular.com>
Wed, 12 Feb 2014 17:47:45 +0000 (18:47 +0100)
committerSebastian Dröge <sebastian@centricular.com>
Wed, 12 Feb 2014 17:47:45 +0000 (18:47 +0100)
ext/hls/m3u8.c

index 97ac3cc..fe89c0b 100644 (file)
@@ -263,12 +263,17 @@ gst_m3u8_update (GstM3U8 * self, gchar * data, gboolean * updated)
   title = NULL;
   data += 7;
   while (TRUE) {
+    gchar *r;
+
     end = g_utf8_strchr (data, -1, '\n');
     if (end)
       *end = '\0';
 
+    r = g_utf8_strchr (data, -1, '\r');
+    if (r)
+      *r = '\0';
+
     if (data[0] != '#') {
-      gchar *r;
 
       if (duration <= 0 && list == NULL) {
         GST_LOG ("%s: got line without EXTINF or EXTSTREAMINF, dropping", data);
@@ -279,10 +284,6 @@ gst_m3u8_update (GstM3U8 * self, gchar * data, gboolean * updated)
       if (data == NULL)
         goto next_line;
 
-      r = g_utf8_strchr (data, -1, '\r');
-      if (r)
-        *r = '\0';
-
       if (list != NULL) {
         if (g_list_find_custom (self->lists, data,
                 (GCompareFunc) _m3u8_compare_uri)) {