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

Francois Cartegnie git at videolan.org
Thu Nov 26 15:34:20 CET 2020


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Nov 26 14:14:25 2020 +0100| [39c471fa38bbb4894a5a53c003d07aa41fd6d412] | committer: Francois Cartegnie

demux: adaptive: remove mishandled sequence offset

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

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

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

diff --git a/modules/demux/adaptive/playlist/Segment.cpp b/modules/demux/adaptive/playlist/Segment.cpp
index fee0ffe4dc..98023d91c2 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
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 83092d2cdb..9cf00e4ab8 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