[vlc-devel] [PATCH] adaptive: avoid a division by 0

Zhao Zhili quinkblack at foxmail.com
Fri Jan 12 13:11:00 CET 2018


It depends on the clock resolution.
---
 modules/demux/adaptive/http/Chunk.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/modules/demux/adaptive/http/Chunk.cpp b/modules/demux/adaptive/http/Chunk.cpp
index fc167f04b9..bf36002f05 100644
--- a/modules/demux/adaptive/http/Chunk.cpp
+++ b/modules/demux/adaptive/http/Chunk.cpp
@@ -197,7 +197,8 @@ block_t * HTTPChunkSource::read(size_t readsize)
         consumed += p_block->i_buffer;
         if((size_t)ret < readsize)
             eof = true;
-        connManager->updateDownloadRate(sourceid, p_block->i_buffer, time);
+        if(ret && time)
+            connManager->updateDownloadRate(sourceid, p_block->i_buffer, time);
     }
 
     return p_block;
-- 
2.16.0-rc1





More information about the vlc-devel mailing list