AUDIO: Handle empty parent stream in LoopingAudioStream
This should fix bug #3571139.
This commit is contained in:
parent
ce0a334d30
commit
3a1de9a182
1 changed files with 8 additions and 0 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue