[vlc-commits] demux: hls: workaround failed update loops

Francois Cartegnie git at videolan.org
Mon Apr 6 10:16:25 CEST 2020


vlc/vlc-3.0 | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Sun Apr  5 20:36:57 2020 +0200| [438fabd5cd68756ab196d7d0387315c63feca697] | committer: Francois Cartegnie

demux: hls: workaround failed update loops

(cherry picked from commit 46ff0e4ec29ffbf946c148786fcc487ea7982753)

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

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

diff --git a/modules/demux/hls/playlist/Representation.cpp b/modules/demux/hls/playlist/Representation.cpp
index 9c8c979edb..118545b538 100644
--- a/modules/demux/hls/playlist/Representation.cpp
+++ b/modules/demux/hls/playlist/Representation.cpp
@@ -42,6 +42,7 @@ Representation::Representation  ( BaseAdaptationSet *set ) :
 {
     b_live = true;
     b_loaded = false;
+    b_failed = false;
     nextUpdateTime = 0;
     targetDuration = 0;
     streamFormat = StreamFormat::UNKNOWN;
@@ -133,7 +134,7 @@ void Representation::scheduleNextUpdate(uint64_t number)
 
 bool Representation::needsUpdate() const
 {
-    return !b_loaded || (isLive() && nextUpdateTime < time(NULL));
+    return !b_failed && (!b_loaded || (isLive() && nextUpdateTime < time(NULL)));
 }
 
 bool Representation::runLocalUpdates(SharedResources *res)
@@ -143,8 +144,10 @@ bool Representation::runLocalUpdates(SharedResources *res)
     if(!b_loaded || (isLive() && nextUpdateTime < now))
     {
         M3U8Parser parser(res);
-        parser.appendSegmentsFromPlaylistURI(playlist->getVLCObject(), this);
-        b_loaded = true;
+        if(!parser.appendSegmentsFromPlaylistURI(playlist->getVLCObject(), this))
+            b_failed = true;
+        else
+            b_loaded = true;
 
         return true;
     }
diff --git a/modules/demux/hls/playlist/Representation.hpp b/modules/demux/hls/playlist/Representation.hpp
index 8659fe245b..8446750f86 100644
--- a/modules/demux/hls/playlist/Representation.hpp
+++ b/modules/demux/hls/playlist/Representation.hpp
@@ -57,6 +57,7 @@ namespace hls
                 StreamFormat streamFormat;
                 bool b_live;
                 bool b_loaded;
+                bool b_failed;
                 time_t nextUpdateTime;
                 time_t targetDuration;
                 Url playlistUrl;



More information about the vlc-commits mailing list