diff options
Diffstat (limited to 'engines/sword25/fmv/theora_decoder.cpp')
-rw-r--r-- | engines/sword25/fmv/theora_decoder.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/engines/sword25/fmv/theora_decoder.cpp b/engines/sword25/fmv/theora_decoder.cpp index be6d940d23..a7ebb5df8c 100644 --- a/engines/sword25/fmv/theora_decoder.cpp +++ b/engines/sword25/fmv/theora_decoder.cpp @@ -424,6 +424,12 @@ bool TheoraDecoder::queueAudio() { if (!_audStream) return false; + // An audio buffer should have been allocated (either in the constructor or after queuing the current buffer) + if (!_audiobuf) { + warning("[TheoraDecoder::queueAudio] Invalid audio buffer"); + return false; + } + bool queuedAudio = false; for (;;) { @@ -454,6 +460,11 @@ bool TheoraDecoder::queueAudio() { // The audio mixer is now responsible for the old audio buffer. // We need to create a new one. _audiobuf = (ogg_int16_t *)malloc(AUDIOFD_FRAGSIZE * sizeof(ogg_int16_t)); + if (!_audiobuf) { + warning("[TheoraDecoder::queueAudio] Cannot allocate memory for audio buffer"); + return false; + } + _audiobufFill = 0; queuedAudio = true; } @@ -479,12 +490,6 @@ void TheoraDecoder::reset() { if (_fileStream) _fileStream->seek(0); -#if ENABLE_THEORA_SEEKING - _videobufGranulePos = -1; - _audiobufGranulePos = 0; - _videobufTime = 0; -#endif - _audiobufFill = 0; _audiobufReady = false; |