[vlc-commits] demux: adaptive: fix buffered amount condition
Francois Cartegnie
git at videolan.org
Mon Dec 14 10:41:33 UTC 2020
vlc/vlc-3.0 | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri Sep 11 16:25:44 2020 +0200| [9e6746aa3fc2a64de7659af2c51985db5f68b7aa] | 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)
(cherry picked from commit 15f5497b25797f3d190598a0f523ad6031cb7cd1)
> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=9e6746aa3fc2a64de7659af2c51985db5f68b7aa
---
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 302987813d..5d80b358e0 100644
--- a/modules/demux/adaptive/PlaylistManager.cpp
+++ b/modules/demux/adaptive/PlaylistManager.cpp
@@ -231,7 +231,7 @@ AbstractStream::buffering_status PlaylistManager::bufferize(mtime_t i_nzdeadline
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 b75312e416..99bf531c22 100644
--- a/modules/demux/adaptive/Streams.cpp
+++ b/modules/demux/adaptive/Streams.cpp
@@ -298,9 +298,9 @@ AbstractStream::buffering_status AbstractStream::getLastBufferStatus() const
return last_buffer_status;
}
-mtime_t AbstractStream::getDemuxedAmount() const
+mtime_t AbstractStream::getDemuxedAmount(mtime_t from) const
{
- return fakeEsOut()->commandsQueue()->getDemuxedAmount();
+ return fakeEsOut()->commandsQueue()->getDemuxedAmount(from);
}
AbstractStream::buffering_status AbstractStream::bufferize(mtime_t nz_deadline,
@@ -373,7 +373,7 @@ AbstractStream::buffering_status AbstractStream::doBufferize(mtime_t nz_deadline
const int64_t i_total_buffering = i_min_buffering + i_extra_buffering;
- mtime_t i_demuxed = fakeEsOut()->commandsQueue()->getDemuxedAmount();
+ mtime_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 */
{
@@ -405,7 +405,7 @@ AbstractStream::buffering_status AbstractStream::doBufferize(mtime_t nz_deadline
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 a1f5631b7a..539b772d4a 100644
--- a/modules/demux/adaptive/Streams.hpp
+++ b/modules/demux/adaptive/Streams.hpp
@@ -84,7 +84,7 @@ namespace adaptive
} buffering_status;
buffering_status bufferize(mtime_t, unsigned, unsigned);
buffering_status getLastBufferStatus() const;
- mtime_t getDemuxedAmount() const;
+ mtime_t getDemuxedAmount(mtime_t) const;
status dequeue(mtime_t, mtime_t *);
bool decodersDrained();
virtual bool setPosition(mtime_t, bool);
diff --git a/modules/demux/adaptive/plumbing/CommandsQueue.cpp b/modules/demux/adaptive/plumbing/CommandsQueue.cpp
index 2d31733588..7cc9feaeae 100644
--- a/modules/demux/adaptive/plumbing/CommandsQueue.cpp
+++ b/modules/demux/adaptive/plumbing/CommandsQueue.cpp
@@ -432,9 +432,14 @@ bool CommandsQueue::isEOF() const
return b;
}
-mtime_t CommandsQueue::getDemuxedAmount() const
+mtime_t CommandsQueue::getDemuxedAmount(mtime_t from) const
{
- return bufferinglevel - getFirstDTS();
+ if( from > bufferinglevel || from < getFirstDTS() )
+ return 0;
+ if( from > getFirstDTS() )
+ return bufferinglevel - from;
+ else
+ return bufferinglevel - getFirstDTS();
}
mtime_t CommandsQueue::getBufferingLevel() const
diff --git a/modules/demux/adaptive/plumbing/CommandsQueue.hpp b/modules/demux/adaptive/plumbing/CommandsQueue.hpp
index b36dd5c332..6ee9a6ab36 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;
- mtime_t getDemuxedAmount() const;
+ mtime_t getDemuxedAmount(mtime_t) const;
mtime_t getBufferingLevel() const;
mtime_t getFirstDTS() const;
mtime_t getPCR() const;
More information about the vlc-commits
mailing list