mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +00:00
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:
parent
af8f67c068
commit
80ab74748d
1 changed files with 5 additions and 0 deletions
|
|
@ -116,6 +116,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() {
|
||||||
|
|
@ -213,6 +214,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);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue