summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSandro Santilli <strk@keybit.net>2013-11-03 19:49:28 +0100
committerSandro Santilli <strk@keybit.net>2013-11-03 19:49:28 +0100
commit7a53cb38d4b3f8a8f6160a40e2912133663c1ab3 (patch)
treef50d20d9c8d90aa924fca2da68db029a1dd0a679
parent77966b2317f6f4914b5f10c49852ffe6c7881cab (diff)
downloadgnash-7a53cb38d4b3f8a8f6160a40e2912133663c1ab3.tar.gz
Decode embedded sound in chunks of 65535 bytes
Fixes latency in lessig-freeculture.swf: https://savannah.gnu.org/bugs/?25456 Confirms AudioDecoder is already allowed to do incremental decoding: https://savannah.gnu.org/bugs/index.php?24638
-rw-r--r--libsound/EmbedSoundInst.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/libsound/EmbedSoundInst.cpp b/libsound/EmbedSoundInst.cpp
index 4c7023cb6..cecfb52f4 100644
--- a/libsound/EmbedSoundInst.cpp
+++ b/libsound/EmbedSoundInst.cpp
@@ -91,7 +91,15 @@ EmbedSoundInst::decodeNextBlock()
{
assert(!decodingCompleted());
- const boost::uint32_t inputSize = _soundDef.size() - decodingPosition;
+ // this value is arbitrary, things would also work
+ // with a smaller value, but 2^16 seems fast enough
+ // to decode not to bother further streamlining it
+ // See https://savannah.gnu.org/bugs/?25456 for a testcase
+ // showing the benefit of chunked decoding.
+ const boost::uint32_t chunkSize = 65535;
+
+ boost::uint32_t inputSize = _soundDef.size() - decodingPosition;
+ if ( inputSize > chunkSize ) inputSize = chunkSize;
#ifdef GNASH_DEBUG_SOUNDS_DECODING
log_debug(" decoding %d bytes", inputSize);