[vlc-commits] hls: Don't fail when a STREAM-INF is commented.

Hugo Beauzée-Luyssen git at videolan.org
Mon Jan 23 21:52:49 CET 2012


vlc | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Fri Jan 20 15:23:11 2012 +0100| [56a345ef6aa37e3f2b97931908e96b5ac755c760] | committer: Jean-Baptiste Kempf

hls: Don't fail when a STREAM-INF is commented.

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=56a345ef6aa37e3f2b97931908e96b5ac755c760
---

 modules/stream_filter/httplive.c |   44 ++++++++++++++++++++++---------------
 1 files changed, 26 insertions(+), 18 deletions(-)

diff --git a/modules/stream_filter/httplive.c b/modules/stream_filter/httplive.c
index 9ef659a..bfcad5e 100644
--- a/modules/stream_filter/httplive.c
+++ b/modules/stream_filter/httplive.c
@@ -1034,27 +1034,35 @@ static int parse_M3U8(stream_t *s, vlc_array_t *streams, uint8_t *buffer, const
                     err = VLC_ENOMEM;
                 else
                 {
-                    hls_stream_t *hls = NULL;
-                    err = parse_StreamInformation(s, &streams, &hls, line, uri);
-                    free(uri);
-
-                    /* Download playlist file from server */
-                    uint8_t *buf = NULL;
-                    ssize_t len = read_M3U8_from_url(s, &hls->url, &buf);
-                    if (len < 0)
-                        err = VLC_EGENERIC;
-                    else
+                    if (*uri == '#')
                     {
-                        /* Parse HLS m3u8 content. */
-                        err = parse_M3U8(s, streams, buf, len);
-                        free(buf);
+                        msg_Info(s, "Skipping invalid stream-inf: %s", uri);
+                        free(uri);
                     }
-
-                    if (hls)
+                    else
                     {
-                        hls->version = version;
-                        if (!p_sys->b_live)
-                            hls->size = hls_GetStreamSize(hls); /* Stream size (approximate) */
+                        hls_stream_t *hls = NULL;
+                        err = parse_StreamInformation(s, &streams, &hls, line, uri);
+                        free(uri);
+
+                        /* Download playlist file from server */
+                        uint8_t *buf = NULL;
+                        ssize_t len = read_M3U8_from_url(s, &hls->url, &buf);
+                        if (len < 0)
+                            err = VLC_EGENERIC;
+                        else
+                        {
+                            /* Parse HLS m3u8 content. */
+                            err = parse_M3U8(s, streams, buf, len);
+                            free(buf);
+                        }
+
+                        if (hls)
+                        {
+                            hls->version = version;
+                            if (!p_sys->b_live)
+                                hls->size = hls_GetStreamSize(hls); /* Stream size (approximate) */
+                        }
                     }
                 }
                 p_begin = p_read;



More information about the vlc-commits mailing list