[vlc-commits] dash: downloader avoid div by zero

Christopher Mueller git at videolan.org
Tue Feb 14 17:30:23 CET 2012


vlc | branch: master | Christopher Mueller <christopher.mueller at itec.aau.at> | Sat Feb 11 12:00:03 2012 +0100| [d12d9650dff051da8299665583883c29e117dfd2] | committer: Hugo Beauzée-Luyssen

dash: downloader avoid div by zero

Signed-off-by: Hugo Beauzée-Luyssen <beauze.h at gmail.com>

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

 modules/stream_filter/dash/DASHDownloader.cpp |    4 ++++
 modules/stream_filter/dash/DASHDownloader.h   |    3 ++-
 2 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/modules/stream_filter/dash/DASHDownloader.cpp b/modules/stream_filter/dash/DASHDownloader.cpp
index df49c98..1a0b21e 100644
--- a/modules/stream_filter/dash/DASHDownloader.cpp
+++ b/modules/stream_filter/dash/DASHDownloader.cpp
@@ -87,6 +87,10 @@ void*       DASHDownloader::download    (void *thread_sys)
             {
                 block_t *bufBlock = block_Alloc(ret);
                 memcpy(bufBlock->p_buffer, block->p_buffer, ret);
+
+                if(currentChunk->getBitrate() <= 0)
+                    currentChunk->setBitrate(CHUNKDEFAULTBITRATE);
+
                 bufBlock->i_length = (mtime_t)((ret * 8) / ((float)currentChunk->getBitrate() / 1000000));
                 buffer->put(bufBlock);
             }
diff --git a/modules/stream_filter/dash/DASHDownloader.h b/modules/stream_filter/dash/DASHDownloader.h
index 11ab6d3..4ab84f1 100644
--- a/modules/stream_filter/dash/DASHDownloader.h
+++ b/modules/stream_filter/dash/DASHDownloader.h
@@ -30,7 +30,8 @@
 #include "exceptions/EOFException.h"
 #include "buffer/BlockBuffer.h"
 
-#define BLOCKSIZE 32768
+#define BLOCKSIZE           32768
+#define CHUNKDEFAULTBITRATE 1
 
 #include <iostream>
 



More information about the vlc-commits mailing list