Skip to content

Commit

Permalink
WAF/RF64 : Workaround for badly formatted data chunk size [#191]
Browse files Browse the repository at this point in the history
  • Loading branch information
Zeugma440 committed Apr 2, 2023
1 parent 6736a99 commit 2d75165
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion ATL/AudioData/IO/WAV.cs
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,9 @@ private bool readWAV(Stream source, ReadTagParams readTagParams)
else if (subChunkId.Equals(CHUNK_DATA, StringComparison.OrdinalIgnoreCase))
{
AudioDataOffset = chunkDataPos;
if (uint.MaxValue == chunkSize) chunkSize = AudioDataSize; // Already set by DS64
// Handle RF64 where size has already been set by DS64
// NB : Some files in the wild can have an erroneous size of 0x00FFFFFF
if (AudioDataSize > 0 && (uint.MaxValue == chunkSize || 0x00FFFFFF == chunkSize)) chunkSize = AudioDataSize;
else AudioDataSize = chunkSize;
headerSize = riffChunkSize - AudioDataSize;
formattedRiffChunkSize = getFormattedRiffChunkSize(riffChunkSize, isRf64);
Expand Down

0 comments on commit 2d75165

Please sign in to comment.