Commit 3b34b068 by Oliver Woodman

Handle the last MP3 sample being truncated without throwing.

Issue: #599
parent ed2b6565
......@@ -113,9 +113,12 @@ public final class Mp3Extractor implements Extractor {
sampleBytesRemaining -= inputBuffer.drainToOutput(trackOutput, sampleBytesRemaining);
if (sampleBytesRemaining > 0) {
inputBuffer.mark();
try {
sampleBytesRemaining -= trackOutput.sampleData(extractorInput, sampleBytesRemaining);
} catch (EOFException e) {
return RESULT_END_OF_INPUT;
}
// Return if we still need more data.
sampleBytesRemaining -= trackOutput.sampleData(extractorInput, sampleBytesRemaining);
if (sampleBytesRemaining > 0) {
return RESULT_CONTINUE;
}
......
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