aboutsummaryrefslogtreecommitdiff
path: root/audio/audiostream.cpp
diff options
context:
space:
mode:
authorWillem Jan Palenstijn2013-04-21 13:51:31 +0200
committerWillem Jan Palenstijn2013-04-21 13:52:40 +0200
commit3a1de9a1828dccac216cc9833de0b8c06a681d07 (patch)
treeed3587c4774e6f815b7c194a8a3912d063a32ae5 /audio/audiostream.cpp
parentce0a334d30b180e10cac01e126f2cda77d82d417 (diff)
downloadscummvm-rg350-3a1de9a1828dccac216cc9833de0b8c06a681d07.tar.gz
scummvm-rg350-3a1de9a1828dccac216cc9833de0b8c06a681d07.tar.bz2
scummvm-rg350-3a1de9a1828dccac216cc9833de0b8c06a681d07.zip
AUDIO: Handle empty parent stream in LoopingAudioStream
This should fix bug #3571139.
Diffstat (limited to 'audio/audiostream.cpp')
-rw-r--r--audio/audiostream.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/audio/audiostream.cpp b/audio/audiostream.cpp
index 2d65d4afef..8bd4b95c49 100644
--- a/audio/audiostream.cpp
+++ b/audio/audiostream.cpp
@@ -98,6 +98,10 @@ LoopingAudioStream::LoopingAudioStream(RewindableAudioStream *stream, uint loops
// TODO: Properly indicate error
_loops = _completeIterations = 1;
}
+ if (stream->endOfData()) {
+ // Apparently this is an empty stream
+ _loops = _completeIterations = 1;
+ }
}
int LoopingAudioStream::readBuffer(int16 *buffer, const int numSamples) {
@@ -118,6 +122,10 @@ int LoopingAudioStream::readBuffer(int16 *buffer, const int numSamples) {
_loops = _completeIterations = 1;
return samplesRead;
}
+ if (_parent->endOfData()) {
+ // Apparently this is an empty stream
+ _loops = _completeIterations = 1;
+ }
return samplesRead + readBuffer(buffer + samplesRead, remainingSamples);
}