diff options
author | Johannes Schickel | 2010-02-09 21:52:46 +0000 |
---|---|---|
committer | Johannes Schickel | 2010-02-09 21:52:46 +0000 |
commit | b097e8635cebca42953cb7e98edf1492641bf3e6 (patch) | |
tree | 3fab2ab5715837eebf8ea2b1a188eca1fece7f09 /sound/audiostream.cpp | |
parent | 6a624df560aae04b990a64dc6d8b34f960365787 (diff) | |
download | scummvm-rg350-b097e8635cebca42953cb7e98edf1492641bf3e6.tar.gz scummvm-rg350-b097e8635cebca42953cb7e98edf1492641bf3e6.tar.bz2 scummvm-rg350-b097e8635cebca42953cb7e98edf1492641bf3e6.zip |
Stop SubLoopingAudioStream playback, in case reading from the parent stream fails.
svn-id: r48021
Diffstat (limited to 'sound/audiostream.cpp')
-rw-r--r-- | sound/audiostream.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/sound/audiostream.cpp b/sound/audiostream.cpp index 16c3eaca1a..483be27757 100644 --- a/sound/audiostream.cpp +++ b/sound/audiostream.cpp @@ -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; } |