[vlc-devel] demux: adaptive: fix a zero-divid bug.

Xie Zhigang zighouse at hotmail.com
Thu Nov 15 11:49:12 CET 2018


fixes crashs on some cases with zero update download rates.
---
 modules/demux/adaptive/logic/NearOptimalAdaptationLogic.cpp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/modules/demux/adaptive/logic/NearOptimalAdaptationLogic.cpp b/modules/demux/adaptive/logic/NearOptimalAdaptationLogic.cpp
index 1c99538..32bb863 100644
--- a/modules/demux/adaptive/logic/NearOptimalAdaptationLogic.cpp
+++ b/modules/demux/adaptive/logic/NearOptimalAdaptationLogic.cpp
@@ -179,6 +179,9 @@ unsigned NearOptimalAdaptationLogic::getMaxCurrentBw() const
 
 void NearOptimalAdaptationLogic::updateDownloadRate(const ID &id, size_t dlsize, vlc_tick_t time)
 {
+    if (time <= 0)
+        return;
+
     vlc_mutex_lock(&lock);
     std::map<ID, NearOptimalContext>::iterator it = streams.find(id);
     if(it != streams.end())
-- 
2.7.4


More information about the vlc-devel mailing list