Mp3Extractor: Avoid outputting seek frame as a sample

This could previously occur when seeking back to position=0

PiperOrigin-RevId: 260933636
This commit is contained in:
olly 2019-07-31 16:44:19 +01:00 committed by Oliver Woodman
parent af8f67c068
commit 80ab74748d

View file

@ -116,6 +116,7 @@ public final class Mp3Extractor implements Extractor {
private Seeker seeker;
private long basisTimeUs;
private long samplesRead;
private int firstSamplePosition;
private int sampleBytesRemaining;
public Mp3Extractor() {
@ -213,6 +214,10 @@ public final class Mp3Extractor implements Extractor {
/* selectionFlags= */ 0,
/* language= */ null,
(flags & FLAG_DISABLE_ID3_METADATA) != 0 ? null : metadata));
firstSamplePosition = (int) input.getPosition();
} else if (input.getPosition() == 0 && firstSamplePosition != 0) {
// Skip past the seek frame.
input.skipFully(firstSamplePosition);
}
return readSample(input);
}