[vlc-commits] demux: adaptive: download and use index once
Francois Cartegnie
git at videolan.org
Fri Nov 27 11:23:17 CET 2020
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Oct 14 21:16:33 2020 +0200| [4cf6ba8e06e9e1f75a6a9d0509463cbbc24bf136] | committer: Francois Cartegnie
demux: adaptive: download and use index once
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=4cf6ba8e06e9e1f75a6a9d0509463cbbc24bf136
---
modules/demux/adaptive/SegmentTracker.cpp | 9 ++++++---
modules/demux/adaptive/playlist/BaseRepresentation.cpp | 6 ++++++
modules/demux/adaptive/playlist/BaseRepresentation.h | 1 +
3 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/modules/demux/adaptive/SegmentTracker.cpp b/modules/demux/adaptive/SegmentTracker.cpp
index c83a6f1fec..7f987abec8 100644
--- a/modules/demux/adaptive/SegmentTracker.cpp
+++ b/modules/demux/adaptive/SegmentTracker.cpp
@@ -305,9 +305,12 @@ SegmentChunk * SegmentTracker::getNextChunk(bool switch_allowed,
if(!current.index_sent)
{
++next;
- segment = current.rep->getSegment(BaseRepresentation::INFOTYPE_INDEX);
- if(segment)
- return segment->toChunk(resources, connManager, current.number, current.rep);
+ if(current.rep->needsIndex())
+ {
+ segment = current.rep->getSegment(BaseRepresentation::INFOTYPE_INDEX);
+ if(segment)
+ return segment->toChunk(resources, connManager, current.number, current.rep);
+ }
current = next;
}
diff --git a/modules/demux/adaptive/playlist/BaseRepresentation.cpp b/modules/demux/adaptive/playlist/BaseRepresentation.cpp
index b55808d620..6afc11fef1 100644
--- a/modules/demux/adaptive/playlist/BaseRepresentation.cpp
+++ b/modules/demux/adaptive/playlist/BaseRepresentation.cpp
@@ -92,6 +92,12 @@ bool BaseRepresentation::needsUpdate(uint64_t) const
return false;
}
+bool BaseRepresentation::needsIndex() const
+{
+ SegmentBase *base = inheritSegmentBase();
+ return base && base->subSegments().empty();
+}
+
bool BaseRepresentation::runLocalUpdates(SharedResources *)
{
return false;
diff --git a/modules/demux/adaptive/playlist/BaseRepresentation.h b/modules/demux/adaptive/playlist/BaseRepresentation.h
index b770b78ffc..414e10920e 100644
--- a/modules/demux/adaptive/playlist/BaseRepresentation.h
+++ b/modules/demux/adaptive/playlist/BaseRepresentation.h
@@ -66,6 +66,7 @@ namespace adaptive
virtual vlc_tick_t getMinAheadTime (uint64_t) const;
virtual bool needsUpdate (uint64_t) const;
+ virtual bool needsIndex () const;
virtual bool runLocalUpdates (SharedResources *);
virtual void scheduleNextUpdate (uint64_t, bool);
More information about the vlc-commits
mailing list