From 09b7ad2f83dc366b8eead866e6999ccc3f66b2ab Mon Sep 17 00:00:00 2001 From: tolriq Date: Wed, 6 May 2026 19:17:55 +0200 Subject: [PATCH] Use gapless MP3 Xing/Info durations in seek maps Xing/Info frame counts describe the raw MP3 frame timeline, but SeekMap#getDurationUs should expose the gapless playback duration when encoder delay and padding are present. Keep both values in MP3 seekers: use the raw duration for bitrate and byte-position calculations, and use the gapless duration for the public duration and end-of-stream seek points. This makes getPosition(durationUs) return a seek point whose timeUs is the requested public duration. Issue: androidx/media#3183 Test: ./gradlew :lib-extractor:testDebugUnitTest --tests androidx.media3.extractor.mp3.ConstantBitrateSeekerTest --tests androidx.media3.extractor.mp3.Mp3ExtractorTest --tests androidx.media3.extractor.mp3.XingFrameTest --- RELEASENOTES.md | 3 + .../extractor/mp3/ConstantBitrateSeeker.java | 58 ++++++- .../media3/extractor/mp3/Mp3Extractor.java | 22 ++- .../androidx/media3/extractor/mp3/Seeker.java | 8 + .../media3/extractor/mp3/XingFrame.java | 33 +++- .../media3/extractor/mp3/XingSeeker.java | 14 +- .../mp3/ConstantBitrateSeekerTest.java | 19 ++ .../extractor/mp3/Mp3ExtractorTest.java | 13 ++ .../media3/extractor/mp3/XingFrameTest.java | 112 ++++++++++++ .../bear-vbr-xing-header-no-toc.mp3.0.dump | 4 +- ...eader-no-toc.mp3.cbr-seeking-always.0.dump | 8 +- ...eader-no-toc.mp3.cbr-seeking-always.1.dump | 8 +- ...eader-no-toc.mp3.cbr-seeking-always.2.dump | 8 +- ...eader-no-toc.mp3.cbr-seeking-always.3.dump | 8 +- ...mp3.cbr-seeking-always.unknown_length.dump | 8 +- ...-xing-header-no-toc.mp3.cbr-seeking.0.dump | 8 +- ...-xing-header-no-toc.mp3.cbr-seeking.1.dump | 8 +- ...-xing-header-no-toc.mp3.cbr-seeking.2.dump | 8 +- ...-xing-header-no-toc.mp3.cbr-seeking.3.dump | 8 +- ...no-toc.mp3.cbr-seeking.unknown_length.dump | 8 +- ...xing-header-no-toc.mp3.unknown_length.dump | 4 +- ...xing-header-replaygain-accurate.mp3.0.dump | 8 +- ...xing-header-replaygain-accurate.mp3.1.dump | 8 +- ...xing-header-replaygain-accurate.mp3.2.dump | 8 +- ...xing-header-replaygain-accurate.mp3.3.dump | 8 +- ...eplaygain-accurate.mp3.unknown_length.dump | 8 +- ...vbr-xing-header-replaygain-fast.mp3.0.dump | 8 +- ...vbr-xing-header-replaygain-fast.mp3.1.dump | 8 +- ...vbr-xing-header-replaygain-fast.mp3.2.dump | 8 +- ...vbr-xing-header-replaygain-fast.mp3.3.dump | 8 +- ...er-replaygain-fast.mp3.unknown_length.dump | 8 +- .../mp3/bear-vbr-xing-header.mp3.0.dump | 8 +- .../mp3/bear-vbr-xing-header.mp3.1.dump | 162 +++++++++--------- .../mp3/bear-vbr-xing-header.mp3.2.dump | 84 ++++----- .../mp3/bear-vbr-xing-header.mp3.3.dump | 8 +- ...ar-vbr-xing-header.mp3.unknown_length.dump | 8 +- ...test-cbr-info-header-pcut-frame.mp3.0.dump | 8 +- ...test-cbr-info-header-pcut-frame.mp3.1.dump | 8 +- ...test-cbr-info-header-pcut-frame.mp3.2.dump | 66 +++---- ...test-cbr-info-header-pcut-frame.mp3.3.dump | 8 +- ...-header-pcut-frame.mp3.unknown_length.dump | 8 +- .../mp3/test-cbr-info-header.mp3.0.dump | 8 +- .../mp3/test-cbr-info-header.mp3.1.dump | 118 +++++++------ .../mp3/test-cbr-info-header.mp3.2.dump | 66 +++---- .../mp3/test-cbr-info-header.mp3.3.dump | 8 +- ...st-cbr-info-header.mp3.unknown_length.dump | 8 +- 46 files changed, 639 insertions(+), 387 deletions(-) create mode 100644 libraries/extractor/src/test/java/androidx/media3/extractor/mp3/XingFrameTest.java diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 07aa42a15a7..b68cee56283 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -77,6 +77,9 @@ ([#3088](https://github.com/androidx/media/issues/3088)). * MP3: Ignore Xing data length if it's longer than the known stream length ([#3117](https://github.com/androidx/media/issues/3117)). + * MP3: Use gapless-aware durations from Xing/Info headers while keeping + raw durations for bitrate calculations + ([#3183](https://github.com/androidx/media/issues/3183)). * Ignore `av1C` data with unsupported version. * MP4: Add support for big-endian floating point PCM in `fpcm` boxes. * Matroska: Parse chapter info to `Chapter` entries in a track's diff --git a/libraries/extractor/src/main/java/androidx/media3/extractor/mp3/ConstantBitrateSeeker.java b/libraries/extractor/src/main/java/androidx/media3/extractor/mp3/ConstantBitrateSeeker.java index 75c4dc9b7c3..c305d1dcfcd 100644 --- a/libraries/extractor/src/main/java/androidx/media3/extractor/mp3/ConstantBitrateSeeker.java +++ b/libraries/extractor/src/main/java/androidx/media3/extractor/mp3/ConstantBitrateSeeker.java @@ -18,6 +18,8 @@ import androidx.media3.common.C; import androidx.media3.extractor.ConstantBitrateSeekMap; import androidx.media3.extractor.MpegAudioUtil; +import androidx.media3.extractor.SeekMap.SeekPoints; +import androidx.media3.extractor.SeekPoint; /** * MP3 seeker that doesn't rely on metadata and seeks assuming the source has a constant bitrate. @@ -28,6 +30,7 @@ private final int bitrate; private final int frameSize; private final boolean allowSeeksIfLengthUnknown; + private final long durationUs; private final long dataEndPosition; /** @@ -53,7 +56,7 @@ public ConstantBitrateSeeker( mpegAudioHeader.bitrate, mpegAudioHeader.frameSize, allowSeeksIfLengthUnknown, - /* isEstimated= */ true); + /* durationUs= */ C.TIME_UNSET); } /** See {@link ConstantBitrateSeekMap#ConstantBitrateSeekMap(long, long, int, int, boolean)}. */ @@ -69,7 +72,29 @@ public ConstantBitrateSeeker( bitrate, frameSize, allowSeeksIfLengthUnknown, - /* isEstimated= */ true); + /* durationUs= */ C.TIME_UNSET); + } + + /** + * See {@link ConstantBitrateSeekMap#ConstantBitrateSeekMap(long, long, int, int, boolean)}. Uses + * {@code durationUs} as the duration exposed from {@link #getDurationUs()}, while keeping the + * duration derived from {@code inputLength} and {@code bitrate} for raw seek calculations. + */ + public ConstantBitrateSeeker( + long inputLength, + long firstFramePosition, + int bitrate, + int frameSize, + boolean allowSeeksIfLengthUnknown, + long durationUs) { + this( + inputLength, + firstFramePosition, + bitrate, + frameSize, + allowSeeksIfLengthUnknown, + /* isEstimated= */ true, + durationUs); } private ConstantBitrateSeeker( @@ -78,7 +103,8 @@ private ConstantBitrateSeeker( int bitrate, int frameSize, boolean allowSeeksIfLengthUnknown, - boolean isEstimated) { + boolean isEstimated, + long durationUs) { super( inputLength, firstFramePosition, @@ -90,6 +116,7 @@ private ConstantBitrateSeeker( this.bitrate = bitrate; this.frameSize = frameSize; this.allowSeeksIfLengthUnknown = allowSeeksIfLengthUnknown; + this.durationUs = durationUs; dataEndPosition = inputLength != C.LENGTH_UNSET ? inputLength : C.INDEX_UNSET; } @@ -98,6 +125,18 @@ public long getTimeUs(long position) { return getTimeUsAtPosition(position); } + @Override + public SeekPoints getSeekPoints(long timeUs) { + long rawDurationUs = getRawDurationUs(); + if (durationUs != C.TIME_UNSET && rawDurationUs != C.TIME_UNSET && timeUs >= durationUs) { + // Use the raw duration only to find the final byte position. Keep the returned seek point on + // the exposed gapless timeline. + SeekPoints rawDurationSeekPoints = super.getSeekPoints(rawDurationUs); + return new SeekPoints(new SeekPoint(durationUs, rawDurationSeekPoints.first.position)); + } + return super.getSeekPoints(timeUs); + } + @Override public long getDataStartPosition() { return firstFramePosition; @@ -108,6 +147,16 @@ public long getDataEndPosition() { return dataEndPosition; } + @Override + public long getDurationUs() { + return durationUs != C.TIME_UNSET ? durationUs : super.getDurationUs(); + } + + @Override + public long getRawDurationUs() { + return super.getDurationUs(); + } + @Override public int getAverageBitrate() { return bitrate; @@ -120,6 +169,7 @@ public ConstantBitrateSeeker copyWithNewDataEndPosition(long dataEndPosition) { bitrate, frameSize, allowSeeksIfLengthUnknown, - /* isEstimated= */ false); + /* isEstimated= */ false, + durationUs); } } diff --git a/libraries/extractor/src/main/java/androidx/media3/extractor/mp3/Mp3Extractor.java b/libraries/extractor/src/main/java/androidx/media3/extractor/mp3/Mp3Extractor.java index 57424dc9c97..776c2827e68 100644 --- a/libraries/extractor/src/main/java/androidx/media3/extractor/mp3/Mp3Extractor.java +++ b/libraries/extractor/src/main/java/androidx/media3/extractor/mp3/Mp3Extractor.java @@ -513,7 +513,7 @@ private Seeker computeSeeker(ExtractorInput input) throws IOException { } if (shouldFallbackToConstantBitrateSeeking(resultSeeker) - && resultSeeker.getDurationUs() != C.TIME_UNSET + && resultSeeker.getRawDurationUs() != C.TIME_UNSET && (resultSeeker.getDataEndPosition() != C.INDEX_UNSET || input.getLength() != C.LENGTH_UNSET)) { // resultSeeker does not allow seeking, but does provide a duration and constant bitrate @@ -532,7 +532,7 @@ private Seeker computeSeeker(ExtractorInput input) throws IOException { Util.scaleLargeValue( audioLength, Byte.SIZE * C.MICROS_PER_SECOND, - resultSeeker.getDurationUs(), + resultSeeker.getRawDurationUs(), RoundingMode.HALF_UP)); // inputLength will never be LENGTH_UNSET because of the outer if-condition, so we can pass // (vacuously) false here for allowSeeksIfLengthUnknown. @@ -542,7 +542,8 @@ private Seeker computeSeeker(ExtractorInput input) throws IOException { dataStart, bitrate, C.LENGTH_UNSET, - /* allowSeeksIfLengthUnknown= */ false); + /* allowSeeksIfLengthUnknown= */ false, + resultSeeker.getDurationUs()); } else if (shouldFallbackToConstantBitrateSeeking(resultSeeker)) { // Either we found no seek or VBR info, so we must assume the file is CBR (even without the // flag(s) being set), or an 'enable CBR seeking flag' is set and we found some seek info, but @@ -642,8 +643,9 @@ private Seeker getConstantBitrateSeeker(ExtractorInput input, boolean allowSeeks @Nullable private Seeker getConstantBitrateSeeker( long infoFramePosition, XingFrame infoFrame, long fallbackStreamLength) { - long durationUs = infoFrame.computeDurationUs(); - if (durationUs == C.TIME_UNSET) { + long rawDurationUs = infoFrame.computeRawDurationUs(); + long durationUs = infoFrame.computeGaplessDurationUs(); + if (rawDurationUs == C.TIME_UNSET || durationUs == C.TIME_UNSET) { return null; } long streamLength; @@ -663,14 +665,15 @@ private Seeker getConstantBitrateSeeker( // Derive the bitrate and frame size by averaging over the length of playable audio, to allow // for 'mostly' CBR streams that might have a small number of frames with a different bitrate. - // We can assume infoFrame.frameCount is set, because otherwise computeDurationUs() would - // have returned C.TIME_UNSET above. See also https://github.com/androidx/media/issues/1376. + // We can assume infoFrame.frameCount is set, because otherwise computeRawDurationUs() would + // have returned C.TIME_UNSET above. Use the raw duration so encoder delay/padding does not + // inflate the derived bitrate. See also https://github.com/androidx/media/issues/1376. int averageBitrate = Ints.checkedCast( Util.scaleLargeValue( audioLength, C.BITS_PER_BYTE * C.MICROS_PER_SECOND, - durationUs, + rawDurationUs, RoundingMode.HALF_UP)); int frameSize = Ints.checkedCast(LongMath.divide(audioLength, infoFrame.frameCount, RoundingMode.HALF_UP)); @@ -682,7 +685,8 @@ private Seeker getConstantBitrateSeeker( /* firstFramePosition= */ infoFramePosition + infoFrame.header.frameSize, averageBitrate, frameSize, - /* allowSeeksIfLengthUnknown= */ false); + /* allowSeeksIfLengthUnknown= */ false, + durationUs); } /** diff --git a/libraries/extractor/src/main/java/androidx/media3/extractor/mp3/Seeker.java b/libraries/extractor/src/main/java/androidx/media3/extractor/mp3/Seeker.java index 4f2d50e366d..08bf87e35a7 100644 --- a/libraries/extractor/src/main/java/androidx/media3/extractor/mp3/Seeker.java +++ b/libraries/extractor/src/main/java/androidx/media3/extractor/mp3/Seeker.java @@ -51,6 +51,14 @@ */ int getAverageBitrate(); + /** + * Returns the raw duration before subtracting encoder delay/padding, or {@link C#TIME_UNSET} if + * not known. + */ + default long getRawDurationUs() { + return getDurationUs(); + } + /** A {@link Seeker} that does not support seeking through audio data. */ /* package */ class UnseekableSeeker extends SeekMap.Unseekable implements Seeker { diff --git a/libraries/extractor/src/main/java/androidx/media3/extractor/mp3/XingFrame.java b/libraries/extractor/src/main/java/androidx/media3/extractor/mp3/XingFrame.java index b62e0f074e2..9a8f61d9eca 100644 --- a/libraries/extractor/src/main/java/androidx/media3/extractor/mp3/XingFrame.java +++ b/libraries/extractor/src/main/java/androidx/media3/extractor/mp3/XingFrame.java @@ -140,19 +140,40 @@ public static XingFrame parse(MpegAudioUtil.Header mpegAudioHeader, ParsableByte } /** - * Compute the stream duration, in microseconds, represented by this frame. Returns {@link - * C#LENGTH_UNSET} if the frame doesn't contain enough information to compute a duration. + * Compute the raw stream duration, in microseconds, represented by this frame. Returns {@link + * C#TIME_UNSET} if the frame doesn't contain enough information to compute a duration. */ - // TODO: b/319235116 - Handle encoder delay and padding when calculating duration. - public long computeDurationUs() { + public long computeRawDurationUs() { if (frameCount == C.LENGTH_UNSET || frameCount == 0) { // If the frame count is missing/invalid, the header can't be used to determine the duration. return C.TIME_UNSET; } + return computeDurationUs(/* sampleCount= */ frameCount * header.samplesPerFrame); + } + + /** + * Compute the gapless playback duration, in microseconds, represented by this frame. Returns + * {@link C#TIME_UNSET} if the frame doesn't contain enough information to compute a duration. + */ + public long computeGaplessDurationUs() { + if (frameCount == C.LENGTH_UNSET || frameCount == 0) { + // If the frame count is missing/invalid, the header can't be used to determine the duration. + return C.TIME_UNSET; + } + long sampleCount = frameCount * header.samplesPerFrame; + if (encoderDelay != C.LENGTH_UNSET && encoderPadding != C.LENGTH_UNSET) { + sampleCount -= encoderDelay + encoderPadding; + } + if (sampleCount <= 0) { + return C.TIME_UNSET; + } + return computeDurationUs(sampleCount); + } + + private long computeDurationUs(long sampleCount) { // Audio requires both a start and end PCM sample, so subtract one from the sample count before // calculating the duration. - return Util.sampleCountToDurationUs( - (frameCount * header.samplesPerFrame) - 1, header.sampleRate); + return Util.sampleCountToDurationUs(sampleCount - 1, header.sampleRate); } /** Provide the metadata derived from this Xing frame, such as ReplayGain data. */ diff --git a/libraries/extractor/src/main/java/androidx/media3/extractor/mp3/XingSeeker.java b/libraries/extractor/src/main/java/androidx/media3/extractor/mp3/XingSeeker.java index 3fe97490def..d7a0fa07d65 100644 --- a/libraries/extractor/src/main/java/androidx/media3/extractor/mp3/XingSeeker.java +++ b/libraries/extractor/src/main/java/androidx/media3/extractor/mp3/XingSeeker.java @@ -41,8 +41,9 @@ */ @Nullable public static XingSeeker create(XingFrame xingFrame, long position, long streamLength) { - long durationUs = xingFrame.computeDurationUs(); - if (durationUs == C.TIME_UNSET) { + long rawDurationUs = xingFrame.computeRawDurationUs(); + long durationUs = xingFrame.computeGaplessDurationUs(); + if (rawDurationUs == C.TIME_UNSET || durationUs == C.TIME_UNSET) { return null; } long dataSize; @@ -65,6 +66,7 @@ public static XingSeeker create(XingFrame xingFrame, long position, long streamL position, xingFrame.header.frameSize, durationUs, + rawDurationUs, xingFrame.header.bitrate, dataSize, xingFrame.tableOfContents); @@ -73,6 +75,7 @@ public static XingSeeker create(XingFrame xingFrame, long position, long streamL private final long dataStartPosition; private final int xingFrameSize; private final long durationUs; + private final long rawDurationUs; private final int bitrate; /** Data size, including the XING frame. */ @@ -90,12 +93,14 @@ private XingSeeker( long dataStartPosition, int xingFrameSize, long durationUs, + long rawDurationUs, int bitrate, long dataSize, @Nullable long[] tableOfContents) { this.dataStartPosition = dataStartPosition; this.xingFrameSize = xingFrameSize; this.durationUs = durationUs; + this.rawDurationUs = rawDurationUs; this.bitrate = bitrate; this.dataSize = dataSize; this.tableOfContents = tableOfContents; @@ -161,6 +166,11 @@ public long getDurationUs() { return durationUs; } + @Override + public long getRawDurationUs() { + return rawDurationUs; + } + @Override public long getDataStartPosition() { return dataStartPosition + xingFrameSize; diff --git a/libraries/extractor/src/test/java/androidx/media3/extractor/mp3/ConstantBitrateSeekerTest.java b/libraries/extractor/src/test/java/androidx/media3/extractor/mp3/ConstantBitrateSeekerTest.java index 0fab9364819..cf6ed8c73a0 100644 --- a/libraries/extractor/src/test/java/androidx/media3/extractor/mp3/ConstantBitrateSeekerTest.java +++ b/libraries/extractor/src/test/java/androidx/media3/extractor/mp3/ConstantBitrateSeekerTest.java @@ -22,6 +22,7 @@ import androidx.media3.common.util.Util; import androidx.media3.datasource.DefaultDataSource; import androidx.media3.extractor.SeekMap; +import androidx.media3.extractor.SeekPoint; import androidx.media3.test.utils.FakeExtractorOutput; import androidx.media3.test.utils.FakeTrackOutput; import androidx.media3.test.utils.TestUtil; @@ -66,6 +67,24 @@ public void mp3ExtractorReads_returnSeekableCbrSeeker() throws IOException { assertThat(seekMap.isSeekable()).isTrue(); } + @Test + public void getDurationUs_withExplicitDuration_keepsRawDurationForSeekCalculations() { + ConstantBitrateSeeker seeker = + new ConstantBitrateSeeker( + /* inputLength= */ 1_125, + /* firstFramePosition= */ 125, + /* bitrate= */ 8_000, + /* frameSize= */ 1, + /* allowSeeksIfLengthUnknown= */ false, + /* durationUs= */ 900_000); + + assertThat(seeker.getDurationUs()).isEqualTo(900_000); + assertThat(seeker.getRawDurationUs()).isEqualTo(1_000_000); + assertThat(seeker.getTimeUs(1_025)).isEqualTo(900_000); + assertThat(seeker.getSeekPoints(800_000).first.position).isEqualTo(925); + assertThat(seeker.getSeekPoints(900_000).first).isEqualTo(new SeekPoint(900_000, 1_124)); + } + @Test public void seeking_handlesSeekToZero() throws IOException { String fileName = CONSTANT_FRAME_SIZE_TEST_FILE; diff --git a/libraries/extractor/src/test/java/androidx/media3/extractor/mp3/Mp3ExtractorTest.java b/libraries/extractor/src/test/java/androidx/media3/extractor/mp3/Mp3ExtractorTest.java index cf720fdc048..f47e2703892 100644 --- a/libraries/extractor/src/test/java/androidx/media3/extractor/mp3/Mp3ExtractorTest.java +++ b/libraries/extractor/src/test/java/androidx/media3/extractor/mp3/Mp3ExtractorTest.java @@ -105,6 +105,19 @@ public void mp3SampleWithInfoHeader( simulationConfig); } + @Test + public void mp3SampleWithInfoHeader_usesGaplessDurationAndRawBitrate() throws Exception { + FakeExtractorOutput output = + TestUtil.extractAllSamplesFromFile( + new Mp3Extractor(), + ApplicationProvider.getApplicationContext(), + "media/mp3/test-cbr-info-header.mp3"); + + assertThat(output.seekMap.getDurationUs()).isEqualTo(999_977); + assertThat(output.trackOutputs.get(0).getDurationUs()).isEqualTo(999_977); + assertThat(output.trackOutputs.get(0).lastFormat.averageBitrate).isEqualTo(64_000); + } + // https://github.com/androidx/media/issues/1376#issuecomment-2117393653 @Test public void mp3SampleWithInfoHeaderAndPcutFrame( diff --git a/libraries/extractor/src/test/java/androidx/media3/extractor/mp3/XingFrameTest.java b/libraries/extractor/src/test/java/androidx/media3/extractor/mp3/XingFrameTest.java new file mode 100644 index 00000000000..c0ca6be0df3 --- /dev/null +++ b/libraries/extractor/src/test/java/androidx/media3/extractor/mp3/XingFrameTest.java @@ -0,0 +1,112 @@ +/* + * Copyright 2026 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package androidx.media3.extractor.mp3; + +import static com.google.common.truth.Truth.assertThat; + +import androidx.media3.common.C; +import androidx.media3.common.util.ParsableByteArray; +import androidx.media3.common.util.Util; +import androidx.media3.extractor.MpegAudioUtil; +import androidx.test.ext.junit.runners.AndroidJUnit4; +import java.nio.ByteBuffer; +import org.junit.Test; +import org.junit.runner.RunWith; + +/** Tests for {@link XingFrame}. */ +@RunWith(AndroidJUnit4.class) +public final class XingFrameTest { + + private static final int INFO_FRAME_HEADER_DATA = 0xFFFB40C0; + + @Test + public void computeRawDurationUs_withEncoderDelayAndPadding_doesNotSubtractGaplessSamples() { + XingFrame frame = + createXingFrame( + INFO_FRAME_HEADER_DATA, + /* frameCount= */ 40, + /* dataSize= */ 8_541, + /* encoderDelay= */ 576, + /* encoderPadding= */ 1_404); + + long rawSampleCount = frame.frameCount * frame.header.samplesPerFrame; + + assertThat(frame.computeRawDurationUs()) + .isEqualTo(Util.sampleCountToDurationUs(rawSampleCount - 1, frame.header.sampleRate)); + } + + @Test + public void computeGaplessDurationUs_withEncoderDelayAndPadding_subtractsGaplessSamples() { + XingFrame frame = + createXingFrame( + INFO_FRAME_HEADER_DATA, + /* frameCount= */ 40, + /* dataSize= */ 8_541, + /* encoderDelay= */ 576, + /* encoderPadding= */ 1_404); + + long gaplessSampleCount = + frame.frameCount * frame.header.samplesPerFrame + - frame.encoderDelay + - frame.encoderPadding; + + assertThat(frame.computeGaplessDurationUs()) + .isEqualTo(Util.sampleCountToDurationUs(gaplessSampleCount - 1, frame.header.sampleRate)); + } + + @Test + public void computeGaplessDurationUs_withoutEncoderDelayAndPadding_returnsRawDuration() { + XingFrame frame = + createXingFrame( + INFO_FRAME_HEADER_DATA, + /* payload= */ Util.getBytesFromHexString("00000003000000280000215d")); + + assertThat(frame.computeGaplessDurationUs()).isEqualTo(frame.computeRawDurationUs()); + } + + @Test + public void computeGaplessDurationUs_withInvalidGaplessSampleCount_returnsTimeUnset() { + XingFrame frame = + createXingFrame( + INFO_FRAME_HEADER_DATA, + /* frameCount= */ 1, + /* dataSize= */ 8_541, + /* encoderDelay= */ 576, + /* encoderPadding= */ 576); + + assertThat(frame.computeGaplessDurationUs()).isEqualTo(C.TIME_UNSET); + } + + private static XingFrame createXingFrame( + int headerData, int frameCount, int dataSize, int encoderDelay, int encoderPadding) { + int encoderDelayAndPadding = (encoderDelay << 12) | encoderPadding; + ByteBuffer payload = ByteBuffer.allocate(4 + 4 + 4 + 11 + 8 + 2 + 3); + payload.putInt(0x03); + payload.putInt(frameCount); + payload.putInt(dataSize); + payload.position(payload.position() + 11 + 8 + 2); + payload.put((byte) (encoderDelayAndPadding >> 16)); + payload.put((byte) (encoderDelayAndPadding >> 8)); + payload.put((byte) encoderDelayAndPadding); + return createXingFrame(headerData, payload.array()); + } + + private static XingFrame createXingFrame(int headerData, byte[] payload) { + MpegAudioUtil.Header xingFrameHeader = new MpegAudioUtil.Header(); + xingFrameHeader.setForHeaderData(headerData); + return XingFrame.parse(xingFrameHeader, new ParsableByteArray(payload)); + } +} diff --git a/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header-no-toc.mp3.0.dump b/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header-no-toc.mp3.0.dump index 5cfd3266218..78a4aac7aae 100644 --- a/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header-no-toc.mp3.0.dump +++ b/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header-no-toc.mp3.0.dump @@ -1,12 +1,12 @@ seekMap: isSeekable = false - duration = 2807979 + duration = 2783979 getPosition(0) = [[timeUs=0, position=237]] numberOfTracks = 1 track 0: total output bytes = 38160 sample count = 117 - track duration = 2807979 + track duration = 2783979 format 0: averageBitrate = 64000 containerMimeType = audio/mpeg diff --git a/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header-no-toc.mp3.cbr-seeking-always.0.dump b/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header-no-toc.mp3.cbr-seeking-always.0.dump index deb9adcbd9d..493f4f1fdef 100644 --- a/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header-no-toc.mp3.cbr-seeking-always.0.dump +++ b/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header-no-toc.mp3.cbr-seeking-always.0.dump @@ -1,15 +1,15 @@ seekMap: isSeekable = true - duration = 2807972 + duration = 2783979 getPosition(0) = [[timeUs=0, position=237]] getPosition(1) = [[timeUs=0, position=237], [timeUs=73, position=238]] - getPosition(1403986) = [[timeUs=1403912, position=19316], [timeUs=1403986, position=19317]] - getPosition(2807972) = [[timeUs=2807899, position=38396]] + getPosition(1391989) = [[timeUs=1391918, position=19153], [timeUs=1391992, position=19154]] + getPosition(2783979) = [[timeUs=2783979, position=38396]] numberOfTracks = 1 track 0: total output bytes = 38160 sample count = 117 - track duration = 2807972 + track duration = 2783979 format 0: averageBitrate = 108719 containerMimeType = audio/mpeg diff --git a/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header-no-toc.mp3.cbr-seeking-always.1.dump b/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header-no-toc.mp3.cbr-seeking-always.1.dump index 8cebd97c777..b026a785cd0 100644 --- a/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header-no-toc.mp3.cbr-seeking-always.1.dump +++ b/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header-no-toc.mp3.cbr-seeking-always.1.dump @@ -1,15 +1,15 @@ seekMap: isSeekable = true - duration = 2807972 + duration = 2783979 getPosition(0) = [[timeUs=0, position=237]] getPosition(1) = [[timeUs=0, position=237], [timeUs=73, position=238]] - getPosition(1403986) = [[timeUs=1403912, position=19316], [timeUs=1403986, position=19317]] - getPosition(2807972) = [[timeUs=2807899, position=38396]] + getPosition(1391989) = [[timeUs=1391918, position=19153], [timeUs=1391992, position=19154]] + getPosition(2783979) = [[timeUs=2783979, position=38396]] numberOfTracks = 1 track 0: total output bytes = 25344 sample count = 80 - track duration = 2807972 + track duration = 2783979 format 0: averageBitrate = 108719 containerMimeType = audio/mpeg diff --git a/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header-no-toc.mp3.cbr-seeking-always.2.dump b/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header-no-toc.mp3.cbr-seeking-always.2.dump index ee5e5a6f7d0..da7cc102d93 100644 --- a/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header-no-toc.mp3.cbr-seeking-always.2.dump +++ b/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header-no-toc.mp3.cbr-seeking-always.2.dump @@ -1,15 +1,15 @@ seekMap: isSeekable = true - duration = 2807972 + duration = 2783979 getPosition(0) = [[timeUs=0, position=237]] getPosition(1) = [[timeUs=0, position=237], [timeUs=73, position=238]] - getPosition(1403986) = [[timeUs=1403912, position=19316], [timeUs=1403986, position=19317]] - getPosition(2807972) = [[timeUs=2807899, position=38396]] + getPosition(1391989) = [[timeUs=1391918, position=19153], [timeUs=1391992, position=19154]] + getPosition(2783979) = [[timeUs=2783979, position=38396]] numberOfTracks = 1 track 0: total output bytes = 12624 sample count = 42 - track duration = 2807972 + track duration = 2783979 format 0: averageBitrate = 108719 containerMimeType = audio/mpeg diff --git a/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header-no-toc.mp3.cbr-seeking-always.3.dump b/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header-no-toc.mp3.cbr-seeking-always.3.dump index daec3f68336..95e9725fa5f 100644 --- a/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header-no-toc.mp3.cbr-seeking-always.3.dump +++ b/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header-no-toc.mp3.cbr-seeking-always.3.dump @@ -1,15 +1,15 @@ seekMap: isSeekable = true - duration = 2807972 + duration = 2783979 getPosition(0) = [[timeUs=0, position=237]] getPosition(1) = [[timeUs=0, position=237], [timeUs=73, position=238]] - getPosition(1403986) = [[timeUs=1403912, position=19316], [timeUs=1403986, position=19317]] - getPosition(2807972) = [[timeUs=2807899, position=38396]] + getPosition(1391989) = [[timeUs=1391918, position=19153], [timeUs=1391992, position=19154]] + getPosition(2783979) = [[timeUs=2783979, position=38396]] numberOfTracks = 1 track 0: total output bytes = 0 sample count = 0 - track duration = 2807972 + track duration = 2783979 format 0: averageBitrate = 108719 containerMimeType = audio/mpeg diff --git a/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header-no-toc.mp3.cbr-seeking-always.unknown_length.dump b/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header-no-toc.mp3.cbr-seeking-always.unknown_length.dump index deb9adcbd9d..493f4f1fdef 100644 --- a/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header-no-toc.mp3.cbr-seeking-always.unknown_length.dump +++ b/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header-no-toc.mp3.cbr-seeking-always.unknown_length.dump @@ -1,15 +1,15 @@ seekMap: isSeekable = true - duration = 2807972 + duration = 2783979 getPosition(0) = [[timeUs=0, position=237]] getPosition(1) = [[timeUs=0, position=237], [timeUs=73, position=238]] - getPosition(1403986) = [[timeUs=1403912, position=19316], [timeUs=1403986, position=19317]] - getPosition(2807972) = [[timeUs=2807899, position=38396]] + getPosition(1391989) = [[timeUs=1391918, position=19153], [timeUs=1391992, position=19154]] + getPosition(2783979) = [[timeUs=2783979, position=38396]] numberOfTracks = 1 track 0: total output bytes = 38160 sample count = 117 - track duration = 2807972 + track duration = 2783979 format 0: averageBitrate = 108719 containerMimeType = audio/mpeg diff --git a/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header-no-toc.mp3.cbr-seeking.0.dump b/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header-no-toc.mp3.cbr-seeking.0.dump index deb9adcbd9d..493f4f1fdef 100644 --- a/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header-no-toc.mp3.cbr-seeking.0.dump +++ b/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header-no-toc.mp3.cbr-seeking.0.dump @@ -1,15 +1,15 @@ seekMap: isSeekable = true - duration = 2807972 + duration = 2783979 getPosition(0) = [[timeUs=0, position=237]] getPosition(1) = [[timeUs=0, position=237], [timeUs=73, position=238]] - getPosition(1403986) = [[timeUs=1403912, position=19316], [timeUs=1403986, position=19317]] - getPosition(2807972) = [[timeUs=2807899, position=38396]] + getPosition(1391989) = [[timeUs=1391918, position=19153], [timeUs=1391992, position=19154]] + getPosition(2783979) = [[timeUs=2783979, position=38396]] numberOfTracks = 1 track 0: total output bytes = 38160 sample count = 117 - track duration = 2807972 + track duration = 2783979 format 0: averageBitrate = 108719 containerMimeType = audio/mpeg diff --git a/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header-no-toc.mp3.cbr-seeking.1.dump b/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header-no-toc.mp3.cbr-seeking.1.dump index 8cebd97c777..b026a785cd0 100644 --- a/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header-no-toc.mp3.cbr-seeking.1.dump +++ b/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header-no-toc.mp3.cbr-seeking.1.dump @@ -1,15 +1,15 @@ seekMap: isSeekable = true - duration = 2807972 + duration = 2783979 getPosition(0) = [[timeUs=0, position=237]] getPosition(1) = [[timeUs=0, position=237], [timeUs=73, position=238]] - getPosition(1403986) = [[timeUs=1403912, position=19316], [timeUs=1403986, position=19317]] - getPosition(2807972) = [[timeUs=2807899, position=38396]] + getPosition(1391989) = [[timeUs=1391918, position=19153], [timeUs=1391992, position=19154]] + getPosition(2783979) = [[timeUs=2783979, position=38396]] numberOfTracks = 1 track 0: total output bytes = 25344 sample count = 80 - track duration = 2807972 + track duration = 2783979 format 0: averageBitrate = 108719 containerMimeType = audio/mpeg diff --git a/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header-no-toc.mp3.cbr-seeking.2.dump b/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header-no-toc.mp3.cbr-seeking.2.dump index ee5e5a6f7d0..da7cc102d93 100644 --- a/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header-no-toc.mp3.cbr-seeking.2.dump +++ b/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header-no-toc.mp3.cbr-seeking.2.dump @@ -1,15 +1,15 @@ seekMap: isSeekable = true - duration = 2807972 + duration = 2783979 getPosition(0) = [[timeUs=0, position=237]] getPosition(1) = [[timeUs=0, position=237], [timeUs=73, position=238]] - getPosition(1403986) = [[timeUs=1403912, position=19316], [timeUs=1403986, position=19317]] - getPosition(2807972) = [[timeUs=2807899, position=38396]] + getPosition(1391989) = [[timeUs=1391918, position=19153], [timeUs=1391992, position=19154]] + getPosition(2783979) = [[timeUs=2783979, position=38396]] numberOfTracks = 1 track 0: total output bytes = 12624 sample count = 42 - track duration = 2807972 + track duration = 2783979 format 0: averageBitrate = 108719 containerMimeType = audio/mpeg diff --git a/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header-no-toc.mp3.cbr-seeking.3.dump b/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header-no-toc.mp3.cbr-seeking.3.dump index daec3f68336..95e9725fa5f 100644 --- a/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header-no-toc.mp3.cbr-seeking.3.dump +++ b/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header-no-toc.mp3.cbr-seeking.3.dump @@ -1,15 +1,15 @@ seekMap: isSeekable = true - duration = 2807972 + duration = 2783979 getPosition(0) = [[timeUs=0, position=237]] getPosition(1) = [[timeUs=0, position=237], [timeUs=73, position=238]] - getPosition(1403986) = [[timeUs=1403912, position=19316], [timeUs=1403986, position=19317]] - getPosition(2807972) = [[timeUs=2807899, position=38396]] + getPosition(1391989) = [[timeUs=1391918, position=19153], [timeUs=1391992, position=19154]] + getPosition(2783979) = [[timeUs=2783979, position=38396]] numberOfTracks = 1 track 0: total output bytes = 0 sample count = 0 - track duration = 2807972 + track duration = 2783979 format 0: averageBitrate = 108719 containerMimeType = audio/mpeg diff --git a/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header-no-toc.mp3.cbr-seeking.unknown_length.dump b/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header-no-toc.mp3.cbr-seeking.unknown_length.dump index deb9adcbd9d..493f4f1fdef 100644 --- a/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header-no-toc.mp3.cbr-seeking.unknown_length.dump +++ b/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header-no-toc.mp3.cbr-seeking.unknown_length.dump @@ -1,15 +1,15 @@ seekMap: isSeekable = true - duration = 2807972 + duration = 2783979 getPosition(0) = [[timeUs=0, position=237]] getPosition(1) = [[timeUs=0, position=237], [timeUs=73, position=238]] - getPosition(1403986) = [[timeUs=1403912, position=19316], [timeUs=1403986, position=19317]] - getPosition(2807972) = [[timeUs=2807899, position=38396]] + getPosition(1391989) = [[timeUs=1391918, position=19153], [timeUs=1391992, position=19154]] + getPosition(2783979) = [[timeUs=2783979, position=38396]] numberOfTracks = 1 track 0: total output bytes = 38160 sample count = 117 - track duration = 2807972 + track duration = 2783979 format 0: averageBitrate = 108719 containerMimeType = audio/mpeg diff --git a/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header-no-toc.mp3.unknown_length.dump b/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header-no-toc.mp3.unknown_length.dump index 5cfd3266218..78a4aac7aae 100644 --- a/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header-no-toc.mp3.unknown_length.dump +++ b/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header-no-toc.mp3.unknown_length.dump @@ -1,12 +1,12 @@ seekMap: isSeekable = false - duration = 2807979 + duration = 2783979 getPosition(0) = [[timeUs=0, position=237]] numberOfTracks = 1 track 0: total output bytes = 38160 sample count = 117 - track duration = 2807979 + track duration = 2783979 format 0: averageBitrate = 64000 containerMimeType = audio/mpeg diff --git a/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header-replaygain-accurate.mp3.0.dump b/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header-replaygain-accurate.mp3.0.dump index 3f4a5e2991a..7cb1b08319f 100644 --- a/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header-replaygain-accurate.mp3.0.dump +++ b/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header-replaygain-accurate.mp3.0.dump @@ -1,15 +1,15 @@ seekMap: isSeekable = true - duration = 2807978 + duration = 2783979 getPosition(0) = [[timeUs=0, position=429]] getPosition(1) = [[timeUs=0, position=429], [timeUs=23999, position=813]] - getPosition(1403989) = [[timeUs=1391989, position=22701], [timeUs=1415988, position=23085]] - getPosition(2807978) = [[timeUs=2783978, position=44973]] + getPosition(1391989) = [[timeUs=1367989, position=22317], [timeUs=1391989, position=22701]] + getPosition(2783979) = [[timeUs=2783979, position=44973]] numberOfTracks = 1 track 0: total output bytes = 44928 sample count = 117 - track duration = 2807978 + track duration = 2783979 format 0: averageBitrate = 128001 containerMimeType = audio/mpeg diff --git a/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header-replaygain-accurate.mp3.1.dump b/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header-replaygain-accurate.mp3.1.dump index d4564f9757e..daa72f5e267 100644 --- a/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header-replaygain-accurate.mp3.1.dump +++ b/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header-replaygain-accurate.mp3.1.dump @@ -1,15 +1,15 @@ seekMap: isSeekable = true - duration = 2807978 + duration = 2783979 getPosition(0) = [[timeUs=0, position=429]] getPosition(1) = [[timeUs=0, position=429], [timeUs=23999, position=813]] - getPosition(1403989) = [[timeUs=1391989, position=22701], [timeUs=1415988, position=23085]] - getPosition(2807978) = [[timeUs=2783978, position=44973]] + getPosition(1391989) = [[timeUs=1367989, position=22317], [timeUs=1391989, position=22701]] + getPosition(2783979) = [[timeUs=2783979, position=44973]] numberOfTracks = 1 track 0: total output bytes = 30336 sample count = 79 - track duration = 2807978 + track duration = 2783979 format 0: averageBitrate = 128001 containerMimeType = audio/mpeg diff --git a/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header-replaygain-accurate.mp3.2.dump b/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header-replaygain-accurate.mp3.2.dump index 40372d30314..4761bf1e40f 100644 --- a/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header-replaygain-accurate.mp3.2.dump +++ b/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header-replaygain-accurate.mp3.2.dump @@ -1,15 +1,15 @@ seekMap: isSeekable = true - duration = 2807978 + duration = 2783979 getPosition(0) = [[timeUs=0, position=429]] getPosition(1) = [[timeUs=0, position=429], [timeUs=23999, position=813]] - getPosition(1403989) = [[timeUs=1391989, position=22701], [timeUs=1415988, position=23085]] - getPosition(2807978) = [[timeUs=2783978, position=44973]] + getPosition(1391989) = [[timeUs=1367989, position=22317], [timeUs=1391989, position=22701]] + getPosition(2783979) = [[timeUs=2783979, position=44973]] numberOfTracks = 1 track 0: total output bytes = 15360 sample count = 40 - track duration = 2807978 + track duration = 2783979 format 0: averageBitrate = 128001 containerMimeType = audio/mpeg diff --git a/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header-replaygain-accurate.mp3.3.dump b/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header-replaygain-accurate.mp3.3.dump index 2d705c22f7b..76565384f07 100644 --- a/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header-replaygain-accurate.mp3.3.dump +++ b/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header-replaygain-accurate.mp3.3.dump @@ -1,15 +1,15 @@ seekMap: isSeekable = true - duration = 2807978 + duration = 2783979 getPosition(0) = [[timeUs=0, position=429]] getPosition(1) = [[timeUs=0, position=429], [timeUs=23999, position=813]] - getPosition(1403989) = [[timeUs=1391989, position=22701], [timeUs=1415988, position=23085]] - getPosition(2807978) = [[timeUs=2783978, position=44973]] + getPosition(1391989) = [[timeUs=1367989, position=22317], [timeUs=1391989, position=22701]] + getPosition(2783979) = [[timeUs=2783979, position=44973]] numberOfTracks = 1 track 0: total output bytes = 384 sample count = 1 - track duration = 2807978 + track duration = 2783979 format 0: averageBitrate = 128001 containerMimeType = audio/mpeg diff --git a/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header-replaygain-accurate.mp3.unknown_length.dump b/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header-replaygain-accurate.mp3.unknown_length.dump index 3f4a5e2991a..7cb1b08319f 100644 --- a/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header-replaygain-accurate.mp3.unknown_length.dump +++ b/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header-replaygain-accurate.mp3.unknown_length.dump @@ -1,15 +1,15 @@ seekMap: isSeekable = true - duration = 2807978 + duration = 2783979 getPosition(0) = [[timeUs=0, position=429]] getPosition(1) = [[timeUs=0, position=429], [timeUs=23999, position=813]] - getPosition(1403989) = [[timeUs=1391989, position=22701], [timeUs=1415988, position=23085]] - getPosition(2807978) = [[timeUs=2783978, position=44973]] + getPosition(1391989) = [[timeUs=1367989, position=22317], [timeUs=1391989, position=22701]] + getPosition(2783979) = [[timeUs=2783979, position=44973]] numberOfTracks = 1 track 0: total output bytes = 44928 sample count = 117 - track duration = 2807978 + track duration = 2783979 format 0: averageBitrate = 128001 containerMimeType = audio/mpeg diff --git a/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header-replaygain-fast.mp3.0.dump b/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header-replaygain-fast.mp3.0.dump index 457facc2495..d9f70ec343c 100644 --- a/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header-replaygain-fast.mp3.0.dump +++ b/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header-replaygain-fast.mp3.0.dump @@ -1,15 +1,15 @@ seekMap: isSeekable = true - duration = 2807978 + duration = 2783979 getPosition(0) = [[timeUs=0, position=429]] getPosition(1) = [[timeUs=0, position=429], [timeUs=23999, position=813]] - getPosition(1403989) = [[timeUs=1391989, position=22701], [timeUs=1415988, position=23085]] - getPosition(2807978) = [[timeUs=2783978, position=44973]] + getPosition(1391989) = [[timeUs=1367989, position=22317], [timeUs=1391989, position=22701]] + getPosition(2783979) = [[timeUs=2783979, position=44973]] numberOfTracks = 1 track 0: total output bytes = 44928 sample count = 117 - track duration = 2807978 + track duration = 2783979 format 0: averageBitrate = 128001 containerMimeType = audio/mpeg diff --git a/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header-replaygain-fast.mp3.1.dump b/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header-replaygain-fast.mp3.1.dump index 2ae4be63a28..d3f1aca6c1d 100644 --- a/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header-replaygain-fast.mp3.1.dump +++ b/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header-replaygain-fast.mp3.1.dump @@ -1,15 +1,15 @@ seekMap: isSeekable = true - duration = 2807978 + duration = 2783979 getPosition(0) = [[timeUs=0, position=429]] getPosition(1) = [[timeUs=0, position=429], [timeUs=23999, position=813]] - getPosition(1403989) = [[timeUs=1391989, position=22701], [timeUs=1415988, position=23085]] - getPosition(2807978) = [[timeUs=2783978, position=44973]] + getPosition(1391989) = [[timeUs=1367989, position=22317], [timeUs=1391989, position=22701]] + getPosition(2783979) = [[timeUs=2783979, position=44973]] numberOfTracks = 1 track 0: total output bytes = 30336 sample count = 79 - track duration = 2807978 + track duration = 2783979 format 0: averageBitrate = 128001 containerMimeType = audio/mpeg diff --git a/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header-replaygain-fast.mp3.2.dump b/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header-replaygain-fast.mp3.2.dump index 176b1e30fc9..99ed0ef2699 100644 --- a/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header-replaygain-fast.mp3.2.dump +++ b/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header-replaygain-fast.mp3.2.dump @@ -1,15 +1,15 @@ seekMap: isSeekable = true - duration = 2807978 + duration = 2783979 getPosition(0) = [[timeUs=0, position=429]] getPosition(1) = [[timeUs=0, position=429], [timeUs=23999, position=813]] - getPosition(1403989) = [[timeUs=1391989, position=22701], [timeUs=1415988, position=23085]] - getPosition(2807978) = [[timeUs=2783978, position=44973]] + getPosition(1391989) = [[timeUs=1367989, position=22317], [timeUs=1391989, position=22701]] + getPosition(2783979) = [[timeUs=2783979, position=44973]] numberOfTracks = 1 track 0: total output bytes = 15360 sample count = 40 - track duration = 2807978 + track duration = 2783979 format 0: averageBitrate = 128001 containerMimeType = audio/mpeg diff --git a/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header-replaygain-fast.mp3.3.dump b/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header-replaygain-fast.mp3.3.dump index 649cd2e6565..b69d8d393e9 100644 --- a/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header-replaygain-fast.mp3.3.dump +++ b/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header-replaygain-fast.mp3.3.dump @@ -1,15 +1,15 @@ seekMap: isSeekable = true - duration = 2807978 + duration = 2783979 getPosition(0) = [[timeUs=0, position=429]] getPosition(1) = [[timeUs=0, position=429], [timeUs=23999, position=813]] - getPosition(1403989) = [[timeUs=1391989, position=22701], [timeUs=1415988, position=23085]] - getPosition(2807978) = [[timeUs=2783978, position=44973]] + getPosition(1391989) = [[timeUs=1367989, position=22317], [timeUs=1391989, position=22701]] + getPosition(2783979) = [[timeUs=2783979, position=44973]] numberOfTracks = 1 track 0: total output bytes = 384 sample count = 1 - track duration = 2807978 + track duration = 2783979 format 0: averageBitrate = 128001 containerMimeType = audio/mpeg diff --git a/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header-replaygain-fast.mp3.unknown_length.dump b/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header-replaygain-fast.mp3.unknown_length.dump index 457facc2495..d9f70ec343c 100644 --- a/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header-replaygain-fast.mp3.unknown_length.dump +++ b/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header-replaygain-fast.mp3.unknown_length.dump @@ -1,15 +1,15 @@ seekMap: isSeekable = true - duration = 2807978 + duration = 2783979 getPosition(0) = [[timeUs=0, position=429]] getPosition(1) = [[timeUs=0, position=429], [timeUs=23999, position=813]] - getPosition(1403989) = [[timeUs=1391989, position=22701], [timeUs=1415988, position=23085]] - getPosition(2807978) = [[timeUs=2783978, position=44973]] + getPosition(1391989) = [[timeUs=1367989, position=22317], [timeUs=1391989, position=22701]] + getPosition(2783979) = [[timeUs=2783979, position=44973]] numberOfTracks = 1 track 0: total output bytes = 44928 sample count = 117 - track duration = 2807978 + track duration = 2783979 format 0: averageBitrate = 128001 containerMimeType = audio/mpeg diff --git a/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header.mp3.0.dump b/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header.mp3.0.dump index 9dde5408e01..f2a3ef215f1 100644 --- a/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header.mp3.0.dump +++ b/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header.mp3.0.dump @@ -1,15 +1,15 @@ seekMap: isSeekable = true - duration = 2807979 + duration = 2783979 getPosition(0) = [[timeUs=0, position=237]] getPosition(1) = [[timeUs=1, position=237]] - getPosition(1403989) = [[timeUs=1403989, position=20120]] - getPosition(2807979) = [[timeUs=2807979, position=38396]] + getPosition(1391989) = [[timeUs=1391989, position=20120]] + getPosition(2783979) = [[timeUs=2783979, position=38396]] numberOfTracks = 1 track 0: total output bytes = 38160 sample count = 117 - track duration = 2807979 + track duration = 2783979 format 0: averageBitrate = 64000 containerMimeType = audio/mpeg diff --git a/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header.mp3.1.dump b/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header.mp3.1.dump index b47319b0f7c..222c2c4da62 100644 --- a/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header.mp3.1.dump +++ b/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header.mp3.1.dump @@ -1,15 +1,15 @@ seekMap: isSeekable = true - duration = 2807979 + duration = 2783979 getPosition(0) = [[timeUs=0, position=237]] getPosition(1) = [[timeUs=1, position=237]] - getPosition(1403989) = [[timeUs=1403989, position=20120]] - getPosition(2807979) = [[timeUs=2807979, position=38396]] + getPosition(1391989) = [[timeUs=1391989, position=20120]] + getPosition(2783979) = [[timeUs=2783979, position=38396]] numberOfTracks = 1 track 0: total output bytes = 24384 sample count = 77 - track duration = 2807979 + track duration = 2783979 format 0: averageBitrate = 64000 containerMimeType = audio/mpeg @@ -21,311 +21,311 @@ track 0: encoderPadding = 576 metadata = entries=[TSSE: description=null: values=[Lavf58.29.100]] sample 0: - time = 958033 + time = 949845 flags = 1 data = length 336, hash 71FFE4A0 sample 1: - time = 982033 + time = 973845 flags = 1 data = length 336, hash D4160463 sample 2: - time = 1006033 + time = 997845 flags = 1 data = length 336, hash EC557B14 sample 3: - time = 1030033 + time = 1021845 flags = 1 data = length 288, hash 5598CF8B sample 4: - time = 1054033 + time = 1045845 flags = 1 data = length 336, hash 7E0AB41 sample 5: - time = 1078033 + time = 1069845 flags = 1 data = length 336, hash 1C585FEF sample 6: - time = 1102033 + time = 1093845 flags = 1 data = length 336, hash A4A4855E sample 7: - time = 1126033 + time = 1117845 flags = 1 data = length 336, hash CECA51D3 sample 8: - time = 1150033 + time = 1141845 flags = 1 data = length 288, hash 2D362DC5 sample 9: - time = 1174033 + time = 1165845 flags = 1 data = length 336, hash 9EB2609D sample 10: - time = 1198033 + time = 1189845 flags = 1 data = length 336, hash 28FFB3FE sample 11: - time = 1222033 + time = 1213845 flags = 1 data = length 288, hash 2AA2D216 sample 12: - time = 1246033 + time = 1237845 flags = 1 data = length 336, hash CDBC7032 sample 13: - time = 1270033 + time = 1261845 flags = 1 data = length 336, hash 25B13FE7 sample 14: - time = 1294033 + time = 1285845 flags = 1 data = length 336, hash DB6BB1E sample 15: - time = 1318033 + time = 1309845 flags = 1 data = length 336, hash EBE951F4 sample 16: - time = 1342033 + time = 1333845 flags = 1 data = length 288, hash 9E2EBFF7 sample 17: - time = 1366033 + time = 1357845 flags = 1 data = length 336, hash 36A7D455 sample 18: - time = 1390033 + time = 1381845 flags = 1 data = length 336, hash 84545F8C sample 19: - time = 1414033 + time = 1405845 flags = 1 data = length 336, hash F66F3045 sample 20: - time = 1438033 + time = 1429845 flags = 1 data = length 576, hash 5AB089EA sample 21: - time = 1462033 + time = 1453845 flags = 1 data = length 336, hash 8868086 sample 22: - time = 1486033 + time = 1477845 flags = 1 data = length 336, hash D5EB6D63 sample 23: - time = 1510033 + time = 1501845 flags = 1 data = length 288, hash 7A5374B7 sample 24: - time = 1534033 + time = 1525845 flags = 1 data = length 336, hash BEB27A75 sample 25: - time = 1558033 + time = 1549845 flags = 1 data = length 336, hash E251E0FD sample 26: - time = 1582033 + time = 1573845 flags = 1 data = length 288, hash D54C970 sample 27: - time = 1606033 + time = 1597845 flags = 1 data = length 336, hash 52C473B9 sample 28: - time = 1630033 + time = 1621845 flags = 1 data = length 336, hash F5F13334 sample 29: - time = 1654033 + time = 1645845 flags = 1 data = length 480, hash A5F1E987 sample 30: - time = 1678033 + time = 1669845 flags = 1 data = length 288, hash 453A1267 sample 31: - time = 1702033 + time = 1693845 flags = 1 data = length 288, hash 7C6C2EA9 sample 32: - time = 1726033 + time = 1717845 flags = 1 data = length 336, hash F4BFECA4 sample 33: - time = 1750033 + time = 1741845 flags = 1 data = length 336, hash 751A395A sample 34: - time = 1774033 + time = 1765845 flags = 1 data = length 336, hash EE38DB02 sample 35: - time = 1798033 + time = 1789845 flags = 1 data = length 336, hash F18837E2 sample 36: - time = 1822033 + time = 1813845 flags = 1 data = length 336, hash ED36B78E sample 37: - time = 1846033 + time = 1837845 flags = 1 data = length 336, hash B3D28289 sample 38: - time = 1870033 + time = 1861845 flags = 1 data = length 288, hash 8BDE28E1 sample 39: - time = 1894033 + time = 1885845 flags = 1 data = length 336, hash CFD5E966 sample 40: - time = 1918033 + time = 1909845 flags = 1 data = length 288, hash DC08E267 sample 41: - time = 1942033 + time = 1933845 flags = 1 data = length 336, hash 6530CB78 sample 42: - time = 1966033 + time = 1957845 flags = 1 data = length 336, hash 6CC6636E sample 43: - time = 1990033 + time = 1981845 flags = 1 data = length 336, hash 613047C1 sample 44: - time = 2014033 + time = 2005845 flags = 1 data = length 288, hash CDC747BF sample 45: - time = 2038033 + time = 2029845 flags = 1 data = length 336, hash AF22AA74 sample 46: - time = 2062033 + time = 2053845 flags = 1 data = length 384, hash 82F326AA sample 47: - time = 2086033 + time = 2077845 flags = 1 data = length 384, hash EDA26C4D sample 48: - time = 2110033 + time = 2101845 flags = 1 data = length 336, hash 94C643DC sample 49: - time = 2134033 + time = 2125845 flags = 1 data = length 288, hash CB5D9C40 sample 50: - time = 2158033 + time = 2149845 flags = 1 data = length 336, hash 1E69DE3F sample 51: - time = 2182033 + time = 2173845 flags = 1 data = length 336, hash 7E472219 sample 52: - time = 2206033 + time = 2197845 flags = 1 data = length 336, hash DA47B9FA sample 53: - time = 2230033 + time = 2221845 flags = 1 data = length 336, hash DD0ABB7C sample 54: - time = 2254033 + time = 2245845 flags = 1 data = length 288, hash DBF93FAC sample 55: - time = 2278033 + time = 2269845 flags = 1 data = length 336, hash 243F4B2 sample 56: - time = 2302033 + time = 2293845 flags = 1 data = length 336, hash 2E881490 sample 57: - time = 2326033 + time = 2317845 flags = 1 data = length 288, hash 1C28C8BE sample 58: - time = 2350033 + time = 2341845 flags = 1 data = length 336, hash C73E5D30 sample 59: - time = 2374033 + time = 2365845 flags = 1 data = length 288, hash 98B5BFF6 sample 60: - time = 2398033 + time = 2389845 flags = 1 data = length 336, hash E0135533 sample 61: - time = 2422033 + time = 2413845 flags = 1 data = length 336, hash D13C9DBC sample 62: - time = 2446033 + time = 2437845 flags = 1 data = length 336, hash 63D524CA sample 63: - time = 2470033 + time = 2461845 flags = 1 data = length 288, hash A28514C3 sample 64: - time = 2494033 + time = 2485845 flags = 1 data = length 336, hash 72B647FF sample 65: - time = 2518033 + time = 2509845 flags = 1 data = length 336, hash 8F740AB1 sample 66: - time = 2542033 + time = 2533845 flags = 1 data = length 336, hash 5E3C7E93 sample 67: - time = 2566033 + time = 2557845 flags = 1 data = length 336, hash 121B913B sample 68: - time = 2590033 + time = 2581845 flags = 1 data = length 336, hash 578FCCF2 sample 69: - time = 2614033 + time = 2605845 flags = 1 data = length 336, hash 5B5823DE sample 70: - time = 2638033 + time = 2629845 flags = 1 data = length 384, hash D8B83F78 sample 71: - time = 2662033 + time = 2653845 flags = 1 data = length 240, hash E649682F sample 72: - time = 2686033 + time = 2677845 flags = 1 data = length 96, hash C559A6F4 sample 73: - time = 2710033 + time = 2701845 flags = 1 data = length 96, hash 792796BC sample 74: - time = 2734033 + time = 2725845 flags = 1 data = length 120, hash 8172CD0E sample 75: - time = 2758033 + time = 2749845 flags = 1 data = length 120, hash F562B52F sample 76: - time = 2782033 + time = 2773845 flags = 1 data = length 96, hash FF8D5B98 tracksEnded = true diff --git a/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header.mp3.2.dump b/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header.mp3.2.dump index 7eabbad4cb7..4319cf192ff 100644 --- a/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header.mp3.2.dump +++ b/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header.mp3.2.dump @@ -1,15 +1,15 @@ seekMap: isSeekable = true - duration = 2807979 + duration = 2783979 getPosition(0) = [[timeUs=0, position=237]] getPosition(1) = [[timeUs=1, position=237]] - getPosition(1403989) = [[timeUs=1403989, position=20120]] - getPosition(2807979) = [[timeUs=2807979, position=38396]] + getPosition(1391989) = [[timeUs=1391989, position=20120]] + getPosition(2783979) = [[timeUs=2783979, position=38396]] numberOfTracks = 1 track 0: total output bytes = 11328 sample count = 38 - track duration = 2807979 + track duration = 2783979 format 0: averageBitrate = 64000 containerMimeType = audio/mpeg @@ -21,155 +21,155 @@ track 0: encoderPadding = 576 metadata = entries=[TSSE: description=null: values=[Lavf58.29.100]] sample 0: - time = 1886757 + time = 1870631 flags = 1 data = length 336, hash CFD5E966 sample 1: - time = 1910757 + time = 1894631 flags = 1 data = length 288, hash DC08E267 sample 2: - time = 1934757 + time = 1918631 flags = 1 data = length 336, hash 6530CB78 sample 3: - time = 1958757 + time = 1942631 flags = 1 data = length 336, hash 6CC6636E sample 4: - time = 1982757 + time = 1966631 flags = 1 data = length 336, hash 613047C1 sample 5: - time = 2006757 + time = 1990631 flags = 1 data = length 288, hash CDC747BF sample 6: - time = 2030757 + time = 2014631 flags = 1 data = length 336, hash AF22AA74 sample 7: - time = 2054757 + time = 2038631 flags = 1 data = length 384, hash 82F326AA sample 8: - time = 2078757 + time = 2062631 flags = 1 data = length 384, hash EDA26C4D sample 9: - time = 2102757 + time = 2086631 flags = 1 data = length 336, hash 94C643DC sample 10: - time = 2126757 + time = 2110631 flags = 1 data = length 288, hash CB5D9C40 sample 11: - time = 2150757 + time = 2134631 flags = 1 data = length 336, hash 1E69DE3F sample 12: - time = 2174757 + time = 2158631 flags = 1 data = length 336, hash 7E472219 sample 13: - time = 2198757 + time = 2182631 flags = 1 data = length 336, hash DA47B9FA sample 14: - time = 2222757 + time = 2206631 flags = 1 data = length 336, hash DD0ABB7C sample 15: - time = 2246757 + time = 2230631 flags = 1 data = length 288, hash DBF93FAC sample 16: - time = 2270757 + time = 2254631 flags = 1 data = length 336, hash 243F4B2 sample 17: - time = 2294757 + time = 2278631 flags = 1 data = length 336, hash 2E881490 sample 18: - time = 2318757 + time = 2302631 flags = 1 data = length 288, hash 1C28C8BE sample 19: - time = 2342757 + time = 2326631 flags = 1 data = length 336, hash C73E5D30 sample 20: - time = 2366757 + time = 2350631 flags = 1 data = length 288, hash 98B5BFF6 sample 21: - time = 2390757 + time = 2374631 flags = 1 data = length 336, hash E0135533 sample 22: - time = 2414757 + time = 2398631 flags = 1 data = length 336, hash D13C9DBC sample 23: - time = 2438757 + time = 2422631 flags = 1 data = length 336, hash 63D524CA sample 24: - time = 2462757 + time = 2446631 flags = 1 data = length 288, hash A28514C3 sample 25: - time = 2486757 + time = 2470631 flags = 1 data = length 336, hash 72B647FF sample 26: - time = 2510757 + time = 2494631 flags = 1 data = length 336, hash 8F740AB1 sample 27: - time = 2534757 + time = 2518631 flags = 1 data = length 336, hash 5E3C7E93 sample 28: - time = 2558757 + time = 2542631 flags = 1 data = length 336, hash 121B913B sample 29: - time = 2582757 + time = 2566631 flags = 1 data = length 336, hash 578FCCF2 sample 30: - time = 2606757 + time = 2590631 flags = 1 data = length 336, hash 5B5823DE sample 31: - time = 2630757 + time = 2614631 flags = 1 data = length 384, hash D8B83F78 sample 32: - time = 2654757 + time = 2638631 flags = 1 data = length 240, hash E649682F sample 33: - time = 2678757 + time = 2662631 flags = 1 data = length 96, hash C559A6F4 sample 34: - time = 2702757 + time = 2686631 flags = 1 data = length 96, hash 792796BC sample 35: - time = 2726757 + time = 2710631 flags = 1 data = length 120, hash 8172CD0E sample 36: - time = 2750757 + time = 2734631 flags = 1 data = length 120, hash F562B52F sample 37: - time = 2774757 + time = 2758631 flags = 1 data = length 96, hash FF8D5B98 tracksEnded = true diff --git a/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header.mp3.3.dump b/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header.mp3.3.dump index 47ba03e7576..39834e5f038 100644 --- a/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header.mp3.3.dump +++ b/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header.mp3.3.dump @@ -1,15 +1,15 @@ seekMap: isSeekable = true - duration = 2807979 + duration = 2783979 getPosition(0) = [[timeUs=0, position=237]] getPosition(1) = [[timeUs=1, position=237]] - getPosition(1403989) = [[timeUs=1403989, position=20120]] - getPosition(2807979) = [[timeUs=2807979, position=38396]] + getPosition(1391989) = [[timeUs=1391989, position=20120]] + getPosition(2783979) = [[timeUs=2783979, position=38396]] numberOfTracks = 1 track 0: total output bytes = 0 sample count = 0 - track duration = 2807979 + track duration = 2783979 format 0: averageBitrate = 64000 containerMimeType = audio/mpeg diff --git a/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header.mp3.unknown_length.dump b/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header.mp3.unknown_length.dump index 9dde5408e01..f2a3ef215f1 100644 --- a/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header.mp3.unknown_length.dump +++ b/libraries/test_data/src/test/assets/extractordumps/mp3/bear-vbr-xing-header.mp3.unknown_length.dump @@ -1,15 +1,15 @@ seekMap: isSeekable = true - duration = 2807979 + duration = 2783979 getPosition(0) = [[timeUs=0, position=237]] getPosition(1) = [[timeUs=1, position=237]] - getPosition(1403989) = [[timeUs=1403989, position=20120]] - getPosition(2807979) = [[timeUs=2807979, position=38396]] + getPosition(1391989) = [[timeUs=1391989, position=20120]] + getPosition(2783979) = [[timeUs=2783979, position=38396]] numberOfTracks = 1 track 0: total output bytes = 38160 sample count = 117 - track duration = 2807979 + track duration = 2783979 format 0: averageBitrate = 64000 containerMimeType = audio/mpeg diff --git a/libraries/test_data/src/test/assets/extractordumps/mp3/test-cbr-info-header-pcut-frame.mp3.0.dump b/libraries/test_data/src/test/assets/extractordumps/mp3/test-cbr-info-header-pcut-frame.mp3.0.dump index 08c75fa3453..df3e1120186 100644 --- a/libraries/test_data/src/test/assets/extractordumps/mp3/test-cbr-info-header-pcut-frame.mp3.0.dump +++ b/libraries/test_data/src/test/assets/extractordumps/mp3/test-cbr-info-header-pcut-frame.mp3.0.dump @@ -1,15 +1,15 @@ seekMap: isSeekable = true - duration = 1070994 + duration = 1026099 getPosition(0) = [[timeUs=0, position=227]] getPosition(1) = [[timeUs=0, position=227], [timeUs=26069, position=433]] - getPosition(535497) = [[timeUs=521386, position=4347], [timeUs=547456, position=4553]] - getPosition(1070994) = [[timeUs=1044925, position=8484]] + getPosition(513049) = [[timeUs=495317, position=4141], [timeUs=521386, position=4347]] + getPosition(1026099) = [[timeUs=1026099, position=8484]] numberOfTracks = 1 track 0: total output bytes = 8463 sample count = 41 - track duration = 1070994 + track duration = 1026099 format 0: averageBitrate = 63216 containerMimeType = audio/mpeg diff --git a/libraries/test_data/src/test/assets/extractordumps/mp3/test-cbr-info-header-pcut-frame.mp3.1.dump b/libraries/test_data/src/test/assets/extractordumps/mp3/test-cbr-info-header-pcut-frame.mp3.1.dump index cd171718f2c..bc7ffd55c70 100644 --- a/libraries/test_data/src/test/assets/extractordumps/mp3/test-cbr-info-header-pcut-frame.mp3.1.dump +++ b/libraries/test_data/src/test/assets/extractordumps/mp3/test-cbr-info-header-pcut-frame.mp3.1.dump @@ -1,15 +1,15 @@ seekMap: isSeekable = true - duration = 1070994 + duration = 1026099 getPosition(0) = [[timeUs=0, position=227]] getPosition(1) = [[timeUs=0, position=227], [timeUs=26069, position=433]] - getPosition(535497) = [[timeUs=521386, position=4347], [timeUs=547456, position=4553]] - getPosition(1070994) = [[timeUs=1044925, position=8484]] + getPosition(513049) = [[timeUs=495317, position=4141], [timeUs=521386, position=4347]] + getPosition(1026099) = [[timeUs=1026099, position=8484]] numberOfTracks = 1 track 0: total output bytes = 5643 sample count = 27 - track duration = 1070994 + track duration = 1026099 format 0: averageBitrate = 63216 containerMimeType = audio/mpeg diff --git a/libraries/test_data/src/test/assets/extractordumps/mp3/test-cbr-info-header-pcut-frame.mp3.2.dump b/libraries/test_data/src/test/assets/extractordumps/mp3/test-cbr-info-header-pcut-frame.mp3.2.dump index 103044e917a..82bc6c008da 100644 --- a/libraries/test_data/src/test/assets/extractordumps/mp3/test-cbr-info-header-pcut-frame.mp3.2.dump +++ b/libraries/test_data/src/test/assets/extractordumps/mp3/test-cbr-info-header-pcut-frame.mp3.2.dump @@ -1,15 +1,15 @@ seekMap: isSeekable = true - duration = 1070994 + duration = 1026099 getPosition(0) = [[timeUs=0, position=227]] getPosition(1) = [[timeUs=0, position=227], [timeUs=26069, position=433]] - getPosition(535497) = [[timeUs=521386, position=4347], [timeUs=547456, position=4553]] - getPosition(1070994) = [[timeUs=1044925, position=8484]] + getPosition(513049) = [[timeUs=495317, position=4141], [timeUs=521386, position=4347]] + getPosition(1026099) = [[timeUs=1026099, position=8484]] numberOfTracks = 1 track 0: - total output bytes = 2717 - sample count = 13 - track duration = 1070994 + total output bytes = 2926 + sample count = 14 + track duration = 1026099 format 0: averageBitrate = 63216 containerMimeType = audio/mpeg @@ -21,55 +21,59 @@ track 0: encoderPadding = 1404 metadata = entries=[TSSE: description=null: values=[Lavf58.45.100]] sample 0: - time = 727157 + time = 700708 flags = 1 - data = length 209, hash 30962500 + data = length 209, hash 3EB1A364 sample 1: - time = 753279 + time = 726830 flags = 1 - data = length 209, hash 2C5CCBB7 + data = length 209, hash 30962500 sample 2: - time = 779401 + time = 752952 flags = 1 - data = length 209, hash F9CB9E37 + data = length 209, hash 2C5CCBB7 sample 3: - time = 805524 + time = 779075 flags = 1 - data = length 209, hash F75BC8C0 + data = length 209, hash F9CB9E37 sample 4: - time = 831646 + time = 805197 flags = 1 - data = length 209, hash D00ED607 + data = length 209, hash F75BC8C0 sample 5: - time = 857769 + time = 831320 flags = 1 - data = length 209, hash B4338395 + data = length 209, hash D00ED607 sample 6: - time = 883891 + time = 857442 flags = 1 - data = length 209, hash E3E838A0 + data = length 209, hash B4338395 sample 7: - time = 910014 + time = 883565 flags = 1 - data = length 209, hash 2B0CF78 + data = length 209, hash E3E838A0 sample 8: - time = 936136 + time = 909687 flags = 1 - data = length 209, hash 31906FA9 + data = length 209, hash 2B0CF78 sample 9: - time = 962259 + time = 935810 flags = 1 - data = length 209, hash C92FC08F + data = length 209, hash 31906FA9 sample 10: - time = 988381 + time = 961932 flags = 1 - data = length 209, hash 7C89994 + data = length 209, hash C92FC08F sample 11: - time = 1014503 + time = 988054 flags = 1 - data = length 209, hash EC37743B + data = length 209, hash 7C89994 sample 12: - time = 1040626 + time = 1014177 + flags = 1 + data = length 209, hash EC37743B + sample 13: + time = 1040299 flags = 1 data = length 209, hash C974F6FB tracksEnded = true diff --git a/libraries/test_data/src/test/assets/extractordumps/mp3/test-cbr-info-header-pcut-frame.mp3.3.dump b/libraries/test_data/src/test/assets/extractordumps/mp3/test-cbr-info-header-pcut-frame.mp3.3.dump index 5f40a3c8a4d..fb98215d90a 100644 --- a/libraries/test_data/src/test/assets/extractordumps/mp3/test-cbr-info-header-pcut-frame.mp3.3.dump +++ b/libraries/test_data/src/test/assets/extractordumps/mp3/test-cbr-info-header-pcut-frame.mp3.3.dump @@ -1,15 +1,15 @@ seekMap: isSeekable = true - duration = 1070994 + duration = 1026099 getPosition(0) = [[timeUs=0, position=227]] getPosition(1) = [[timeUs=0, position=227], [timeUs=26069, position=433]] - getPosition(535497) = [[timeUs=521386, position=4347], [timeUs=547456, position=4553]] - getPosition(1070994) = [[timeUs=1044925, position=8484]] + getPosition(513049) = [[timeUs=495317, position=4141], [timeUs=521386, position=4347]] + getPosition(1026099) = [[timeUs=1026099, position=8484]] numberOfTracks = 1 track 0: total output bytes = 0 sample count = 0 - track duration = 1070994 + track duration = 1026099 format 0: averageBitrate = 63216 containerMimeType = audio/mpeg diff --git a/libraries/test_data/src/test/assets/extractordumps/mp3/test-cbr-info-header-pcut-frame.mp3.unknown_length.dump b/libraries/test_data/src/test/assets/extractordumps/mp3/test-cbr-info-header-pcut-frame.mp3.unknown_length.dump index 08c75fa3453..df3e1120186 100644 --- a/libraries/test_data/src/test/assets/extractordumps/mp3/test-cbr-info-header-pcut-frame.mp3.unknown_length.dump +++ b/libraries/test_data/src/test/assets/extractordumps/mp3/test-cbr-info-header-pcut-frame.mp3.unknown_length.dump @@ -1,15 +1,15 @@ seekMap: isSeekable = true - duration = 1070994 + duration = 1026099 getPosition(0) = [[timeUs=0, position=227]] getPosition(1) = [[timeUs=0, position=227], [timeUs=26069, position=433]] - getPosition(535497) = [[timeUs=521386, position=4347], [timeUs=547456, position=4553]] - getPosition(1070994) = [[timeUs=1044925, position=8484]] + getPosition(513049) = [[timeUs=495317, position=4141], [timeUs=521386, position=4347]] + getPosition(1026099) = [[timeUs=1026099, position=8484]] numberOfTracks = 1 track 0: total output bytes = 8463 sample count = 41 - track duration = 1070994 + track duration = 1026099 format 0: averageBitrate = 63216 containerMimeType = audio/mpeg diff --git a/libraries/test_data/src/test/assets/extractordumps/mp3/test-cbr-info-header.mp3.0.dump b/libraries/test_data/src/test/assets/extractordumps/mp3/test-cbr-info-header.mp3.0.dump index adffb2383f0..e4d451085fa 100644 --- a/libraries/test_data/src/test/assets/extractordumps/mp3/test-cbr-info-header.mp3.0.dump +++ b/libraries/test_data/src/test/assets/extractordumps/mp3/test-cbr-info-header.mp3.0.dump @@ -1,15 +1,15 @@ seekMap: isSeekable = true - duration = 1044875 + duration = 999977 getPosition(0) = [[timeUs=0, position=227]] getPosition(1) = [[timeUs=0, position=227], [timeUs=26125, position=436]] - getPosition(522437) = [[timeUs=496375, position=4198], [timeUs=522500, position=4407]] - getPosition(1044875) = [[timeUs=1018750, position=8377]] + getPosition(499988) = [[timeUs=496375, position=4198], [timeUs=522500, position=4407]] + getPosition(999977) = [[timeUs=999977, position=8377]] numberOfTracks = 1 track 0: total output bytes = 8359 sample count = 40 - track duration = 1044875 + track duration = 999977 format 0: averageBitrate = 64000 containerMimeType = audio/mpeg diff --git a/libraries/test_data/src/test/assets/extractordumps/mp3/test-cbr-info-header.mp3.1.dump b/libraries/test_data/src/test/assets/extractordumps/mp3/test-cbr-info-header.mp3.1.dump index 60efc784e76..4eae2b0bafb 100644 --- a/libraries/test_data/src/test/assets/extractordumps/mp3/test-cbr-info-header.mp3.1.dump +++ b/libraries/test_data/src/test/assets/extractordumps/mp3/test-cbr-info-header.mp3.1.dump @@ -1,15 +1,15 @@ seekMap: isSeekable = true - duration = 1044875 + duration = 999977 getPosition(0) = [[timeUs=0, position=227]] getPosition(1) = [[timeUs=0, position=227], [timeUs=26125, position=436]] - getPosition(522437) = [[timeUs=496375, position=4198], [timeUs=522500, position=4407]] - getPosition(1044875) = [[timeUs=1018750, position=8377]] + getPosition(499988) = [[timeUs=496375, position=4198], [timeUs=522500, position=4407]] + getPosition(999977) = [[timeUs=999977, position=8377]] numberOfTracks = 1 track 0: - total output bytes = 5434 - sample count = 26 - track duration = 1044875 + total output bytes = 5643 + sample count = 27 + track duration = 999977 format 0: averageBitrate = 64000 containerMimeType = audio/mpeg @@ -21,107 +21,111 @@ track 0: encoderPadding = 1404 metadata = entries=[TSSE: description=null: values=[Lavf58.45.100]] sample 0: - time = 365625 + time = 339500 flags = 1 - data = length 209, hash 34191E1 + data = length 209, hash 6CCBBB3B sample 1: - time = 391747 + time = 365622 flags = 1 - data = length 209, hash 57323ED7 + data = length 209, hash 34191E1 sample 2: - time = 417869 + time = 391744 flags = 1 - data = length 209, hash 75618CF3 + data = length 209, hash 57323ED7 sample 3: - time = 443992 + time = 417867 flags = 1 - data = length 209, hash 784C973B + data = length 209, hash 75618CF3 sample 4: - time = 470114 + time = 443989 flags = 1 - data = length 209, hash 49106390 + data = length 209, hash 784C973B sample 5: - time = 496237 + time = 470112 flags = 1 - data = length 209, hash 70F6A563 + data = length 209, hash 49106390 sample 6: - time = 522359 + time = 496234 flags = 1 - data = length 209, hash 721882B0 + data = length 209, hash 70F6A563 sample 7: - time = 548482 + time = 522357 flags = 1 - data = length 209, hash 81C62AEE + data = length 209, hash 721882B0 sample 8: - time = 574604 + time = 548479 flags = 1 - data = length 209, hash 16D22463 + data = length 209, hash 81C62AEE sample 9: - time = 600727 + time = 574602 flags = 1 - data = length 209, hash 47033534 + data = length 209, hash 16D22463 sample 10: - time = 626849 + time = 600724 flags = 1 - data = length 209, hash CECB37A6 + data = length 209, hash 47033534 sample 11: - time = 652971 + time = 626846 flags = 1 - data = length 209, hash 6C9C307B + data = length 209, hash CECB37A6 sample 12: - time = 679094 + time = 652969 flags = 1 - data = length 209, hash 3EB1A364 + data = length 209, hash 6C9C307B sample 13: - time = 705216 + time = 679091 flags = 1 - data = length 209, hash 30962500 + data = length 209, hash 3EB1A364 sample 14: - time = 731339 + time = 705214 flags = 1 - data = length 209, hash 2C5CCBB7 + data = length 209, hash 30962500 sample 15: - time = 757461 + time = 731336 flags = 1 - data = length 209, hash F9CB9E37 + data = length 209, hash 2C5CCBB7 sample 16: - time = 783584 + time = 757459 flags = 1 - data = length 209, hash F75BC8C0 + data = length 209, hash F9CB9E37 sample 17: - time = 809706 + time = 783581 flags = 1 - data = length 209, hash D00ED607 + data = length 209, hash F75BC8C0 sample 18: - time = 835829 + time = 809704 flags = 1 - data = length 209, hash B4338395 + data = length 209, hash D00ED607 sample 19: - time = 861951 + time = 835826 flags = 1 - data = length 209, hash E3E838A0 + data = length 209, hash B4338395 sample 20: - time = 888073 + time = 861948 flags = 1 - data = length 209, hash 2B0CF78 + data = length 209, hash E3E838A0 sample 21: - time = 914196 + time = 888071 flags = 1 - data = length 209, hash 31906FA9 + data = length 209, hash 2B0CF78 sample 22: - time = 940318 + time = 914193 flags = 1 - data = length 209, hash C92FC08F + data = length 209, hash 31906FA9 sample 23: - time = 966441 + time = 940316 flags = 1 - data = length 209, hash 7C89994 + data = length 209, hash C92FC08F sample 24: - time = 992563 + time = 966438 flags = 1 - data = length 209, hash EC37743B + data = length 209, hash 7C89994 sample 25: - time = 1018686 + time = 992561 + flags = 1 + data = length 209, hash EC37743B + sample 26: + time = 1018683 flags = 1 data = length 209, hash C974F6FB tracksEnded = true diff --git a/libraries/test_data/src/test/assets/extractordumps/mp3/test-cbr-info-header.mp3.2.dump b/libraries/test_data/src/test/assets/extractordumps/mp3/test-cbr-info-header.mp3.2.dump index 8e6b025b683..aec8410963b 100644 --- a/libraries/test_data/src/test/assets/extractordumps/mp3/test-cbr-info-header.mp3.2.dump +++ b/libraries/test_data/src/test/assets/extractordumps/mp3/test-cbr-info-header.mp3.2.dump @@ -1,15 +1,15 @@ seekMap: isSeekable = true - duration = 1044875 + duration = 999977 getPosition(0) = [[timeUs=0, position=227]] getPosition(1) = [[timeUs=0, position=227], [timeUs=26125, position=436]] - getPosition(522437) = [[timeUs=496375, position=4198], [timeUs=522500, position=4407]] - getPosition(1044875) = [[timeUs=1018750, position=8377]] + getPosition(499988) = [[timeUs=496375, position=4198], [timeUs=522500, position=4407]] + getPosition(999977) = [[timeUs=999977, position=8377]] numberOfTracks = 1 track 0: - total output bytes = 2717 - sample count = 13 - track duration = 1044875 + total output bytes = 2926 + sample count = 14 + track duration = 999977 format 0: averageBitrate = 64000 containerMimeType = audio/mpeg @@ -21,55 +21,59 @@ track 0: encoderPadding = 1404 metadata = entries=[TSSE: description=null: values=[Lavf58.45.100]] sample 0: - time = 705250 + time = 679125 flags = 1 - data = length 209, hash 30962500 + data = length 209, hash 3EB1A364 sample 1: - time = 731372 + time = 705247 flags = 1 - data = length 209, hash 2C5CCBB7 + data = length 209, hash 30962500 sample 2: - time = 757494 + time = 731369 flags = 1 - data = length 209, hash F9CB9E37 + data = length 209, hash 2C5CCBB7 sample 3: - time = 783617 + time = 757492 flags = 1 - data = length 209, hash F75BC8C0 + data = length 209, hash F9CB9E37 sample 4: - time = 809739 + time = 783614 flags = 1 - data = length 209, hash D00ED607 + data = length 209, hash F75BC8C0 sample 5: - time = 835862 + time = 809737 flags = 1 - data = length 209, hash B4338395 + data = length 209, hash D00ED607 sample 6: - time = 861984 + time = 835859 flags = 1 - data = length 209, hash E3E838A0 + data = length 209, hash B4338395 sample 7: - time = 888107 + time = 861982 flags = 1 - data = length 209, hash 2B0CF78 + data = length 209, hash E3E838A0 sample 8: - time = 914229 + time = 888104 flags = 1 - data = length 209, hash 31906FA9 + data = length 209, hash 2B0CF78 sample 9: - time = 940352 + time = 914227 flags = 1 - data = length 209, hash C92FC08F + data = length 209, hash 31906FA9 sample 10: - time = 966474 + time = 940349 flags = 1 - data = length 209, hash 7C89994 + data = length 209, hash C92FC08F sample 11: - time = 992596 + time = 966471 flags = 1 - data = length 209, hash EC37743B + data = length 209, hash 7C89994 sample 12: - time = 1018719 + time = 992594 + flags = 1 + data = length 209, hash EC37743B + sample 13: + time = 1018716 flags = 1 data = length 209, hash C974F6FB tracksEnded = true diff --git a/libraries/test_data/src/test/assets/extractordumps/mp3/test-cbr-info-header.mp3.3.dump b/libraries/test_data/src/test/assets/extractordumps/mp3/test-cbr-info-header.mp3.3.dump index 796a47b3615..7e529bc3abc 100644 --- a/libraries/test_data/src/test/assets/extractordumps/mp3/test-cbr-info-header.mp3.3.dump +++ b/libraries/test_data/src/test/assets/extractordumps/mp3/test-cbr-info-header.mp3.3.dump @@ -1,15 +1,15 @@ seekMap: isSeekable = true - duration = 1044875 + duration = 999977 getPosition(0) = [[timeUs=0, position=227]] getPosition(1) = [[timeUs=0, position=227], [timeUs=26125, position=436]] - getPosition(522437) = [[timeUs=496375, position=4198], [timeUs=522500, position=4407]] - getPosition(1044875) = [[timeUs=1018750, position=8377]] + getPosition(499988) = [[timeUs=496375, position=4198], [timeUs=522500, position=4407]] + getPosition(999977) = [[timeUs=999977, position=8377]] numberOfTracks = 1 track 0: total output bytes = 209 sample count = 1 - track duration = 1044875 + track duration = 999977 format 0: averageBitrate = 64000 containerMimeType = audio/mpeg diff --git a/libraries/test_data/src/test/assets/extractordumps/mp3/test-cbr-info-header.mp3.unknown_length.dump b/libraries/test_data/src/test/assets/extractordumps/mp3/test-cbr-info-header.mp3.unknown_length.dump index adffb2383f0..e4d451085fa 100644 --- a/libraries/test_data/src/test/assets/extractordumps/mp3/test-cbr-info-header.mp3.unknown_length.dump +++ b/libraries/test_data/src/test/assets/extractordumps/mp3/test-cbr-info-header.mp3.unknown_length.dump @@ -1,15 +1,15 @@ seekMap: isSeekable = true - duration = 1044875 + duration = 999977 getPosition(0) = [[timeUs=0, position=227]] getPosition(1) = [[timeUs=0, position=227], [timeUs=26125, position=436]] - getPosition(522437) = [[timeUs=496375, position=4198], [timeUs=522500, position=4407]] - getPosition(1044875) = [[timeUs=1018750, position=8377]] + getPosition(499988) = [[timeUs=496375, position=4198], [timeUs=522500, position=4407]] + getPosition(999977) = [[timeUs=999977, position=8377]] numberOfTracks = 1 track 0: total output bytes = 8359 sample count = 40 - track duration = 1044875 + track duration = 999977 format 0: averageBitrate = 64000 containerMimeType = audio/mpeg