[vlc-commits] demux: hls: don't compute duration from unloaded playlists

Francois Cartegnie git at videolan.org
Tue Sep 22 00:38:52 CEST 2015


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue Sep 22 00:32:55 2015 +0200| [2d717efd9f5bde850ce5620d1f0325b870a5da89] | committer: Francois Cartegnie

demux: hls: don't compute duration from unloaded playlists

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

 modules/demux/hls/playlist/M3U8.cpp           |    2 +-
 modules/demux/hls/playlist/Representation.cpp |    5 +++++
 modules/demux/hls/playlist/Representation.hpp |    1 +
 3 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/modules/demux/hls/playlist/M3U8.cpp b/modules/demux/hls/playlist/M3U8.cpp
index 6fad0d9..3fd0755 100644
--- a/modules/demux/hls/playlist/M3U8.cpp
+++ b/modules/demux/hls/playlist/M3U8.cpp
@@ -56,7 +56,7 @@ bool M3U8::isLive() const
             for(itr = adaptSet->getRepresentations().begin(); itr != adaptSet->getRepresentations().end(); ++itr)
             {
                 const Representation *rep = dynamic_cast<const Representation *>(*itr);
-                if(rep->isLive())
+                if(rep->initialized() && rep->isLive())
                     return true;
             }
         }
diff --git a/modules/demux/hls/playlist/Representation.cpp b/modules/demux/hls/playlist/Representation.cpp
index e190c30..a663736 100644
--- a/modules/demux/hls/playlist/Representation.cpp
+++ b/modules/demux/hls/playlist/Representation.cpp
@@ -60,6 +60,11 @@ bool Representation::isLive() const
     return b_live;
 }
 
+bool Representation::initialized() const
+{
+    return b_loaded;
+}
+
 void Representation::setPlaylistUrl(const std::string &uri)
 {
     playlistUrl = Url(uri);
diff --git a/modules/demux/hls/playlist/Representation.hpp b/modules/demux/hls/playlist/Representation.hpp
index a346ee2..ab17742 100644
--- a/modules/demux/hls/playlist/Representation.hpp
+++ b/modules/demux/hls/playlist/Representation.hpp
@@ -45,6 +45,7 @@ namespace hls
                 void setPlaylistUrl(const std::string &);
                 Url getPlaylistUrl() const;
                 bool isLive() const;
+                bool initialized() const;
                 virtual bool needsUpdate() const;  /* reimpl */
                 virtual void debug(vlc_object_t *, int) const;  /* reimpl */
                 virtual void runLocalUpdates(mtime_t, uint64_t); /* reimpl */



More information about the vlc-commits mailing list