[vlc-commits] demux: adaptive: fix buffered amount condition
Francois Cartegnie
git at videolan.org
Mon Sep 14 19:19:45 CEST 2020
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri Sep 11 16:25:44 2020 +0200| [15f5497b25797f3d190598a0f523ad6031cb7cd1] | committer: Francois Cartegnie
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)
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=15f5497b25797f3d190598a0f523ad6031cb7cd1
---
modules/demux/adaptive/PlaylistManager.cpp | 2 +-
modules/demux/adaptive/Streams.cpp | 8 ++++----
modules/demux/adaptive/Streams.hpp | 2 +-
modules/demux/adaptive/plumbing/CommandsQueue.cpp | 9 +++++++--
modules/demux/adaptive/plumbing/CommandsQueue.hpp | 2 +-
5 files changed, 14 insertions(+), 9 deletions(-)
diff --git a/modules/demux/adaptive/PlaylistManager.cpp b/modules/demux/adaptive/PlaylistManager.cpp
index 3a268b6351..0e7b62a141 100644
--- a/modules/demux/adaptive/PlaylistManager.cpp
+++ b/modules/demux/adaptive/PlaylistManager.cpp
@@ -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);
diff --git a/modules/demux/adaptive/Streams.cpp b/modules/demux/adaptive/Streams.cpp
index 77dceeaf06..d522946899 100644
--- a/modules/demux/adaptive/Streams.cpp
+++ b/modules/demux/adaptive/Streams.cpp
@@ -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);
diff --git a/modules/demux/adaptive/Streams.hpp b/modules/demux/adaptive/Streams.hpp
index 04c4596931..e89b4b7981 100644
--- a/modules/demux/adaptive/Streams.hpp
+++ b/modules/demux/adaptive/Streams.hpp
@@ -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);
diff --git a/modules/demux/adaptive/plumbing/CommandsQueue.cpp b/modules/demux/adaptive/plumbing/CommandsQueue.cpp
index a45ae13c5b..e0253b11a2 100644
--- a/modules/demux/adaptive/plumbing/CommandsQueue.cpp
+++ b/modules/demux/adaptive/plumbing/CommandsQueue.cpp
@@ -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
diff --git a/modules/demux/adaptive/plumbing/CommandsQueue.hpp b/modules/demux/adaptive/plumbing/CommandsQueue.hpp
index 14c06738d0..cc15fd4973 100644
--- a/modules/demux/adaptive/plumbing/CommandsQueue.hpp
+++ b/modules/demux/adaptive/plumbing/CommandsQueue.hpp
@@ -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;
More information about the vlc-commits
mailing list