[vlc-devel] [PATCH 12/13] dash: downloader avoid div by zero
Christopher at mailsrv.uni-klu.ac.at
Christopher at mailsrv.uni-klu.ac.at
Sat Feb 11 12:00:03 CET 2012
From: Christopher Mueller <christopher.mueller at itec.aau.at>
---
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>
--
1.7.0.4
More information about the vlc-devel
mailing list