Commit e29cb374 by olly Committed by Oliver Woodman

Fix WavExtractor bug.

When skipToData is called the peek position is not equal
to the read position of the input. Hence peeking a chunk
header and then skipping by that amount wont do the right
thing :)!
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=122157603
parent 9bfe62a5
...@@ -125,6 +125,9 @@ import java.io.IOException; ...@@ -125,6 +125,9 @@ import java.io.IOException;
Assertions.checkNotNull(input); Assertions.checkNotNull(input);
Assertions.checkNotNull(wavHeader); Assertions.checkNotNull(wavHeader);
// Make sure the peek position is set to the read position before we peek the first header.
input.resetPeekPosition();
ParsableByteArray scratch = new ParsableByteArray(ChunkHeader.SIZE_IN_BYTES); ParsableByteArray scratch = new ParsableByteArray(ChunkHeader.SIZE_IN_BYTES);
// Skip all chunks until we hit the data header. // Skip all chunks until we hit the data header.
ChunkHeader chunkHeader = ChunkHeader.peek(input, scratch); ChunkHeader chunkHeader = ChunkHeader.peek(input, scratch);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment