aboutsummaryrefslogtreecommitdiff
path: root/audio
diff options
context:
space:
mode:
Diffstat (limited to 'audio')
-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);
}