Commit 7e1aa3a3 authored by Francois Cartegnie's avatar Francois Cartegnie

demux: dash: don't expect new segment on end of timeline

static live with template+timeline never ended
parent a53fc8ff
......@@ -147,9 +147,11 @@ ISegment * SegmentInformation::getSegment(SegmentInfoType type, uint64_t pos) co
if( size )
{
/* check if that's a template (fixme: find a better way) */
BaseSegmentTemplate *templ;
if( size == 1 && (templ = dynamic_cast<BaseSegmentTemplate*>(retSegments[0])) )
MediaSegmentTemplate *templ;
if( size == 1 && (templ = dynamic_cast<MediaSegmentTemplate*>(retSegments[0])) )
{
if(templ->segmentTimeline.Get() == NULL ||
templ->segmentTimeline.Get()->maxElementNumber() > pos)
return templ;
}
else if( pos < size )
......
......@@ -108,6 +108,17 @@ mtime_t SegmentTimeline::getScaledPlaybackTimeByElementNumber(uint64_t number) c
return totalscaledtime;
}
size_t SegmentTimeline::maxElementNumber() const
{
size_t count = 0;
std::list<Element *>::const_iterator it;
for(it = elements.begin(); it != elements.end(); it++)
count += (*it)->r + 1;
return pruned + count - 1;
}
size_t SegmentTimeline::prune(mtime_t time)
{
mtime_t scaled = time * inheritTimescale() / CLOCK_FREQ;
......
......@@ -46,6 +46,7 @@ namespace adaptative
void addElement(mtime_t d, uint64_t r = 0, mtime_t t = 0);
uint64_t getElementNumberByScaledPlaybackTime(time_t) const;
mtime_t getScaledPlaybackTimeByElementNumber(uint64_t) const;
size_t maxElementNumber() const;
size_t prune(mtime_t);
void mergeWith(SegmentTimeline &);
mtime_t start() const;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment