From 4f8d1c47b8d8c0429c4499ead764850324a77ed3 Mon Sep 17 00:00:00 2001 From: Fabio Iotti Date: Mon, 2 Mar 2020 21:36:01 +0000 Subject: [PATCH] Fix OGG audio loops --- modules/stb_vorbis/audio_stream_ogg_vorbis.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp b/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp index 054ed088df4..42f341cef7e 100644 --- a/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp +++ b/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp @@ -57,7 +57,8 @@ void AudioStreamPlaybackOGGVorbis::_mix_internal(AudioFrame *p_buffer, int p_fra if (todo) { //end of file! - if (vorbis_stream->loop && mixed > 0) { + bool is_not_empty = mixed > 0 || stb_vorbis_stream_length_in_samples(ogg_stream) > 0; + if (vorbis_stream->loop && is_not_empty) { //loop seek(vorbis_stream->loop_offset); loops++;