[vlc-commits] demux: adaptive: replace now single segment vector in template

Francois Cartegnie git at videolan.org
Wed Jan 6 20:27:01 UTC 2021


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Jan  6 16:11:16 2021 +0100| [cdf4d24370b8edb0d4975cab73cab6f8cd5c1d70] | committer: Francois Cartegnie

demux: adaptive: replace now single segment vector in template

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

 modules/demux/adaptive/playlist/SegmentTemplate.cpp | 13 +++++++------
 modules/demux/adaptive/playlist/SegmentTemplate.h   |  2 +-
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/modules/demux/adaptive/playlist/SegmentTemplate.cpp b/modules/demux/adaptive/playlist/SegmentTemplate.cpp
index d34cb018de..64907ff248 100644
--- a/modules/demux/adaptive/playlist/SegmentTemplate.cpp
+++ b/modules/demux/adaptive/playlist/SegmentTemplate.cpp
@@ -55,17 +55,17 @@ SegmentTemplate::SegmentTemplate( SegmentInformation *parent ) :
 {
     initialisationSegment.Set( nullptr );
     parentSegmentInformation = parent;
-    segments.push_back( new SegmentTemplateSegment( this, parent ) );
+    virtualsegment = new SegmentTemplateSegment( this, parent );
 }
 
 SegmentTemplate::~SegmentTemplate()
 {
-    delete *segments.begin();
+    delete virtualsegment;
 }
 
 void SegmentTemplate::setSourceUrl( const std::string &url )
 {
-    (*segments.begin())->setSourceUrl(url);
+    virtualsegment->setSourceUrl(url);
 }
 
 void SegmentTemplate::pruneByPlaybackTime(vlc_tick_t time)
@@ -111,7 +111,8 @@ uint64_t SegmentTemplate::getLiveTemplateNumber(vlc_tick_t playbacktime, bool ab
 void SegmentTemplate::debug(vlc_object_t *obj, int indent) const
 {
     AbstractSegmentBaseType::debug(obj, indent);
-    (*segments.begin())->debug(obj, indent);
+    if(virtualsegment)
+        virtualsegment->debug(obj, indent);
     const AbstractAttr *p = getAttribute(Type::Timeline);
     if(p)
         static_cast<const SegmentTimeline *> (p)->debug(obj, indent + 1);
@@ -138,7 +139,7 @@ Segment * SegmentTemplate::getMediaSegment(uint64_t number) const
 {
     const SegmentTimeline *tl = inheritSegmentTimeline();
     if(tl == nullptr || tl->maxElementNumber() > number)
-        return *segments.begin();
+        return virtualsegment;
     return nullptr;
 }
 
@@ -186,7 +187,7 @@ Segment *  SegmentTemplate::getNextMediaSegment(uint64_t i_pos,uint64_t *pi_newp
         /* start number */
         *pi_newpos = std::max(inheritStartNumber(), i_pos);
     }
-    return *segments.begin();
+    return virtualsegment;
 }
 
 uint64_t SegmentTemplate::getStartSegmentNumber() const
diff --git a/modules/demux/adaptive/playlist/SegmentTemplate.h b/modules/demux/adaptive/playlist/SegmentTemplate.h
index 71ba54ef72..e55ead23b7 100644
--- a/modules/demux/adaptive/playlist/SegmentTemplate.h
+++ b/modules/demux/adaptive/playlist/SegmentTemplate.h
@@ -71,7 +71,7 @@ namespace adaptive
 
             protected:
                 SegmentInformation *parentSegmentInformation;
-                std::vector<SegmentTemplateSegment *> segments; /* should have only 1 */
+                SegmentTemplateSegment *virtualsegment;
         };
 
         class SegmentTemplateInit : public InitSegment



More information about the vlc-commits mailing list