Currently it takes a significant amount of time to create a reader for a CAF file. I am dealing with very large files and the issue is inside of CoreAudioFormatMetatdata::read. The following code:
else if (chunkHeader.chunkType == chunkName ("data"))
{
// -1 signifies an unknown data size so the data has to be at the
// end of the file so we must have finished the header
if (chunkHeader.chunkSize == -1)
break;
input.skipNextBytes (chunkHeader.chunkSize);
}
The issue is skipping to the end of the file since, at least in my case, “data” is the last chunk type. Can something like this be added:
else if (chunkHeader.chunkType == chunkName ("data"))
{
// -1 signifies an unknown data size so the data has to be at the
// end of the file so we must have finished the header
if (chunkHeader.chunkSize == -1)
break;
int64 length = input.getTotalLength();
if(length != -1){
if(chunkHeader.chunkSize + input.getPosition() == length){
break;
}
}
input.skipNextBytes (chunkHeader.chunkSize);
}
'''