Reading this ogg file causes juce’s ogg code to get stuck in an infinite loop.
Sample Code to trigger the issue:
AudioFormatManager mgr; mgr.registerBasicFormats(); auto afReader = std::unique_ptr<AudioFormatReader>(mgr.createReaderFor(oggFile)); const int channels = int(afReader->numChannels); const int lengthInSamples = int(afReader->lengthInSamples); AudioSampleBuffer buffer(channels, lengthInSamples); // this line leads to the infinite loop afReader->read(&buffer, 0, lengthInSamples, 0, true, true);
The loop that ends up going round and round is
static ogg_int64_t _get_prev_page(OggVorbis_File *vf,ogg_page *og)
end are both 0, so the
while(vf->offset<end) loop never runs.
The example file is the shortest out of a number we’ve found that have the issue.
They are obviously not well formed Oggs but this is part of a service where the user chooses the file to analyse, which then hangs.
Any ideas on how to detect the issue before starting the read would be appreciated too!
EDIT: to be clear these oggs all play fine in other DAWs / media players etc…