[vlc-commits] demux: adaptive: remove mishandled sequence offset

Francois Cartegnie git at videolan.org
Mon Dec 14 10:41:38 UTC 2020


vlc/vlc-3.0 | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Nov 26 14:14:25 2020 +0100| [0280fe07b5044646f33916db01f0b312439c16b7] | committer: Francois Cartegnie

demux: adaptive: remove mishandled sequence offset

mishandled in lookups. should be enforced in parsing.
refs VLCKit/-/issues/382

(cherry picked from commit 39c471fa38bbb4894a5a53c003d07aa41fd6d412)
(cherry picked from commit 444c839b2b56b176fee1f84a081e6b39a6b6474f)

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

 modules/demux/adaptive/playlist/Segment.cpp | 10 +++-------
 modules/demux/adaptive/playlist/Segment.h   |  2 --
 modules/demux/hls/playlist/HLSSegment.cpp   |  2 +-
 3 files changed, 4 insertions(+), 10 deletions(-)

diff --git a/modules/demux/adaptive/playlist/Segment.cpp b/modules/demux/adaptive/playlist/Segment.cpp
index 44c17c1c6d..b4d5f6d7cf 100644
--- a/modules/demux/adaptive/playlist/Segment.cpp
+++ b/modules/demux/adaptive/playlist/Segment.cpp
@@ -39,9 +39,6 @@
 using namespace adaptive::http;
 using namespace adaptive::playlist;
 
-const int ISegment::SEQUENCE_INVALID = 0;
-const int ISegment::SEQUENCE_FIRST   = 1;
-
 ISegment::ISegment(const ICanonicalUrl *parent):
     ICanonicalUrl( parent ),
     startByte  (0),
@@ -51,7 +48,7 @@ ISegment::ISegment(const ICanonicalUrl *parent):
     classId = CLASSID_ISEGMENT;
     startTime.Set(0);
     duration.Set(0);
-    sequence = SEQUENCE_INVALID;
+    sequence = 0;
     templated = false;
     discontinuity = false;
 }
@@ -122,7 +119,7 @@ void ISegment::setByteRange(size_t start, size_t end)
 
 void ISegment::setSequenceNumber(uint64_t seq)
 {
-    sequence = SEQUENCE_FIRST + seq;
+    sequence = seq;
 }
 
 uint64_t ISegment::getSequenceNumber() const
@@ -209,8 +206,7 @@ void Segment::addSubSegment(SubSegment *subsegment)
     {
         /* Use our own sequence number, and since it it now
            uneffective, also for next subsegments numbering */
-        subsegment->setSequenceNumber(getSequenceNumber());
-        setSequenceNumber(getSequenceNumber());
+        subsegment->setSequenceNumber(subsegments.size());
     }
     subsegments.push_back(subsegment);
 }
diff --git a/modules/demux/adaptive/playlist/Segment.h b/modules/demux/adaptive/playlist/Segment.h
index 10c481f041..46b4b131ad 100644
--- a/modules/demux/adaptive/playlist/Segment.h
+++ b/modules/demux/adaptive/playlist/Segment.h
@@ -94,8 +94,6 @@ namespace adaptive
                 int                     classId;
                 bool                    templated;
                 uint64_t                sequence;
-                static const int        SEQUENCE_INVALID;
-                static const int        SEQUENCE_FIRST;
         };
 
         class Segment : public ISegment
diff --git a/modules/demux/hls/playlist/HLSSegment.cpp b/modules/demux/hls/playlist/HLSSegment.cpp
index 9c1a067344..2ad4187a3e 100644
--- a/modules/demux/hls/playlist/HLSSegment.cpp
+++ b/modules/demux/hls/playlist/HLSSegment.cpp
@@ -44,7 +44,7 @@ bool HLSSegment::prepareChunk(SharedResources *res, SegmentChunk *chunk, BaseRep
     {
         if (encryption.iv.size() != 16)
         {
-            uint64_t sequence = getSequenceNumber() - Segment::SEQUENCE_FIRST;
+            uint64_t sequence = getSequenceNumber();
             encryption.iv.clear();
             encryption.iv.resize(16);
             encryption.iv[15] = (sequence >> 0) & 0xff;



More information about the vlc-commits mailing list