[vlc-commits] demux: adaptive: fix possible bogus huge buffer level

Francois Cartegnie git at videolan.org
Mon Apr 19 14:15:41 UTC 2021


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Apr 15 17:54:01 2021 +0200| [0d457f141f59752640df7f7e2483523607620f83] | committer: Francois Cartegnie

demux: adaptive: fix possible bogus huge buffer level

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=0d457f141f59752640df7f7e2483523607620f83
---

 modules/demux/adaptive/plumbing/CommandsQueue.cpp | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/modules/demux/adaptive/plumbing/CommandsQueue.cpp b/modules/demux/adaptive/plumbing/CommandsQueue.cpp
index 17720454a8..28f61108c1 100644
--- a/modules/demux/adaptive/plumbing/CommandsQueue.cpp
+++ b/modules/demux/adaptive/plumbing/CommandsQueue.cpp
@@ -461,12 +461,15 @@ bool CommandsQueue::isEOF() const
 
 vlc_tick_t CommandsQueue::getDemuxedAmount(vlc_tick_t from) const
 {
-    if( bufferinglevel == VLC_TICK_INVALID || from > bufferinglevel )
+    vlc_tick_t bufferingstart = getFirstDTS();
+    if( bufferinglevel == VLC_TICK_INVALID ||
+        bufferingstart == VLC_TICK_INVALID ||
+        from > bufferinglevel )
         return 0;
-    if( from > getFirstDTS() )
+    if( from > bufferingstart )
         return bufferinglevel - from;
     else
-        return bufferinglevel - getFirstDTS();
+        return bufferinglevel - bufferingstart;
 }
 
 vlc_tick_t CommandsQueue::getBufferingLevel() const



More information about the vlc-commits mailing list