Commit 15f5497b authored by François Cartegnie's avatar François Cartegnie 🤞
Browse files

demux: adaptive: fix buffered amount condition

on seek or activation, the seek reference point is
inside a segment and if that segment is longer than
buffering duration, it could never start.
(segment start + buffering amount < deadline)
parent 7766f8aa
......@@ -229,7 +229,7 @@ AbstractStream::buffering_status PlaylistManager::bufferize(vlc_tick_t i_nzdeadl
PrioritizedAbstractStream &p = *it;
p.st = *sit;
p.status = p.st->getLastBufferStatus();
p.demuxed_amount = p.st->getDemuxedAmount();
p.demuxed_amount = p.st->getDemuxedAmount(i_nzdeadline);
++it;
}
std::sort(prioritized_streams.begin(), prioritized_streams.end(), streamCompare);
......
......@@ -296,9 +296,9 @@ AbstractStream::buffering_status AbstractStream::getLastBufferStatus() const
return last_buffer_status;
}
vlc_tick_t AbstractStream::getDemuxedAmount() const
vlc_tick_t AbstractStream::getDemuxedAmount(vlc_tick_t from) const
{
return fakeEsOut()->commandsQueue()->getDemuxedAmount();
return fakeEsOut()->commandsQueue()->getDemuxedAmount(from);
}
AbstractStream::buffering_status AbstractStream::bufferize(vlc_tick_t nz_deadline,
......@@ -375,7 +375,7 @@ AbstractStream::buffering_status AbstractStream::doBufferize(vlc_tick_t nz_deadl
const vlc_tick_t i_total_buffering = i_min_buffering + i_extra_buffering;
vlc_tick_t i_demuxed = fakeEsOut()->commandsQueue()->getDemuxedAmount();
vlc_tick_t i_demuxed = fakeEsOut()->commandsQueue()->getDemuxedAmount(nz_deadline);
segmentTracker->notifyBufferingLevel(i_min_buffering, i_demuxed, i_total_buffering);
if(i_demuxed < i_total_buffering) /* not already demuxed */
{
......@@ -407,7 +407,7 @@ AbstractStream::buffering_status AbstractStream::doBufferize(vlc_tick_t nz_deadl
vlc_mutex_unlock(&lock);
return AbstractStream::buffering_end;
}
i_demuxed = fakeEsOut()->commandsQueue()->getDemuxedAmount();
i_demuxed = fakeEsOut()->commandsQueue()->getDemuxedAmount(nz_deadline);
segmentTracker->notifyBufferingLevel(i_min_buffering, i_demuxed, i_total_buffering);
}
vlc_mutex_unlock(&lock);
......
......@@ -84,7 +84,7 @@ namespace adaptive
} buffering_status;
buffering_status bufferize(vlc_tick_t, vlc_tick_t, vlc_tick_t, bool = false);
buffering_status getLastBufferStatus() const;
vlc_tick_t getDemuxedAmount() const;
vlc_tick_t getDemuxedAmount(vlc_tick_t) const;
status dequeue(vlc_tick_t, vlc_tick_t *);
bool decodersDrained();
virtual bool setPosition(vlc_tick_t, bool);
......
......@@ -452,9 +452,14 @@ bool CommandsQueue::isEOF() const
return b;
}
vlc_tick_t CommandsQueue::getDemuxedAmount() const
vlc_tick_t CommandsQueue::getDemuxedAmount(vlc_tick_t from) const
{
return bufferinglevel - getFirstDTS();
if( from > bufferinglevel || from < getFirstDTS() )
return 0;
if( from > getFirstDTS() )
return bufferinglevel - from;
else
return bufferinglevel - getFirstDTS();
}
vlc_tick_t CommandsQueue::getBufferingLevel() const
......
......@@ -164,7 +164,7 @@ namespace adaptive
void setEOF( bool );
bool isDraining() const;
bool isEOF() const;
vlc_tick_t getDemuxedAmount() const;
vlc_tick_t getDemuxedAmount(vlc_tick_t) const;
vlc_tick_t getBufferingLevel() const;
vlc_tick_t getFirstDTS() const;
vlc_tick_t getPCR() const;
......
Supports Markdown
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