Commit ab2cabe3 by andrewlewis Committed by christosts

Check capabilities for more tests

Some of the test methods in `TransformationTest` don't check
capabilities. Add a check just scoped to decoding (not checking
encoding, but the default encoder factory may fall back).

PiperOrigin-RevId: 510088562
parent 3f84c869
...@@ -17,6 +17,7 @@ package com.google.android.exoplayer2.transformer.mh; ...@@ -17,6 +17,7 @@ package com.google.android.exoplayer2.transformer.mh;
import static com.google.android.exoplayer2.transformer.AndroidTestUtil.MP4_ASSET_SEF_URI_STRING; import static com.google.android.exoplayer2.transformer.AndroidTestUtil.MP4_ASSET_SEF_URI_STRING;
import static com.google.android.exoplayer2.transformer.AndroidTestUtil.MP4_ASSET_URI_STRING; import static com.google.android.exoplayer2.transformer.AndroidTestUtil.MP4_ASSET_URI_STRING;
import static com.google.android.exoplayer2.transformer.AndroidTestUtil.MP4_ASSET_WITH_INCREASING_TIMESTAMPS_FORMAT;
import static com.google.android.exoplayer2.transformer.AndroidTestUtil.MP4_ASSET_WITH_INCREASING_TIMESTAMPS_URI_STRING; import static com.google.android.exoplayer2.transformer.AndroidTestUtil.MP4_ASSET_WITH_INCREASING_TIMESTAMPS_URI_STRING;
import static com.google.android.exoplayer2.transformer.AndroidTestUtil.MP4_REMOTE_4K60_PORTRAIT_FORMAT; import static com.google.android.exoplayer2.transformer.AndroidTestUtil.MP4_REMOTE_4K60_PORTRAIT_FORMAT;
import static com.google.android.exoplayer2.transformer.AndroidTestUtil.MP4_REMOTE_4K60_PORTRAIT_URI_STRING; import static com.google.android.exoplayer2.transformer.AndroidTestUtil.MP4_REMOTE_4K60_PORTRAIT_URI_STRING;
...@@ -54,6 +55,16 @@ public class ExportTest { ...@@ -54,6 +55,16 @@ public class ExportTest {
public void export() throws Exception { public void export() throws Exception {
String testId = TAG + "_export"; String testId = TAG + "_export";
Context context = ApplicationProvider.getApplicationContext(); Context context = ApplicationProvider.getApplicationContext();
// Note: throughout this class we only check decoding capability as tests should still run if
// Transformer is able to succeed by falling back to a lower resolution.
if (AndroidTestUtil.skipAndLogIfFormatsUnsupported(
context,
testId,
/* inputFormat= */ MP4_ASSET_WITH_INCREASING_TIMESTAMPS_FORMAT,
/* outputFormat= */ null)) {
return;
}
Transformer transformer = Transformer transformer =
new Transformer.Builder(context) new Transformer.Builder(context)
.setEncoderFactory(new ForceEncodeEncoderFactory(context)) .setEncoderFactory(new ForceEncodeEncoderFactory(context))
...@@ -81,6 +92,13 @@ public class ExportTest { ...@@ -81,6 +92,13 @@ public class ExportTest {
public void exportToSpecificBitrate() throws Exception { public void exportToSpecificBitrate() throws Exception {
String testId = TAG + "_exportToSpecificBitrate"; String testId = TAG + "_exportToSpecificBitrate";
Context context = ApplicationProvider.getApplicationContext(); Context context = ApplicationProvider.getApplicationContext();
if (AndroidTestUtil.skipAndLogIfFormatsUnsupported(
context,
testId,
/* inputFormat= */ MP4_ASSET_WITH_INCREASING_TIMESTAMPS_FORMAT,
/* outputFormat= */ null)) {
return;
}
Transformer transformer = Transformer transformer =
new Transformer.Builder(context) new Transformer.Builder(context)
.setEncoderFactory( .setEncoderFactory(
...@@ -104,7 +122,6 @@ public class ExportTest { ...@@ -104,7 +122,6 @@ public class ExportTest {
public void export4K60() throws Exception { public void export4K60() throws Exception {
String testId = TAG + "_export4K60"; String testId = TAG + "_export4K60";
Context context = ApplicationProvider.getApplicationContext(); Context context = ApplicationProvider.getApplicationContext();
if (AndroidTestUtil.skipAndLogIfFormatsUnsupported( if (AndroidTestUtil.skipAndLogIfFormatsUnsupported(
context, context,
testId, testId,
...@@ -129,11 +146,11 @@ public class ExportTest { ...@@ -129,11 +146,11 @@ public class ExportTest {
public void export8K24() throws Exception { public void export8K24() throws Exception {
String testId = TAG + "_export8K24"; String testId = TAG + "_export8K24";
Context context = ApplicationProvider.getApplicationContext(); Context context = ApplicationProvider.getApplicationContext();
if (AndroidTestUtil.skipAndLogIfFormatsUnsupported( if (AndroidTestUtil.skipAndLogIfFormatsUnsupported(
context, testId, /* inputFormat= */ MP4_REMOTE_8K24_FORMAT, /* outputFormat= */ null)) { context, testId, /* inputFormat= */ MP4_REMOTE_8K24_FORMAT, /* outputFormat= */ null)) {
return; return;
} }
Transformer transformer = Transformer transformer =
new Transformer.Builder(context) new Transformer.Builder(context)
.setEncoderFactory(new ForceEncodeEncoderFactory(context)) .setEncoderFactory(new ForceEncodeEncoderFactory(context))
...@@ -150,6 +167,14 @@ public class ExportTest { ...@@ -150,6 +167,14 @@ public class ExportTest {
public void exportNoAudio() throws Exception { public void exportNoAudio() throws Exception {
String testId = TAG + "_exportNoAudio"; String testId = TAG + "_exportNoAudio";
Context context = ApplicationProvider.getApplicationContext(); Context context = ApplicationProvider.getApplicationContext();
if (AndroidTestUtil.skipAndLogIfFormatsUnsupported(
context,
testId,
/* inputFormat= */ MP4_ASSET_WITH_INCREASING_TIMESTAMPS_FORMAT,
/* outputFormat= */ null)) {
return;
}
Transformer transformer = Transformer transformer =
new Transformer.Builder(context) new Transformer.Builder(context)
.setEncoderFactory(new ForceEncodeEncoderFactory(context)) .setEncoderFactory(new ForceEncodeEncoderFactory(context))
...@@ -187,7 +212,8 @@ public class ExportTest { ...@@ -187,7 +212,8 @@ public class ExportTest {
Context context = ApplicationProvider.getApplicationContext(); Context context = ApplicationProvider.getApplicationContext();
if (Util.SDK_INT < 25) { if (Util.SDK_INT < 25) {
// TODO(b/210593256): Remove test skipping after removing the MediaMuxer dependency. // TODO(b/210593256): Remove test skipping after using an in-app muxer that supports B-frames
// before API 25.
recordTestSkipped(context, testId, /* reason= */ "API version lacks muxing support"); recordTestSkipped(context, testId, /* reason= */ "API version lacks muxing support");
return; return;
} }
...@@ -206,6 +232,13 @@ public class ExportTest { ...@@ -206,6 +232,13 @@ public class ExportTest {
public void exportFrameRotation() throws Exception { public void exportFrameRotation() throws Exception {
String testId = TAG + "_exportFrameRotation"; String testId = TAG + "_exportFrameRotation";
Context context = ApplicationProvider.getApplicationContext(); Context context = ApplicationProvider.getApplicationContext();
if (AndroidTestUtil.skipAndLogIfFormatsUnsupported(
context,
testId,
/* inputFormat= */ MP4_ASSET_WITH_INCREASING_TIMESTAMPS_FORMAT,
/* outputFormat= */ null)) {
return;
}
Transformer transformer = new Transformer.Builder(context).build(); Transformer transformer = new Transformer.Builder(context).build();
MediaItem mediaItem = MediaItem mediaItem =
...@@ -218,6 +251,6 @@ public class ExportTest { ...@@ -218,6 +251,6 @@ public class ExportTest {
new TransformerAndroidTestRunner.Builder(context, transformer) new TransformerAndroidTestRunner.Builder(context, transformer)
.build() .build()
.run(/* testId= */ testId, editedMediaItem); .run(testId, editedMediaItem);
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment