Skip to content

Commit

Permalink
FLAC/OGG: Fix a bug in buffered reads
Browse files Browse the repository at this point in the history
  • Loading branch information
tpoole committed Jul 14, 2022
1 parent cb2efe5 commit 156d8c7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion modules/juce_audio_formats/codecs/juce_FlacAudioFormat.cpp
Expand Up @@ -274,7 +274,8 @@ class FlacReader : public AudioFormatReader
if (! remainingSamples.isEmpty())
for (int i = numDestChannels; --i >= 0;)
if (destSamples[i] != nullptr)
zeromem (destSamples[i] + startOffsetInDestBuffer, (size_t) remainingSamples.getLength() * sizeof (int));
zeromem (destSamples[i] + startOffsetInDestBuffer + (remainingSamples.getStart() - startSampleInFile),
(size_t) remainingSamples.getLength() * sizeof (int));

return true;
}
Expand Down
Expand Up @@ -216,7 +216,8 @@ class OggReader : public AudioFormatReader
if (! remainingSamples.isEmpty())
for (int i = numDestChannels; --i >= 0;)
if (destSamples[i] != nullptr)
zeromem (destSamples[i] + startOffsetInDestBuffer, (size_t) remainingSamples.getLength() * sizeof (int));
zeromem (destSamples[i] + startOffsetInDestBuffer + (remainingSamples.getStart() - startSampleInFile),
(size_t) remainingSamples.getLength() * sizeof (int));

return true;
}
Expand Down

0 comments on commit 156d8c7

Please sign in to comment.