[vlc-commits] [Git][videolan/vlc][master] demux: adaptive: fix start with indexes only

Steve Lhomme (@robUx4) gitlab at videolan.org
Sat Jun 29 13:06:37 UTC 2024



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
9f9c466b by François Cartegnie at 2024-06-29T12:53:24+00:00
demux: adaptive: fix start with indexes only

refs #28683

- - - - -


2 changed files:

- modules/demux/adaptive/SegmentTracker.cpp
- modules/demux/adaptive/Streams.cpp


Changes:

=====================================
modules/demux/adaptive/SegmentTracker.cpp
=====================================
@@ -296,7 +296,7 @@ SegmentTracker::prepareChunk(bool switch_allowed, Position pos) const
     bool b_gap = true;
     ISegment *datasegment = pos.rep->getNextMediaSegment(pos.number, &pos.number, &b_gap);
 
-    if(!datasegment)
+    if(!datasegment && (!pos.rep->needsIndex() || pos.index_sent))
         return ChunkEntry();
 
     ISegment *segment = nullptr;
@@ -322,12 +322,12 @@ SegmentTracker::prepareChunk(bool switch_allowed, Position pos) const
     if(!segmentChunk)
         return ChunkEntry();
 
-    if(segment != datasegment) /* need to set for init */
+    if(segment != datasegment && datasegment) /* need to set for init */
         segmentChunk->discontinuitySequenceNumber = datasegment->getDiscontinuitySequenceNumber();
 
     vlc_tick_t startTime = VLC_TICK_INVALID;
     vlc_tick_t duration = 0;
-    vlc_tick_t displayTime = datasegment->getDisplayTime();
+    vlc_tick_t displayTime = datasegment ? datasegment->getDisplayTime() : VLC_TICK_INVALID;
     /* timings belong to timeline and are not set on the segment or need profile timescale */
     if(pos.rep->getPlaybackTimeDurationBySegmentNumber(pos.number, &startTime, &duration))
         startTime += VLC_TICK_0;


=====================================
modules/demux/adaptive/Streams.cpp
=====================================
@@ -622,11 +622,14 @@ ChunkInterface * AbstractStream::getNextChunk() const
 {
     const bool b_restarting = fakeEsOut()->restarting();
     ChunkInterface *ck = segmentTracker->getNextChunk(!b_restarting);
+
     if(ck && !fakeEsOut()->hasSegmentStartTimes())
         fakeEsOut()->setSegmentStartTimes(startTimeContext);
 
     if(ck && !fakeEsOut()->hasSynchronizationReference())
     {
+        if(!fakeEsOut()->hasSegmentStartTimes())
+            return ck;
         assert(fakeEsOut()->hasSegmentStartTimes());
         SynchronizationReference r;
         if(segmentTracker->getSynchronizationReference(currentSequence, startTimeContext.media, r))



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/9f9c466bc14c1dcd75564c7cd18d031ea9e76325

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/9f9c466bc14c1dcd75564c7cd18d031ea9e76325
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