[vlc-commits] httplive: parse EXT-X-MEDIA-SEQUENCE only once

Rui Zhang git at videolan.org
Sun Sep 30 17:03:19 CEST 2012


vlc/vlc-2.0 | branch: master | Rui Zhang <bbcallen at gmail.com> | Tue May 29 20:42:41 2012 +0800| [93b37f19b5cff53932ed034acb906e717ca2574b] | committer: Jean-Baptiste Kempf

httplive: parse EXT-X-MEDIA-SEQUENCE only once

refs #6897
Signed-off-by: Hugo Beauzée-Luyssen <beauze.h at gmail.com>
(cherry picked from commit 4ab81377158ece056cae3a45084f20efb5df79d7)

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

> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.0.git/?a=commit;h=93b37f19b5cff53932ed034acb906e717ca2574b
---

 modules/stream_filter/httplive.c |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/modules/stream_filter/httplive.c b/modules/stream_filter/httplive.c
index 98e6db2..3180e2c 100644
--- a/modules/stream_filter/httplive.c
+++ b/modules/stream_filter/httplive.c
@@ -1069,6 +1069,7 @@ static int parse_M3U8(stream_t *s, vlc_array_t *streams, uint8_t *buffer, const
         assert(hls);
 
         /* */
+        bool media_sequence_loaded = false;
         int segment_duration = -1;
         do
         {
@@ -1083,7 +1084,15 @@ static int parse_M3U8(stream_t *s, vlc_array_t *streams, uint8_t *buffer, const
             else if (strncmp(line, "#EXT-X-TARGETDURATION", 21) == 0)
                 err = parse_TargetDuration(s, hls, line);
             else if (strncmp(line, "#EXT-X-MEDIA-SEQUENCE", 21) == 0)
-                err = parse_MediaSequence(s, hls, line);
+            {
+                /* A Playlist file MUST NOT contain more than one EXT-X-MEDIA-SEQUENCE tag. */
+                /* We only care about first one */
+                if (!media_sequence_loaded)
+                {
+                    err = parse_MediaSequence(s, hls, line);
+                    media_sequence_loaded = true;
+                }
+            }
             else if (strncmp(line, "#EXT-X-KEY", 10) == 0)
                 err = parse_Key(s, hls, line);
             else if (strncmp(line, "#EXT-X-PROGRAM-DATE-TIME", 24) == 0)



More information about the vlc-commits mailing list