mirror of
https://github.com/samsonjs/media.git
synced 2026-04-01 10:35:48 +00:00
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
This commit is contained in:
parent
85512f66e6
commit
084bde2d91
7 changed files with 93 additions and 159 deletions
|
|
@ -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_WITH_INCREASING_TIMESTAMPS_URI_STRING =
|
||||
"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 REMOTE_MP4_10_SECONDS_URI_STRING =
|
||||
public static final String MP4_ASSET_SEF_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";
|
||||
/** 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 =
|
||||
/** Test clip transcoded from {@link #MP4_REMOTE_10_SECONDS_URI_STRING} with H264 and MP3. */
|
||||
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";
|
||||
|
||||
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
|
||||
* transformation to the application cache.
|
||||
|
|
|
|||
|
|
@ -1,46 +0,0 @@
|
|||
/*
|
||||
* 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);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,43 +0,0 @@
|
|||
/*
|
||||
* 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 {
|
|||
context,
|
||||
/* testId= */ "repeatedTranscode_givesConsistentLengthOutput_" + i,
|
||||
transformer,
|
||||
AndroidTestUtil.REMOTE_MP4_10_SECONDS_H264_MP3_URI_STRING,
|
||||
AndroidTestUtil.MP4_REMOTE_H264_MP3_URI_STRING,
|
||||
/* timeoutSeconds= */ 120,
|
||||
/* calculateSsim= */ false);
|
||||
differentOutputSizesBytes.add(checkNotNull(testResult.transformationResult.fileSizeBytes));
|
||||
|
|
@ -96,7 +96,7 @@ public final class RepeatedTranscodeTransformationTest {
|
|||
context,
|
||||
/* testId= */ "repeatedTranscodeNoAudio_givesConsistentLengthOutput_" + i,
|
||||
transformer,
|
||||
AndroidTestUtil.REMOTE_MP4_10_SECONDS_H264_MP3_URI_STRING,
|
||||
AndroidTestUtil.MP4_REMOTE_H264_MP3_URI_STRING,
|
||||
/* timeoutSeconds= */ 120,
|
||||
/* calculateSsim= */ false);
|
||||
differentOutputSizesBytes.add(checkNotNull(testResult.transformationResult.fileSizeBytes));
|
||||
|
|
@ -126,7 +126,7 @@ public final class RepeatedTranscodeTransformationTest {
|
|||
context,
|
||||
/* testId= */ "repeatedTranscodeNoVideo_givesConsistentLengthOutput_" + i,
|
||||
transformer,
|
||||
AndroidTestUtil.REMOTE_MP4_10_SECONDS_H264_MP3_URI_STRING,
|
||||
AndroidTestUtil.MP4_REMOTE_H264_MP3_URI_STRING,
|
||||
/* timeoutSeconds= */ 120,
|
||||
/* calculateSsim= */ false);
|
||||
differentOutputSizesBytes.add(checkNotNull(testResult.transformationResult.fileSizeBytes));
|
||||
|
|
|
|||
|
|
@ -1,59 +0,0 @@
|
|||
/*
|
||||
* 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 @@
|
|||
*/
|
||||
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 android.content.Context;
|
||||
|
|
@ -47,7 +47,7 @@ public class SetTransformationMatrixTransformationTest {
|
|||
context,
|
||||
/* testId= */ "setTransformationMatrixTransform",
|
||||
transformer,
|
||||
REMOTE_MP4_10_SECONDS_URI_STRING,
|
||||
MP4_REMOTE_10_SECONDS_URI_STRING,
|
||||
/* timeoutSeconds= */ 120,
|
||||
/* calculateSsim= */ false);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,17 +15,23 @@
|
|||
*/
|
||||
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_REMOTE_4K60_PORTRAIT_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. */
|
||||
/** {@link Transformer} instrumentation tests. */
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
public class TransformationTest {
|
||||
|
||||
|
|
@ -33,14 +39,86 @@ public class TransformationTest {
|
|||
|
||||
@Test
|
||||
public void transform() throws Exception {
|
||||
final String testId = TAG + "_transform";
|
||||
|
||||
Context context = ApplicationProvider.getApplicationContext();
|
||||
Transformer transformer = new Transformer.Builder(context).build();
|
||||
runTransformer(
|
||||
context,
|
||||
/* testId= */ "transform",
|
||||
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();
|
||||
Transformer transformer = new Transformer.Builder(context).build();
|
||||
runTransformer(
|
||||
context,
|
||||
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,
|
||||
MP4_ASSET_WITH_INCREASING_TIMESTAMPS_URI_STRING,
|
||||
/* timeoutSeconds= */ 120,
|
||||
/* 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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue