[vlc-commits] demux: dash: fix dead start segment with small availability windows
Francois Cartegnie
git at videolan.org
Wed Sep 5 17:32:00 CEST 2018
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Sep 5 17:30:28 2018 +0200| [560ce4616e3409630a3eaad1a312553102329f3d] | committer: Francois Cartegnie
demux: dash: fix dead start segment with small availability windows
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=560ce4616e3409630a3eaad1a312553102329f3d
---
modules/demux/adaptive/playlist/SegmentInformation.cpp | 7 +++++--
modules/demux/adaptive/playlist/SegmentTemplate.cpp | 2 +-
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/modules/demux/adaptive/playlist/SegmentInformation.cpp b/modules/demux/adaptive/playlist/SegmentInformation.cpp
index 223b86c0a3..8dc6bcf297 100644
--- a/modules/demux/adaptive/playlist/SegmentInformation.cpp
+++ b/modules/demux/adaptive/playlist/SegmentInformation.cpp
@@ -215,8 +215,11 @@ uint64_t SegmentInformation::getLiveStartSegmentNumber(uint64_t def) const
else
start = end - count;
- const uint64_t bufcount = ( OFFSET_FROM_END + timescale.ToScaled(i_max_buffering) /
- mediaSegmentTemplate->duration.Get() );
+ uint64_t bufcount = ( OFFSET_FROM_END + timescale.ToScaled(i_max_buffering) /
+ mediaSegmentTemplate->duration.Get() );
+ /* Ensure we always pick > start # of availability window as this segment might no longer be avail */
+ if( end - start <= bufcount )
+ bufcount = end - start - 1;
return ( end - start > bufcount ) ? end - bufcount : start;
}
diff --git a/modules/demux/adaptive/playlist/SegmentTemplate.cpp b/modules/demux/adaptive/playlist/SegmentTemplate.cpp
index a81b53a50d..27ae45983d 100644
--- a/modules/demux/adaptive/playlist/SegmentTemplate.cpp
+++ b/modules/demux/adaptive/playlist/SegmentTemplate.cpp
@@ -90,7 +90,7 @@ uint64_t MediaSegmentTemplate::getCurrentLiveTemplateNumber() const
time_t streamstart = parentSegmentInformation->getPlaylist()->availabilityStartTime.Get();
streamstart += parentSegmentInformation->getPeriodStart();
stime_t elapsed = timescale.ToScaled(vlc_tick_from_sec(playbacktime - streamstart));
- number += elapsed / dur - 2;
+ number += elapsed / dur;
}
return number;
More information about the vlc-commits
mailing list