summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndré Nusser <andre.nusser@googlemail.com>2016-01-29 13:18:33 +0100
committerAndré Nusser <andre.nusser@googlemail.com>2016-01-29 13:18:33 +0100
commit1137dade95adc73c494e748f56b2dc0ffd978ac2 (patch)
treeedd550852a18eac94f7283be889a4704f8780e56
parent1b32041bb54e1c9310853c9942498ec223d8106a (diff)
wip 3
-rw-r--r--src/audiocache.cc11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/audiocache.cc b/src/audiocache.cc
index 2ca0616..7856f4a 100644
--- a/src/audiocache.cc
+++ b/src/audiocache.cc
@@ -28,7 +28,6 @@
#include <mutex>
-#include <string.h>
#include <stdio.h>
#include <assert.h>
@@ -105,7 +104,15 @@ sample_t* AudioCache::open(const AudioFile& file, size_t initial_samples_needed,
}
else
{
- // cropped_size is the preload chunk size cropped to sample length.
+ // Make sure that the preload-data made available to the next() calls
+ // fit on frame boundary:
+ //
+ // [ all preloaded data ]
+ // [ initial ][ biggest multiple of full frames ][ the rest ]
+ // \ /
+ // \----------------------v-------------------/
+ // cropped_size
+
cropped_size = file.preloadedsize - c.localpos;
cropped_size -= cropped_size % framesize;
cropped_size += initial_samples_needed;