Commit 39589fb6 authored by François Cartegnie's avatar François Cartegnie 🤞

demux: adaptative: don't compute bw stats from tiny chunks

parent ff3e1e6e
......@@ -230,8 +230,8 @@ HTTPChunkBufferedSource::~HTTPChunkBufferedSource()
void HTTPChunkBufferedSource::bufferize(size_t readsize)
{
if(readsize < 32768)
readsize = 32768;
if(readsize < HTTPChunkSource::CHUNK_SIZE)
readsize = HTTPChunkSource::CHUNK_SIZE;
if(contentLength && readsize > contentLength - consumed)
readsize = contentLength - consumed;
......
......@@ -84,6 +84,8 @@ namespace adaptative
virtual block_t * read(size_t); /* impl */
static const size_t CHUNK_SIZE = 32768;
protected:
virtual block_t * consume(size_t);
HTTPConnection *connection;
......
......@@ -30,6 +30,7 @@
#include "../playlist/BaseRepresentation.h"
#include "../playlist/BasePeriod.h"
#include "../http/Chunk.h"
using namespace adaptative::logic;
......@@ -62,12 +63,13 @@ BaseRepresentation *RateBasedAdaptationLogic::getNextRepresentation(BaseAdaptati
if ( rep == NULL )
return NULL;
}
return rep;
}
void RateBasedAdaptationLogic::updateDownloadRate(size_t size, mtime_t time)
{
if(unlikely(time == 0))
if(unlikely(time == 0) || size < (HTTPChunkSource::CHUNK_SIZE>>1) )
return;
size_t current = bpsRemainder + CLOCK_FREQ * size * 8 / time;
......
......@@ -20,6 +20,7 @@
#include "SourceStream.hpp"
#include "../ChunksSource.hpp"
#include "../http/Chunk.h"
#include <vlc_stream.h>
#include <vlc_demux.h>
......@@ -70,7 +71,7 @@ ssize_t ChunksSourceStream::Read(uint8_t *buf, size_t size)
while(i_toread && !b_eof)
{
const size_t i_blocksize = __MAX(i_toread, 32768);
const size_t i_blocksize = __MAX(i_toread, http::HTTPChunkSource::CHUNK_SIZE);
if(!p_block && !(p_block = source->readNextBlock(i_blocksize)))
{
b_eof = true;
......
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