diff options
author | Leena Winterrowd <lenhardw@codeaurora.org> | 2014-11-04 21:27:34 -0800 |
---|---|---|
committer | Lajos Molnar <lajos@google.com> | 2015-01-28 21:52:09 -0800 |
commit | 9aff25fb41f516ac26f9d1983a25402909f1e77a (patch) | |
tree | b4148a4cf5c8e97959847a839a2f559272c506c1 /media/libstagefright/httplive | |
parent | 79971c747e62cad50359286f18dee0c4de5829da (diff) | |
download | frameworks_av-9aff25fb41f516ac26f9d1983a25402909f1e77a.zip frameworks_av-9aff25fb41f516ac26f9d1983a25402909f1e77a.tar.gz frameworks_av-9aff25fb41f516ac26f9d1983a25402909f1e77a.tar.bz2 |
stagefright: httplive: Reduce memcpy calls for chunked content
Streams using http chunking will not report the segment's total
content-length. In this case, a 64k buffer is allocated and is
increased by 32k each time the buffer is filled again. For high
bitrate content, this can lead to a large number of copies that
affect the HLS framework delay. Increase fetchFile buffer size
exponentially by 50% or at least 32k instead of by 32k each time
to reduce the number of memcpy calls.
Example for a chunked 6 MB 1080p segment (ie ~3s):
Adding 32k:
190 copies with 572.97 MB copied
Increasing by 50%:
12 copies with 16.09 MB copied
Bug: 18821145
Change-Id: Iedf0e4437e96026a58d50bce2660f85ac90d0ada
Diffstat (limited to 'media/libstagefright/httplive')
-rw-r--r-- | media/libstagefright/httplive/LiveSession.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/media/libstagefright/httplive/LiveSession.cpp b/media/libstagefright/httplive/LiveSession.cpp index cad4c2d..e163985 100644 --- a/media/libstagefright/httplive/LiveSession.cpp +++ b/media/libstagefright/httplive/LiveSession.cpp @@ -873,7 +873,11 @@ ssize_t LiveSession::fetchFile( // Only resize when we don't know the size. size_t bufferRemaining = buffer->capacity() - buffer->size(); if (bufferRemaining == 0 && getSizeErr != OK) { - bufferRemaining = 32768; + size_t bufferIncrement = buffer->size() / 2; + if (bufferIncrement < 32768) { + bufferIncrement = 32768; + } + bufferRemaining = bufferIncrement; ALOGV("increasing download buffer to %zu bytes", buffer->size() + bufferRemaining); |