Re-enable RepeatedTranscodeTransformationTest.

There are two major blockers to this test:

- H265 muxing is not available for API<24, so setting video mimeType to H265
  will fail on those devices.
- AMR audio encoding is buggy on some device and it's not a widely used format.

The solution: use a video that is encoded with AVC/MP3, to ensure transcoding
to AVC/AAC.

PiperOrigin-RevId: 429648598
This commit is contained in:
claincly 2022-02-18 22:27:49 +00:00 committed by Ian Baker
parent d7adb94669
commit a196b5ec43
2 changed files with 12 additions and 13 deletions

View File

@ -45,6 +45,9 @@ public final class AndroidTestUtil {
public static final String SEF_ASSET_URI_STRING = "asset:///media/mp4/sample_sef_slow_motion.mp4";
public static final String REMOTE_MP4_10_SECONDS_URI_STRING =
"https://storage.googleapis.com/exoplayer-test-media-1/mp4/android-screens-10s.mp4";
/** Test clip transcoded from {@link #REMOTE_MP4_10_SECONDS_URI_STRING} with H264 and MP3. */
public static final String REMOTE_MP4_10_SECONDS_H264_MP3_URI_STRING =
"https://storage.googleapis.com/exoplayer-test-media-1/mp4/%20android-screens-10s-h264-mp3.mp4";
/**
* Transforms the {@code uriString} with the {@link Transformer}, saving a summary of the

View File

@ -30,13 +30,11 @@ import androidx.test.core.app.ApplicationProvider;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import java.util.HashSet;
import java.util.Set;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
/** Tests repeated transcoding operations (as a stress test and to help reproduce flakiness). */
@RunWith(AndroidJUnit4.class)
@Ignore("Internal - b/206917996")
public final class RepeatedTranscodeTransformationTest {
private static final int TRANSCODE_COUNT = 10;
@ -44,14 +42,14 @@ public final class RepeatedTranscodeTransformationTest {
public void repeatedTranscode_givesConsistentLengthOutput() throws Exception {
Context context = ApplicationProvider.getApplicationContext();
Matrix transformationMatrix = new Matrix();
transformationMatrix.postTranslate((float) 0.1, (float) 0.1);
transformationMatrix.postTranslate(/* dx= */ 0.1f, /* dy= */ 0.1f);
Transformer transformer =
new Transformer.Builder(context)
.setTransformationRequest(
new TransformationRequest.Builder()
.setVideoMimeType(MimeTypes.VIDEO_H265)
.setTransformationMatrix(transformationMatrix)
.setAudioMimeType(MimeTypes.AUDIO_AMR_NB)
// Video MIME type is H264.
.setAudioMimeType(MimeTypes.AUDIO_AAC)
.build())
.build();
@ -63,7 +61,7 @@ public final class RepeatedTranscodeTransformationTest {
context,
/* testId= */ "repeatedTranscode_givesConsistentLengthOutput_" + i,
transformer,
AndroidTestUtil.REMOTE_MP4_10_SECONDS_URI_STRING,
AndroidTestUtil.REMOTE_MP4_10_SECONDS_H264_MP3_URI_STRING,
/* timeoutSeconds= */ 120);
differentOutputSizesBytes.add(checkNotNull(testResult.transformationResult.fileSizeBytes));
}
@ -78,13 +76,13 @@ public final class RepeatedTranscodeTransformationTest {
public void repeatedTranscodeNoAudio_givesConsistentLengthOutput() throws Exception {
Context context = ApplicationProvider.getApplicationContext();
Matrix transformationMatrix = new Matrix();
transformationMatrix.postTranslate((float) 0.1, (float) 0.1);
transformationMatrix.postTranslate(/* dx= */ 0.1f, /* dy= */ 0.1f);
Transformer transformer =
new Transformer.Builder(context)
.setRemoveAudio(true)
.setTransformationRequest(
new TransformationRequest.Builder()
.setVideoMimeType(MimeTypes.VIDEO_H265)
// Video MIME type is H264.
.setTransformationMatrix(transformationMatrix)
.build())
.build();
@ -97,7 +95,7 @@ public final class RepeatedTranscodeTransformationTest {
context,
/* testId= */ "repeatedTranscodeNoAudio_givesConsistentLengthOutput_" + i,
transformer,
AndroidTestUtil.REMOTE_MP4_10_SECONDS_URI_STRING,
AndroidTestUtil.REMOTE_MP4_10_SECONDS_H264_MP3_URI_STRING,
/* timeoutSeconds= */ 120);
differentOutputSizesBytes.add(checkNotNull(testResult.transformationResult.fileSizeBytes));
}
@ -115,9 +113,7 @@ public final class RepeatedTranscodeTransformationTest {
new Transformer.Builder(context)
.setRemoveVideo(true)
.setTransformationRequest(
new TransformationRequest.Builder()
.setAudioMimeType(MimeTypes.AUDIO_AMR_NB)
.build())
new TransformationRequest.Builder().setAudioMimeType(MimeTypes.AUDIO_AAC).build())
.build();
Set<Long> differentOutputSizesBytes = new HashSet<>();
@ -128,7 +124,7 @@ public final class RepeatedTranscodeTransformationTest {
context,
/* testId= */ "repeatedTranscodeNoVideo_givesConsistentLengthOutput_" + i,
transformer,
AndroidTestUtil.REMOTE_MP4_10_SECONDS_URI_STRING,
AndroidTestUtil.REMOTE_MP4_10_SECONDS_H264_MP3_URI_STRING,
/* timeoutSeconds= */ 120);
differentOutputSizesBytes.add(checkNotNull(testResult.transformationResult.fileSizeBytes));
}