Skip to content

Commit

Permalink
Handle the last MP3 sample being truncated without throwing.
Browse files Browse the repository at this point in the history
Issue: google#599
  • Loading branch information
ojw28 committed Jul 21, 2015
1 parent ed2b656 commit 3b34b06
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,12 @@ private int readSample(ExtractorInput extractorInput) throws IOException, Interr
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;
}
Expand Down

0 comments on commit 3b34b06

Please sign in to comment.