Browse Source

Fix OGG audio loops

(cherry picked from commit 4f8d1c47b8d8c0429c4499ead764850324a77ed3)
Fabio Iotti 5 years ago
parent
commit
45248fb0ec
1 changed files with 2 additions and 1 deletions
  1. 2 1
      modules/stb_vorbis/audio_stream_ogg_vorbis.cpp

+ 2 - 1
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++;