[vlc-commits] adaptive: avoid a division by 0

Zhao Zhili git at videolan.org
Tue Jan 16 00:18:07 CET 2018


vlc/vlc-3.0 | branch: master | Zhao Zhili <quinkblack at foxmail.com> | Fri Jan 12 20:11:00 2018 +0800| [67972f975e09227ca943d0d8a0ffdd763d1e1717] | committer: Francois Cartegnie

adaptive: avoid a division by 0

It depends on the clock resolution.

Signed-off-by: Francois Cartegnie <fcvlcdev at free.fr>
(cherry picked from commit da1a70678732214c8bf61ec4dcd6b4b9705f6321)

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=67972f975e09227ca943d0d8a0ffdd763d1e1717
---

 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;



More information about the vlc-commits mailing list