[vlc-commits] demux: adaptative: don't compute bw stats from tiny chunks
Francois Cartegnie
git at videolan.org
Wed Nov 18 11:51:21 CET 2015
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue Nov 10 16:20:43 2015 +0100| [39589fb69f0d715eb2df2fccedc55062204916b0] | committer: Francois Cartegnie
demux: adaptative: don't compute bw stats from tiny chunks
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=39589fb69f0d715eb2df2fccedc55062204916b0
---
modules/demux/adaptative/http/Chunk.cpp | 4 ++--
modules/demux/adaptative/http/Chunk.h | 2 ++
modules/demux/adaptative/logic/RateBasedAdaptationLogic.cpp | 4 +++-
modules/demux/adaptative/plumbing/SourceStream.cpp | 3 ++-
4 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/modules/demux/adaptative/http/Chunk.cpp b/modules/demux/adaptative/http/Chunk.cpp
index d882002..cd34374 100644
--- a/modules/demux/adaptative/http/Chunk.cpp
+++ b/modules/demux/adaptative/http/Chunk.cpp
@@ -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;
diff --git a/modules/demux/adaptative/http/Chunk.h b/modules/demux/adaptative/http/Chunk.h
index aa5fb46..dd45573 100644
--- a/modules/demux/adaptative/http/Chunk.h
+++ b/modules/demux/adaptative/http/Chunk.h
@@ -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;
diff --git a/modules/demux/adaptative/logic/RateBasedAdaptationLogic.cpp b/modules/demux/adaptative/logic/RateBasedAdaptationLogic.cpp
index 0f71559..8f0856e 100644
--- a/modules/demux/adaptative/logic/RateBasedAdaptationLogic.cpp
+++ b/modules/demux/adaptative/logic/RateBasedAdaptationLogic.cpp
@@ -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;
diff --git a/modules/demux/adaptative/plumbing/SourceStream.cpp b/modules/demux/adaptative/plumbing/SourceStream.cpp
index ff6f565..ab51a95 100644
--- a/modules/demux/adaptative/plumbing/SourceStream.cpp
+++ b/modules/demux/adaptative/plumbing/SourceStream.cpp
@@ -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;
More information about the vlc-commits
mailing list