Commit d12d9650 authored by Christopher Mueller's avatar Christopher Mueller Committed by Hugo Beauzée-Luyssen

dash: downloader avoid div by zero

Signed-off-by: default avatarHugo Beauzée-Luyssen <beauze.h@gmail.com>
parent 5a3cb153
...@@ -87,6 +87,10 @@ void* DASHDownloader::download (void *thread_sys) ...@@ -87,6 +87,10 @@ void* DASHDownloader::download (void *thread_sys)
{ {
block_t *bufBlock = block_Alloc(ret); block_t *bufBlock = block_Alloc(ret);
memcpy(bufBlock->p_buffer, block->p_buffer, 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)); bufBlock->i_length = (mtime_t)((ret * 8) / ((float)currentChunk->getBitrate() / 1000000));
buffer->put(bufBlock); buffer->put(bufBlock);
} }
......
...@@ -30,7 +30,8 @@ ...@@ -30,7 +30,8 @@
#include "exceptions/EOFException.h" #include "exceptions/EOFException.h"
#include "buffer/BlockBuffer.h" #include "buffer/BlockBuffer.h"
#define BLOCKSIZE 32768 #define BLOCKSIZE 32768
#define CHUNKDEFAULTBITRATE 1
#include <iostream> #include <iostream>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment