Skip to content

Commit 92e2a0b

Browse files
committed
Fiz TransformerEndToEndTest for updated MP3 gapless durations
1 parent 55ba368 commit 92e2a0b

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

libraries/transformer/src/androidTest/java/androidx/media3/transformer/TransformerEndToEndTest.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1834,7 +1834,7 @@ public void loopingTranscodedVideo_producesExpectedResult() throws Exception {
18341834
.build()
18351835
.run(testId, composition);
18361836

1837-
assertThat(result.exportResult.processedInputs).hasSize(7);
1837+
assertThat(result.exportResult.processedInputs).hasSize(6);
18381838
FakeExtractorOutput fakeExtractorOutput =
18391839
extractAllSamplesFromFilePath(
18401840
new Mp4Extractor(new DefaultSubtitleParserFactory()), checkNotNull(result.filePath));
@@ -1844,13 +1844,13 @@ public void loopingTranscodedVideo_producesExpectedResult() throws Exception {
18441844
// seen in this check as the duration is determined by the last video frame.
18451845
// However, if the audio track is roughly as long as the video track, this API difference
18461846
// will be seen in result.exportResult.durationMs.
1847-
assertThat(fakeExtractorOutput.seekMap.getDurationUs()).isWithin(50_000).of(3_150_000);
1847+
assertThat(fakeExtractorOutput.seekMap.getDurationUs()).isWithin(50_000).of(3_000_000);
18481848
FakeTrackOutput audioTrackOutput =
18491849
getOnlyElement(fakeExtractorOutput.getTrackOutputsForType(C.TRACK_TYPE_AUDIO));
18501850
assertThat(audioTrackOutput.lastFormat.channelCount).isEqualTo(1);
18511851
FakeTrackOutput videoTrackOutput =
18521852
getOnlyElement(fakeExtractorOutput.getTrackOutputsForType(C.TRACK_TYPE_VIDEO));
1853-
assertThat(videoTrackOutput.getSampleCount()).isEqualTo(92);
1853+
assertThat(videoTrackOutput.getSampleCount()).isEqualTo(89);
18541854
}
18551855

18561856
@Test
@@ -1863,7 +1863,7 @@ public void loopingImage_producesExpectedResult() throws Exception {
18631863
ImmutableList.of(audioEditedMediaItem, audioEditedMediaItem, audioEditedMediaItem));
18641864
EditedMediaItem imageEditedMediaItem =
18651865
new EditedMediaItem.Builder(
1866-
new MediaItem.Builder().setUri(PNG_ASSET.uri).setImageDurationMs(1000).build())
1866+
new MediaItem.Builder().setUri(PNG_ASSET.uri).setImageDurationMs(950).build())
18671867
.setFrameRate(30)
18681868
.build();
18691869
EditedMediaItemSequence loopingImageSequence =
@@ -1888,13 +1888,13 @@ public void loopingImage_producesExpectedResult() throws Exception {
18881888
// seen in this check as the duration is determined by the last video frame.
18891889
// However, if the audio track is roughly as long as the video track, this API difference
18901890
// will be seen in result.exportResult.durationMs.
1891-
assertThat(fakeExtractorOutput.seekMap.getDurationUs()).isWithin(50_000).of(3_140_000);
1891+
assertThat(fakeExtractorOutput.seekMap.getDurationUs()).isWithin(50_000).of(3_000_000);
18921892
FakeTrackOutput audioTrackOutput =
18931893
getOnlyElement(fakeExtractorOutput.getTrackOutputsForType(C.TRACK_TYPE_AUDIO));
18941894
assertThat(audioTrackOutput.lastFormat.channelCount).isEqualTo(1);
18951895
FakeTrackOutput videoTrackOutput =
18961896
getOnlyElement(fakeExtractorOutput.getTrackOutputsForType(C.TRACK_TYPE_VIDEO));
1897-
assertThat(videoTrackOutput.getSampleCount()).isEqualTo(95);
1897+
assertThat(videoTrackOutput.getSampleCount()).isEqualTo(92);
18981898
}
18991899

19001900
@Test
@@ -1906,7 +1906,7 @@ public void loopingImage_loopingSequenceIsLongest_producesExpectedResult() throw
19061906
EditedMediaItemSequence.withAudioFrom(ImmutableList.of(audioEditedMediaItem));
19071907
EditedMediaItem imageEditedMediaItem =
19081908
new EditedMediaItem.Builder(
1909-
new MediaItem.Builder().setUri(PNG_ASSET.uri).setImageDurationMs(1050).build())
1909+
new MediaItem.Builder().setUri(PNG_ASSET.uri).setImageDurationMs(950).build())
19101910
.setFrameRate(20)
19111911
.build();
19121912
EditedMediaItemSequence loopingImageSequence =
@@ -1931,7 +1931,7 @@ public void loopingImage_loopingSequenceIsLongest_producesExpectedResult() throw
19311931
// seen in this check as the duration is determined by the last video frame.
19321932
// However, if the audio track is roughly as long as the video track, this API difference
19331933
// will be seen in result.exportResult.durationMs.
1934-
assertThat(fakeExtractorOutput.seekMap.getDurationUs()).isWithin(50_000).of(1_050_000);
1934+
assertThat(fakeExtractorOutput.seekMap.getDurationUs()).isWithin(50_000).of(1_000_000);
19351935
FakeTrackOutput audioTrackOutput =
19361936
getOnlyElement(fakeExtractorOutput.getTrackOutputsForType(C.TRACK_TYPE_AUDIO));
19371937
assertThat(audioTrackOutput.lastFormat.channelCount).isEqualTo(1);
@@ -2399,7 +2399,7 @@ public void transcode_withOutputAudioMimeTypeOpus_completesSuccessfully() throws
23992399
new TransformerAndroidTestRunner.Builder(context, analyzer)
24002400
.build()
24012401
.run(testId, audioEditedMediaItem);
2402-
assertThat(audioBytesSeen.get()).isEqualTo(101_760);
2402+
assertThat(audioBytesSeen.get()).isWithin(1_000).of(97_000);
24032403
}
24042404

24052405
@Test

0 commit comments

Comments
 (0)