use of androidx.media3.transformer.Transformer in project ExoPlayer by google.
the class RepeatedTranscodeTransformationTest method repeatedTranscodeNoVideo_givesConsistentLengthOutput.
@Test
public void repeatedTranscodeNoVideo_givesConsistentLengthOutput() throws Exception {
Context context = ApplicationProvider.getApplicationContext();
Transformer transformer = new Transformer.Builder(context).setRemoveVideo(true).setTransformationRequest(new TransformationRequest.Builder().setAudioMimeType(MimeTypes.AUDIO_AMR_NB).build()).build();
Set<Long> differentOutputSizesBytes = new HashSet<>();
for (int i = 0; i < TRANSCODE_COUNT; i++) {
// Use a long video in case an error occurs a while after the start of the video.
AndroidTestUtil.TransformationResult result = runTransformer(context, /* testId= */
"repeatedTranscodeNoVideo_givesConsistentLengthOutput_" + i, transformer, AndroidTestUtil.REMOTE_MP4_10_SECONDS_URI_STRING, /* timeoutSeconds= */
120);
differentOutputSizesBytes.add(Assertions.checkNotNull(result.fileSizeBytes));
}
assertWithMessage("Different transcoding output sizes detected. Sizes: " + differentOutputSizesBytes).that(differentOutputSizesBytes.size()).isEqualTo(1);
}
Aggregations