Stop SubLoopingAudioStream playback, in case reading from the parent stream fails.

svn-id: r48021
This commit is contained in:
Johannes Schickel 2010-02-09 21:52:46 +00:00
parent 6a624df560
commit b097e8635c

View File

@ -187,7 +187,11 @@ int SubLoopingAudioStream::readBuffer(int16 *buffer, const int numSamples) {
int framesRead = _parent->readBuffer(buffer, framesLeft);
_pos = _pos.addFrames(framesRead);
if (_pos == _loopEnd) {
if (framesRead < framesLeft) {
// TODO: Proper error indication.
_done = true;
return framesRead;
} else if (_pos == _loopEnd) {
if (_loops != 0) {
--_loops;
if (!_loops) {
@ -197,6 +201,7 @@ int SubLoopingAudioStream::readBuffer(int16 *buffer, const int numSamples) {
}
if (!_parent->seek(_loopStart)) {
// TODO: Proper error indication.
_done = true;
return framesRead;
}