Commit 084bde2d by samrobinson Committed by Ian Baker

Restructure regression androidTests, adding a 4k60 video and test.

Test list can be structured so tests don't need to be in different
classes, cleaning up the location of new test cases.

PiperOrigin-RevId: 431492941
parent 85512f66
...@@ -42,13 +42,17 @@ public final class AndroidTestUtil { ...@@ -42,13 +42,17 @@ public final class AndroidTestUtil {
public static final String MP4_ASSET_URI_STRING = "asset:///media/mp4/sample.mp4"; public static final String MP4_ASSET_URI_STRING = "asset:///media/mp4/sample.mp4";
public static final String MP4_ASSET_WITH_INCREASING_TIMESTAMPS_URI_STRING = public static final String MP4_ASSET_WITH_INCREASING_TIMESTAMPS_URI_STRING =
"asset:///media/mp4/sample_with_increasing_timestamps.mp4"; "asset:///media/mp4/sample_with_increasing_timestamps.mp4";
public static final String SEF_ASSET_URI_STRING = "asset:///media/mp4/sample_sef_slow_motion.mp4"; public static final String MP4_ASSET_SEF_URI_STRING =
public static final String REMOTE_MP4_10_SECONDS_URI_STRING = "asset:///media/mp4/sample_sef_slow_motion.mp4";
public static final String MP4_REMOTE_10_SECONDS_URI_STRING =
"https://storage.googleapis.com/exoplayer-test-media-1/mp4/android-screens-10s.mp4"; "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. */ /** Test clip transcoded from {@link #MP4_REMOTE_10_SECONDS_URI_STRING} with H264 and MP3. */
public static final String REMOTE_MP4_10_SECONDS_H264_MP3_URI_STRING = public static final String MP4_REMOTE_H264_MP3_URI_STRING =
"https://storage.googleapis.com/exoplayer-test-media-1/mp4/%20android-screens-10s-h264-mp3.mp4"; "https://storage.googleapis.com/exoplayer-test-media-1/mp4/%20android-screens-10s-h264-mp3.mp4";
public static final String MP4_REMOTE_4K60_PORTRAIT_URI_STRING =
"https://storage.googleapis.com/exoplayer-test-media-1/mp4/portrait_4k60.mp4";
/** /**
* Transforms the {@code uriString} with the {@link Transformer}, saving a summary of the * Transforms the {@code uriString} with the {@link Transformer}, saving a summary of the
* transformation to the application cache. * transformation to the application cache.
......
/*
* Copyright 2021 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.android.exoplayer2.transformer.mh;
import static com.google.android.exoplayer2.transformer.AndroidTestUtil.MP4_ASSET_WITH_INCREASING_TIMESTAMPS_URI_STRING;
import static com.google.android.exoplayer2.transformer.AndroidTestUtil.runTransformer;
import android.content.Context;
import androidx.test.core.app.ApplicationProvider;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import com.google.android.exoplayer2.transformer.Transformer;
import org.junit.Test;
import org.junit.runner.RunWith;
/** {@link Transformer} instrumentation test for removing audio. */
@RunWith(AndroidJUnit4.class)
public class RemoveAudioTransformationTest {
private static final String TAG = "RemoveAudioTransformationTest";
@Test
public void removeAudioTransform() throws Exception {
Context context = ApplicationProvider.getApplicationContext();
Transformer transformer = new Transformer.Builder(context).setRemoveAudio(true).build();
runTransformer(
context,
/* testId= */ "removeAudioTransform",
transformer,
MP4_ASSET_WITH_INCREASING_TIMESTAMPS_URI_STRING,
/* timeoutSeconds= */ 120,
/* calculateSsim= */ false);
}
}
/*
* Copyright 2021 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.android.exoplayer2.transformer.mh;
import static com.google.android.exoplayer2.transformer.AndroidTestUtil.MP4_ASSET_URI_STRING;
import static com.google.android.exoplayer2.transformer.AndroidTestUtil.runTransformer;
import android.content.Context;
import androidx.test.core.app.ApplicationProvider;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import com.google.android.exoplayer2.transformer.Transformer;
import org.junit.Test;
import org.junit.runner.RunWith;
/** {@link Transformer} instrumentation test for removing video. */
@RunWith(AndroidJUnit4.class)
public class RemoveVideoTransformationTest {
@Test
public void removeVideoTransform() throws Exception {
Context context = ApplicationProvider.getApplicationContext();
Transformer transformer = new Transformer.Builder(context).setRemoveVideo(true).build();
runTransformer(
context,
/* testId= */ "removeVideoTransform",
transformer,
MP4_ASSET_URI_STRING,
/* timeoutSeconds= */ 120,
/* calculateSsim= */ false);
}
}
...@@ -61,7 +61,7 @@ public final class RepeatedTranscodeTransformationTest { ...@@ -61,7 +61,7 @@ public final class RepeatedTranscodeTransformationTest {
context, context,
/* testId= */ "repeatedTranscode_givesConsistentLengthOutput_" + i, /* testId= */ "repeatedTranscode_givesConsistentLengthOutput_" + i,
transformer, transformer,
AndroidTestUtil.REMOTE_MP4_10_SECONDS_H264_MP3_URI_STRING, AndroidTestUtil.MP4_REMOTE_H264_MP3_URI_STRING,
/* timeoutSeconds= */ 120, /* timeoutSeconds= */ 120,
/* calculateSsim= */ false); /* calculateSsim= */ false);
differentOutputSizesBytes.add(checkNotNull(testResult.transformationResult.fileSizeBytes)); differentOutputSizesBytes.add(checkNotNull(testResult.transformationResult.fileSizeBytes));
...@@ -96,7 +96,7 @@ public final class RepeatedTranscodeTransformationTest { ...@@ -96,7 +96,7 @@ public final class RepeatedTranscodeTransformationTest {
context, context,
/* testId= */ "repeatedTranscodeNoAudio_givesConsistentLengthOutput_" + i, /* testId= */ "repeatedTranscodeNoAudio_givesConsistentLengthOutput_" + i,
transformer, transformer,
AndroidTestUtil.REMOTE_MP4_10_SECONDS_H264_MP3_URI_STRING, AndroidTestUtil.MP4_REMOTE_H264_MP3_URI_STRING,
/* timeoutSeconds= */ 120, /* timeoutSeconds= */ 120,
/* calculateSsim= */ false); /* calculateSsim= */ false);
differentOutputSizesBytes.add(checkNotNull(testResult.transformationResult.fileSizeBytes)); differentOutputSizesBytes.add(checkNotNull(testResult.transformationResult.fileSizeBytes));
...@@ -126,7 +126,7 @@ public final class RepeatedTranscodeTransformationTest { ...@@ -126,7 +126,7 @@ public final class RepeatedTranscodeTransformationTest {
context, context,
/* testId= */ "repeatedTranscodeNoVideo_givesConsistentLengthOutput_" + i, /* testId= */ "repeatedTranscodeNoVideo_givesConsistentLengthOutput_" + i,
transformer, transformer,
AndroidTestUtil.REMOTE_MP4_10_SECONDS_H264_MP3_URI_STRING, AndroidTestUtil.MP4_REMOTE_H264_MP3_URI_STRING,
/* timeoutSeconds= */ 120, /* timeoutSeconds= */ 120,
/* calculateSsim= */ false); /* calculateSsim= */ false);
differentOutputSizesBytes.add(checkNotNull(testResult.transformationResult.fileSizeBytes)); differentOutputSizesBytes.add(checkNotNull(testResult.transformationResult.fileSizeBytes));
......
/*
* Copyright 2021 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.android.exoplayer2.transformer.mh;
import static com.google.android.exoplayer2.transformer.AndroidTestUtil.SEF_ASSET_URI_STRING;
import static com.google.android.exoplayer2.transformer.AndroidTestUtil.runTransformer;
import android.content.Context;
import androidx.test.core.app.ApplicationProvider;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import com.google.android.exoplayer2.transformer.TransformationRequest;
import com.google.android.exoplayer2.transformer.Transformer;
import com.google.android.exoplayer2.util.Log;
import com.google.android.exoplayer2.util.Util;
import org.junit.Test;
import org.junit.runner.RunWith;
/** {@link Transformer} instrumentation test for SEF. */
@RunWith(AndroidJUnit4.class)
public class SefTransformationTest {
private static final String TAG = "SefTransformationTest";
@Test
public void sefTransform() throws Exception {
if (Util.SDK_INT < 25) {
// TODO(b/210593256): Remove test skipping after removing the MediaMuxer dependency.
Log.i(TAG, "Skipping on this API version due to lack of muxing support");
return;
}
Context context = ApplicationProvider.getApplicationContext();
Transformer transformer =
new Transformer.Builder(context)
.setTransformationRequest(
new TransformationRequest.Builder().setFlattenForSlowMotion(true).build())
.build();
runTransformer(
context,
/* testId = */ "sefTransform",
transformer,
SEF_ASSET_URI_STRING,
/* timeoutSeconds= */ 120,
/* calculateSsim= */ false);
}
}
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
*/ */
package com.google.android.exoplayer2.transformer.mh; package com.google.android.exoplayer2.transformer.mh;
import static com.google.android.exoplayer2.transformer.AndroidTestUtil.REMOTE_MP4_10_SECONDS_URI_STRING; import static com.google.android.exoplayer2.transformer.AndroidTestUtil.MP4_REMOTE_10_SECONDS_URI_STRING;
import static com.google.android.exoplayer2.transformer.AndroidTestUtil.runTransformer; import static com.google.android.exoplayer2.transformer.AndroidTestUtil.runTransformer;
import android.content.Context; import android.content.Context;
...@@ -47,7 +47,7 @@ public class SetTransformationMatrixTransformationTest { ...@@ -47,7 +47,7 @@ public class SetTransformationMatrixTransformationTest {
context, context,
/* testId= */ "setTransformationMatrixTransform", /* testId= */ "setTransformationMatrixTransform",
transformer, transformer,
REMOTE_MP4_10_SECONDS_URI_STRING, MP4_REMOTE_10_SECONDS_URI_STRING,
/* timeoutSeconds= */ 120, /* timeoutSeconds= */ 120,
/* calculateSsim= */ false); /* calculateSsim= */ false);
} }
......
...@@ -15,17 +15,23 @@ ...@@ -15,17 +15,23 @@
*/ */
package com.google.android.exoplayer2.transformer.mh; 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_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_URI_STRING;
import static com.google.android.exoplayer2.transformer.AndroidTestUtil.runTransformer; import static com.google.android.exoplayer2.transformer.AndroidTestUtil.runTransformer;
import android.content.Context; import android.content.Context;
import androidx.test.core.app.ApplicationProvider; import androidx.test.core.app.ApplicationProvider;
import androidx.test.ext.junit.runners.AndroidJUnit4; import androidx.test.ext.junit.runners.AndroidJUnit4;
import com.google.android.exoplayer2.transformer.TransformationRequest;
import com.google.android.exoplayer2.transformer.Transformer; import com.google.android.exoplayer2.transformer.Transformer;
import com.google.android.exoplayer2.util.Log;
import com.google.android.exoplayer2.util.Util;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
/** {@link Transformer} instrumentation test. */ /** {@link Transformer} instrumentation tests. */
@RunWith(AndroidJUnit4.class) @RunWith(AndroidJUnit4.class)
public class TransformationTest { public class TransformationTest {
...@@ -33,14 +39,86 @@ public class TransformationTest { ...@@ -33,14 +39,86 @@ public class TransformationTest {
@Test @Test
public void transform() throws Exception { public void transform() throws Exception {
final String testId = TAG + "_transform";
Context context = ApplicationProvider.getApplicationContext();
Transformer transformer = new Transformer.Builder(context).build();
runTransformer(
context,
testId,
transformer,
MP4_ASSET_WITH_INCREASING_TIMESTAMPS_URI_STRING,
/* timeoutSeconds= */ 120,
/* calculateSsim= */ false);
}
@Test
public void transform4K60() throws Exception {
final String testId = TAG + "_transform4K60";
Context context = ApplicationProvider.getApplicationContext(); Context context = ApplicationProvider.getApplicationContext();
Transformer transformer = new Transformer.Builder(context).build(); Transformer transformer = new Transformer.Builder(context).build();
runTransformer( runTransformer(
context, context,
/* testId= */ "transform", testId,
transformer,
MP4_REMOTE_4K60_PORTRAIT_URI_STRING,
/* timeoutSeconds= */ 120,
/* calculateSsim= */ false);
}
@Test
public void transformNoAudio() throws Exception {
final String testId = TAG + "_transformNoAudio";
Context context = ApplicationProvider.getApplicationContext();
Transformer transformer = new Transformer.Builder(context).setRemoveAudio(true).build();
runTransformer(
context,
testId,
transformer, transformer,
MP4_ASSET_WITH_INCREASING_TIMESTAMPS_URI_STRING, MP4_ASSET_WITH_INCREASING_TIMESTAMPS_URI_STRING,
/* timeoutSeconds= */ 120, /* timeoutSeconds= */ 120,
/* calculateSsim= */ false); /* calculateSsim= */ false);
} }
@Test
public void transformNoVideo() throws Exception {
final String testId = TAG + "_transformNoVideo";
Context context = ApplicationProvider.getApplicationContext();
Transformer transformer = new Transformer.Builder(context).setRemoveVideo(true).build();
runTransformer(
context,
testId,
transformer,
MP4_ASSET_URI_STRING,
/* timeoutSeconds= */ 120,
/* calculateSsim= */ false);
}
@Test
public void transformSef() throws Exception {
final String testId = TAG + "_transformSef";
if (Util.SDK_INT < 25) {
// TODO(b/210593256): Remove test skipping after removing the MediaMuxer dependency.
Log.i(testId, "Skipping on this API version due to lack of muxing support");
return;
}
Context context = ApplicationProvider.getApplicationContext();
Transformer transformer =
new Transformer.Builder(context)
.setTransformationRequest(
new TransformationRequest.Builder().setFlattenForSlowMotion(true).build())
.build();
runTransformer(
context,
testId,
transformer,
MP4_ASSET_SEF_URI_STRING,
/* timeoutSeconds= */ 120,
/* calculateSsim= */ false);
}
} }
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