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 58e70e8351
commit b5ca187e85

View file

@ -117,6 +117,7 @@ public final class Mp3Extractor implements Extractor {
private Seeker seeker;
private long basisTimeUs;
private long samplesRead;
private int firstSamplePosition;
private int sampleBytesRemaining;
public Mp3Extractor() {
@ -214,6 +215,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);
}