summaryrefslogtreecommitdiff
path: root/src/lib/audio_decoder.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2014-09-10 00:51:31 +0100
committerCarl Hetherington <cth@carlh.net>2014-09-10 00:51:31 +0100
commit33e0b0ee0d70db7b8866a6a72d7691d1a29f3e00 (patch)
tree73ac0fdd80ded2469dde7d3866ad5df270e107b7 /src/lib/audio_decoder.cc
parent17020ca5fdf7e60ce1053792830b69aea283bedf (diff)
Don't automatically call pass() without first checking to see if we have
what we need; otherwise we can keep calling pass() unnecessarily which causes a build-up of data which is eventually trimmed to save memory.
Diffstat (limited to 'src/lib/audio_decoder.cc')
-rw-r--r--src/lib/audio_decoder.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lib/audio_decoder.cc b/src/lib/audio_decoder.cc
index f425cf280..12580c5f6 100644
--- a/src/lib/audio_decoder.cc
+++ b/src/lib/audio_decoder.cc
@@ -79,10 +79,10 @@ AudioDecoder::get_audio (AudioFrame frame, AudioFrame length, bool accurate)
*/
if (accurate) {
/* Keep stuffing data into _decoded_audio until we have enough data, or the subclass does not want to give us any more */
- while (!pass() && (_decoded_audio.frame > frame || (_decoded_audio.frame + _decoded_audio.audio->frames()) < end)) {}
+ while (_decoded_audio.frame > frame || (_decoded_audio.frame + _decoded_audio.audio->frames()) < end && !pass ()) {}
decoded_offset = frame - _decoded_audio.frame;
} else {
- while (!pass() && _decoded_audio.audio->frames() < length) {}
+ while (_decoded_audio.audio->frames() < length && !pass ()) {}
/* Use decoded_offset of 0, as we don't really care what frames we return */
}