Commit 066327da by hschlueter Committed by Marc Baechinger

Skip transform4K60 test if 4K decoding is not supported.

4K decoding is not supported (not required to be supported) on all
devices, e.g., Nexus 5 does not support it.

PiperOrigin-RevId: 450682519
parent 9c5bc56d
...@@ -232,11 +232,11 @@ public final class AndroidTestUtil { ...@@ -232,11 +232,11 @@ public final class AndroidTestUtil {
* @param context The {@link Context context}. * @param context The {@link Context context}.
* @param testId The test ID. * @param testId The test ID.
* @param decodingFormat The {@link Format format} to decode. * @param decodingFormat The {@link Format format} to decode.
* @param encodingFormat The {@link Format format} to encode. * @param encodingFormat The {@link Format format} to encode, optional.
* @return Whether the test should be skipped. * @return Whether the test should be skipped.
*/ */
public static boolean skipAndLogIfInsufficientCodecSupport( public static boolean skipAndLogIfInsufficientCodecSupport(
Context context, String testId, Format decodingFormat, Format encodingFormat) Context context, String testId, Format decodingFormat, @Nullable Format encodingFormat)
throws IOException, JSONException { throws IOException, JSONException {
boolean canDecode = false; boolean canDecode = false;
@Nullable MediaCodecUtil.DecoderQueryException queryException = null; @Nullable MediaCodecUtil.DecoderQueryException queryException = null;
...@@ -246,7 +246,7 @@ public final class AndroidTestUtil { ...@@ -246,7 +246,7 @@ public final class AndroidTestUtil {
queryException = e; queryException = e;
} }
boolean canEncode = canEncode(encodingFormat); boolean canEncode = encodingFormat == null || canEncode(encodingFormat);
if (canDecode && canEncode) { if (canDecode && canEncode) {
return false; return false;
......
...@@ -19,6 +19,7 @@ import static com.google.android.exoplayer2.transformer.AndroidTestUtil.FORCE_EN ...@@ -19,6 +19,7 @@ import static com.google.android.exoplayer2.transformer.AndroidTestUtil.FORCE_EN
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_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_URI_STRING; import static com.google.android.exoplayer2.transformer.AndroidTestUtil.MP4_REMOTE_4K60_PORTRAIT_URI_STRING;
import static com.google.android.exoplayer2.transformer.AndroidTestUtil.recordTestSkipped; import static com.google.android.exoplayer2.transformer.AndroidTestUtil.recordTestSkipped;
...@@ -90,6 +91,15 @@ public class TransformationTest { ...@@ -90,6 +91,15 @@ public class TransformationTest {
public void transform4K60() throws Exception { public void transform4K60() throws Exception {
String testId = TAG + "_transform4K60"; String testId = TAG + "_transform4K60";
Context context = ApplicationProvider.getApplicationContext(); Context context = ApplicationProvider.getApplicationContext();
if (AndroidTestUtil.skipAndLogIfInsufficientCodecSupport(
context,
testId,
/* decodingFormat= */ MP4_REMOTE_4K60_PORTRAIT_FORMAT,
/* encodingFormat= */ null)) {
return;
}
Transformer transformer = Transformer transformer =
new Transformer.Builder(context).setEncoderFactory(FORCE_ENCODE_ENCODER_FACTORY).build(); new Transformer.Builder(context).setEncoderFactory(FORCE_ENCODE_ENCODER_FACTORY).build();
new TransformerAndroidTestRunner.Builder(context, transformer) new TransformerAndroidTestRunner.Builder(context, transformer)
......
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