[vlc-commits] demux: hls: don't allow mixed live/static playlists

Francois Cartegnie git at videolan.org
Thu Jul 14 19:26:06 CEST 2016


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Jul 13 14:57:10 2016 +0200| [a1b3900b60fc61348da15bd157aeb765871a5133] | committer: Francois Cartegnie

demux: hls: don't allow mixed live/static playlists

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

 modules/demux/hls/playlist/M3U8.cpp |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/modules/demux/hls/playlist/M3U8.cpp b/modules/demux/hls/playlist/M3U8.cpp
index 1ebd8b0..6484141 100644
--- a/modules/demux/hls/playlist/M3U8.cpp
+++ b/modules/demux/hls/playlist/M3U8.cpp
@@ -44,6 +44,7 @@ M3U8::~M3U8()
 
 bool M3U8::isLive() const
 {
+    bool b_live = false;
     std::vector<BasePeriod *>::const_iterator itp;
     for(itp = periods.begin(); itp != periods.end(); ++itp)
     {
@@ -56,13 +57,18 @@ bool M3U8::isLive() const
             for(itr = adaptSet->getRepresentations().begin(); itr != adaptSet->getRepresentations().end(); ++itr)
             {
                 const Representation *rep = dynamic_cast<const Representation *>(*itr);
-                if(rep->initialized() && rep->isLive())
-                    return true;
+                if(rep->initialized())
+                {
+                    if(rep->isLive())
+                        b_live = true;
+                    else
+                        return false; /* Any non live has higher priority */
+                }
             }
         }
     }
 
-    return false;
+    return b_live;
 }
 
 void M3U8::debug()



More information about the vlc-commits mailing list