Commit b5ca187e by olly Committed by Oliver Woodman

Mp3Extractor: Avoid outputting seek frame as a sample

This could previously occur when seeking back to position=0

PiperOrigin-RevId: 260933636
parent 58e70e83
...@@ -117,6 +117,7 @@ public final class Mp3Extractor implements Extractor { ...@@ -117,6 +117,7 @@ public final class Mp3Extractor implements Extractor {
private Seeker seeker; private Seeker seeker;
private long basisTimeUs; private long basisTimeUs;
private long samplesRead; private long samplesRead;
private int firstSamplePosition;
private int sampleBytesRemaining; private int sampleBytesRemaining;
public Mp3Extractor() { public Mp3Extractor() {
...@@ -214,6 +215,10 @@ public final class Mp3Extractor implements Extractor { ...@@ -214,6 +215,10 @@ public final class Mp3Extractor implements Extractor {
/* selectionFlags= */ 0, /* selectionFlags= */ 0,
/* language= */ null, /* language= */ null,
(flags & FLAG_DISABLE_ID3_METADATA) != 0 ? null : metadata)); (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); return readSample(input);
} }
......
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