[vlc-commits] demux: adaptive: always retrieve start segment number for live
Francois Cartegnie
git at videolan.org
Tue Mar 24 23:35:16 CET 2020
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Sun Mar 22 19:07:55 2020 +0100| [7bea09c4bb6d5510e9bdbd1114cda86a63b71260] | committer: Francois Cartegnie
demux: adaptive: always retrieve start segment number for live
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=7bea09c4bb6d5510e9bdbd1114cda86a63b71260
---
modules/demux/adaptive/SegmentTracker.cpp | 21 ++++++++++++++-------
1 file changed, 14 insertions(+), 7 deletions(-)
diff --git a/modules/demux/adaptive/SegmentTracker.cpp b/modules/demux/adaptive/SegmentTracker.cpp
index b82c7f2103..ff853558d7 100644
--- a/modules/demux/adaptive/SegmentTracker.cpp
+++ b/modules/demux/adaptive/SegmentTracker.cpp
@@ -30,6 +30,9 @@
#include "playlist/SegmentChunk.hpp"
#include "logic/AbstractAdaptationLogic.h"
+#include <cassert>
+#include <limits>
+
using namespace adaptive;
using namespace adaptive::logic;
using namespace adaptive::playlist;
@@ -81,7 +84,7 @@ SegmentTracker::SegmentTracker(SharedResources *res,
{
resources = res;
first = true;
- curNumber = next = 0;
+ curNumber = next = std::numeric_limits<uint64_t>::max();
initializing = true;
index_sent = false;
init_sent = false;
@@ -148,7 +151,10 @@ bool SegmentTracker::segmentsListReady() const
if(!rep)
rep = logic->getNextRepresentation(adaptationSet, NULL);
if(rep && rep->getPlaylist()->isLive())
+ {
+ assert(curNumber != std::numeric_limits<uint64_t>::max());
return rep->getMinAheadTime(curNumber) > 0;
+ }
return true;
}
@@ -205,15 +211,16 @@ SegmentChunk * SegmentTracker::getNextChunk(bool switch_allowed,
if(rep->needsUpdate())
b_updated = rep->runLocalUpdates(resources);
- if(prevRep && !rep->consistentSegmentNumber())
+ if(curNumber == std::numeric_limits<uint64_t>::max())
{
- /* Convert our segment number */
- next = rep->translateSegmentNumber(next, prevRep);
+ next = rep->getLiveStartSegmentNumber(next);
+ if(next == std::numeric_limits<uint64_t>::max())
+ return NULL;
}
- else if(first && rep->getPlaylist()->isLive())
+ else if(prevRep && !rep->consistentSegmentNumber())
{
- next = rep->getLiveStartSegmentNumber(next);
- first = false;
+ /* Convert our segment number */
+ next = rep->translateSegmentNumber(next, prevRep);
}
if(b_updated)
More information about the vlc-commits
mailing list