[vlc-commits] [Git][videolan/vlc][master] demux: adaptive: fix relative merge last segment duplication

François Cartegnie (@fcartegnie) gitlab at videolan.org
Sun Apr 3 14:25:59 UTC 2022



François Cartegnie pushed to branch master at VideoLAN / VLC


Commits:
95f144ce by Francois Cartegnie at 2022-04-03T13:56:55+00:00
demux: adaptive: fix relative merge last segment duplication

- - - - -


2 changed files:

- modules/demux/adaptive/playlist/SegmentList.cpp
- modules/demux/adaptive/test/playlist/SegmentList.cpp


Changes:

=====================================
modules/demux/adaptive/playlist/SegmentList.cpp
=====================================
@@ -116,7 +116,7 @@ void SegmentList::updateWith(AbstractMultipleSegmentBaseType *updated_,
         const uint64_t oldest = updated->segments.front()->getSequenceNumber();
 
         /* filter out known segments from the update */
-        updated->pruneBySegmentNumber(prevSegment->getSequenceNumber());
+        updated->pruneBySegmentNumber(prevSegment->getSequenceNumber() + 1);
 
         if(updated->segments.empty())
             return;


=====================================
modules/demux/adaptive/test/playlist/SegmentList.cpp
=====================================
@@ -137,6 +137,37 @@ int SegmentList_test() try
     segmentList.reset();
     segmentList2.reset();
 
+    /* overlapping updates, relative timings */
+    segmentList = std::make_unique<SegmentList>(nullptr, true);
+    segmentList->addAttribute(new TimescaleAttr(timescale));
+    segmentList->addAttribute(new DurationAttr(100));
+    Expect(segmentList->inheritDuration());
+    for(int i=0; i<2; i++)
+    {
+        seg = std::make_unique<Segment>(nullptr);
+        seg->setSequenceNumber(123 + i);
+        seg->startTime.Set(START + 100 * i);
+        seg->duration.Set(100);
+        segmentList->addSegment(seg.release());
+    }
+    segmentList2 = std::make_unique<SegmentList>(nullptr, true);
+    for(int i=0; i<3; i++)
+    {
+        seg = std::make_unique<Segment>(nullptr);
+        seg->setSequenceNumber(123 + i);
+        seg->startTime.Set(START + 100 * i);
+        seg->duration.Set(100);
+        segmentList2->addSegment(seg.release());
+    }
+    segmentList->updateWith(segmentList2.get());
+    Expect(segmentList->getSegments().size() == 3);
+    Expect(segmentList->getSegments().at(0)->getSequenceNumber() == 123);
+    Expect(segmentList->getSegments().at(1)->getSequenceNumber() == 124);
+    Expect(segmentList->getSegments().at(2)->getSequenceNumber() == 125);
+
+    segmentList.reset();
+    segmentList2.reset();
+
     /* gap updates, relative timings */
     segmentList = std::make_unique<SegmentList>(nullptr, true);
     segmentList->addAttribute(new TimescaleAttr(timescale));



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/95f144cec26b2751bc2b5a5bcdbd26730ee2f207

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/95f144cec26b2751bc2b5a5bcdbd26730ee2f207
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list