Commit 0316c033 by samrobinson Committed by Ian Baker

Move AndroidTestUtil run methods to a TransformerAndroidTestRunner.

This will allow for easier customisation of the additional tasks
performed by the test runner, such as calculating metrics like SSIM.

PiperOrigin-RevId: 432434850
parent 8e98187a
...@@ -15,27 +15,11 @@ ...@@ -15,27 +15,11 @@
*/ */
package androidx.media3.transformer; package androidx.media3.transformer;
import static androidx.media3.common.util.Assertions.checkNotNull;
import static androidx.media3.common.util.Assertions.checkState; import static androidx.media3.common.util.Assertions.checkState;
import static java.util.concurrent.TimeUnit.SECONDS;
import android.content.Context; import android.content.Context;
import android.net.Uri;
import android.os.Build;
import androidx.annotation.Nullable;
import androidx.media3.common.C;
import androidx.media3.common.MediaItem;
import androidx.media3.common.util.Log;
import androidx.test.platform.app.InstrumentationRegistry;
import java.io.File; import java.io.File;
import java.io.FileWriter;
import java.io.IOException; import java.io.IOException;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicReference;
import org.checkerframework.checker.nullness.compatqual.NullableType;
import org.json.JSONException;
import org.json.JSONObject;
/** Utilities for instrumentation tests. */ /** Utilities for instrumentation tests. */
public final class AndroidTestUtil { public final class AndroidTestUtil {
...@@ -52,192 +36,13 @@ public final class AndroidTestUtil { ...@@ -52,192 +36,13 @@ public final class AndroidTestUtil {
public static final String MP4_REMOTE_4K60_PORTRAIT_URI_STRING = public static final String MP4_REMOTE_4K60_PORTRAIT_URI_STRING =
"https://storage.googleapis.com/exoplayer-test-media-1/mp4/portrait_4k60.mp4"; "https://storage.googleapis.com/exoplayer-test-media-1/mp4/portrait_4k60.mp4";
/* package */ static File createExternalCacheFile(Context context, String fileName)
/** throws IOException {
* Transforms the {@code uriString} with the {@link Transformer}, saving a summary of the
* transformation to the application cache.
*
* @param context The {@link Context}.
* @param testId An identifier for the test.
* @param transformer The {@link Transformer} that performs the transformation.
* @param uriString The uri (as a {@link String}) that will be transformed.
* @param timeoutSeconds The transformer timeout. An exception is thrown if this is exceeded.
* @param calculateSsim Whether to include SSIM in the {@link TestTransformationResult}. The
* calculation involves decoding and comparing both the input and the output video.
* Consequently this calculation is not cost-free. Requires the input and output video to be
* the same size.
* @return The {@link TestTransformationResult}.
* @throws Exception The cause of the transformation not completing.
*/
public static TestTransformationResult runTransformer(
Context context,
String testId,
Transformer transformer,
String uriString,
int timeoutSeconds,
boolean calculateSsim)
throws Exception {
JSONObject resultJson = new JSONObject();
try {
TestTransformationResult testTransformationResult =
runTransformerInternal(
context, testId, transformer, uriString, timeoutSeconds, calculateSsim);
resultJson.put(
"transformationResult",
getTransformationResultJson(testTransformationResult.transformationResult));
if (testTransformationResult.ssim != TestTransformationResult.SSIM_UNSET) {
resultJson.put("ssim", testTransformationResult.ssim);
}
return testTransformationResult;
} catch (Exception e) {
resultJson.put("exception", getExceptionJson(e));
throw e;
} finally {
writeTestSummaryToFile(context, testId, resultJson);
}
}
private static TestTransformationResult runTransformerInternal(
Context context,
String testId,
Transformer transformer,
String uriString,
int timeoutSeconds,
boolean calculateSsim)
throws Exception {
AtomicReference<@NullableType TransformationException> transformationExceptionReference =
new AtomicReference<>();
AtomicReference<@NullableType Exception> unexpectedExceptionReference = new AtomicReference<>();
AtomicReference<@NullableType TransformationResult> transformationResultReference =
new AtomicReference<>();
CountDownLatch countDownLatch = new CountDownLatch(1);
Transformer testTransformer =
transformer
.buildUpon()
.addListener(
new Transformer.Listener() {
@Override
public void onTransformationCompleted(
MediaItem inputMediaItem, TransformationResult result) {
transformationResultReference.set(result);
countDownLatch.countDown();
}
@Override
public void onTransformationError(
MediaItem inputMediaItem, TransformationException exception) {
transformationExceptionReference.set(exception);
countDownLatch.countDown();
}
})
.build();
Uri uri = Uri.parse(uriString);
File outputVideoFile = createExternalCacheFile(context, /* fileName= */ testId + "-output.mp4");
InstrumentationRegistry.getInstrumentation()
.runOnMainSync(
() -> {
try {
testTransformer.startTransformation(
MediaItem.fromUri(uri), outputVideoFile.getAbsolutePath());
// Catch all exceptions to report. Exceptions thrown here and not caught will NOT
// propagate.
} catch (Exception e) {
unexpectedExceptionReference.set(e);
countDownLatch.countDown();
}
});
if (!countDownLatch.await(timeoutSeconds, SECONDS)) {
throw new TimeoutException("Transformer timed out after " + timeoutSeconds + " seconds.");
}
@Nullable Exception unexpectedException = unexpectedExceptionReference.get();
if (unexpectedException != null) {
throw unexpectedException;
}
@Nullable
TransformationException transformationException = transformationExceptionReference.get();
if (transformationException != null) {
throw transformationException;
}
// If both exceptions are null, the Transformation must have succeeded, and a
// transformationResult will be available.
TransformationResult transformationResult =
checkNotNull(transformationResultReference.get())
.buildUpon()
.setFileSizeBytes(outputVideoFile.length())
.build();
if (calculateSsim) {
return new TestTransformationResult(
transformationResult,
outputVideoFile.getPath(),
SsimHelper.calculate(
context, /* expectedVideoPath= */ uriString, outputVideoFile.getPath()));
} else {
return new TestTransformationResult(transformationResult, outputVideoFile.getPath());
}
}
private static void writeTestSummaryToFile(Context context, String testId, JSONObject resultJson)
throws IOException, JSONException {
resultJson.put("testId", testId).put("device", getDeviceJson());
String analysisContents = resultJson.toString(/* indentSpaces= */ 2);
// Log contents as well as writing to file, for easier visibility on individual device testing.
Log.i("TransformerAndroidTest_" + testId, analysisContents);
File analysisFile = createExternalCacheFile(context, /* fileName= */ testId + "-result.txt");
try (FileWriter fileWriter = new FileWriter(analysisFile)) {
fileWriter.write(analysisContents);
}
}
private static File createExternalCacheFile(Context context, String fileName) throws IOException {
File file = new File(context.getExternalCacheDir(), fileName); File file = new File(context.getExternalCacheDir(), fileName);
checkState(!file.exists() || file.delete(), "Could not delete file: " + file.getAbsolutePath()); checkState(!file.exists() || file.delete(), "Could not delete file: " + file.getAbsolutePath());
checkState(file.createNewFile(), "Could not create file: " + file.getAbsolutePath()); checkState(file.createNewFile(), "Could not create file: " + file.getAbsolutePath());
return file; return file;
} }
private static JSONObject getDeviceJson() throws JSONException {
return new JSONObject()
.put("manufacturer", Build.MANUFACTURER)
.put("model", Build.MODEL)
.put("sdkVersion", Build.VERSION.SDK_INT)
.put("fingerprint", Build.FINGERPRINT);
}
private static JSONObject getTransformationResultJson(TransformationResult transformationResult)
throws JSONException {
JSONObject transformationResultJson = new JSONObject();
if (transformationResult.fileSizeBytes != C.LENGTH_UNSET) {
transformationResultJson.put("fileSizeBytes", transformationResult.fileSizeBytes);
}
if (transformationResult.averageAudioBitrate != C.RATE_UNSET_INT) {
transformationResultJson.put("averageAudioBitrate", transformationResult.averageAudioBitrate);
}
if (transformationResult.averageVideoBitrate != C.RATE_UNSET_INT) {
transformationResultJson.put("averageVideoBitrate", transformationResult.averageVideoBitrate);
}
return transformationResultJson;
}
private static JSONObject getExceptionJson(Exception exception) throws JSONException {
JSONObject exceptionJson = new JSONObject();
exceptionJson.put("message", exception.getMessage());
exceptionJson.put("type", exception.getClass());
if (exception instanceof TransformationException) {
exceptionJson.put("errorCode", ((TransformationException) exception).errorCode);
}
exceptionJson.put("stackTrace", Log.getThrowableString(exception));
return exceptionJson;
}
private AndroidTestUtil() {} private AndroidTestUtil() {}
} }
...@@ -15,8 +15,8 @@ ...@@ -15,8 +15,8 @@
*/ */
package androidx.media3.transformer; package androidx.media3.transformer;
/** A test only class for holding additional details alongside a {@link TransformationResult}. */ /** A test only class for holding the details of a test transformation. */
public class TestTransformationResult { public class TransformationTestResult {
/** Represents an unset or unknown SSIM score. */ /** Represents an unset or unknown SSIM score. */
public static final double SSIM_UNSET = -1.0d; public static final double SSIM_UNSET = -1.0d;
...@@ -25,11 +25,11 @@ public class TestTransformationResult { ...@@ -25,11 +25,11 @@ public class TestTransformationResult {
/** The SSIM score of the transformation, {@link #SSIM_UNSET} if unavailable. */ /** The SSIM score of the transformation, {@link #SSIM_UNSET} if unavailable. */
public final double ssim; public final double ssim;
public TestTransformationResult(TransformationResult transformationResult, String filePath) { public TransformationTestResult(TransformationResult transformationResult, String filePath) {
this(transformationResult, filePath, /* ssim= */ SSIM_UNSET); this(transformationResult, filePath, /* ssim= */ SSIM_UNSET);
} }
public TestTransformationResult( public TransformationTestResult(
TransformationResult transformationResult, String filePath, double ssim) { TransformationResult transformationResult, String filePath, double ssim) {
this.transformationResult = transformationResult; this.transformationResult = transformationResult;
this.filePath = filePath; this.filePath = filePath;
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
package androidx.media3.transformer; package androidx.media3.transformer;
import static androidx.media3.common.util.Assertions.checkNotNull; import static androidx.media3.common.util.Assertions.checkNotNull;
import static androidx.media3.transformer.AndroidTestUtil.runTransformer;
import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat;
import android.content.Context; import android.content.Context;
...@@ -54,13 +53,11 @@ public class TransformerEndToEndTest { ...@@ -54,13 +53,11 @@ public class TransformerEndToEndTest {
// ffprobe -count_frames -select_streams v:0 -show_entries stream=nb_read_frames bear-vp9.webm // ffprobe -count_frames -select_streams v:0 -show_entries stream=nb_read_frames bear-vp9.webm
int expectedFrameCount = 82; int expectedFrameCount = 82;
runTransformer( new TransformerAndroidTestRunner.Builder(context, transformer)
context, .build()
.run(
/* testId= */ "videoTranscoding_completesWithConsistentFrameCount", /* testId= */ "videoTranscoding_completesWithConsistentFrameCount",
transformer, VP9_VIDEO_URI_STRING);
VP9_VIDEO_URI_STRING,
/* timeoutSeconds= */ 120,
/* calculateSsim= */ false);
FrameCountingMuxer frameCountingMuxer = FrameCountingMuxer frameCountingMuxer =
checkNotNull(muxerFactory.getLastFrameCountingMuxerCreated()); checkNotNull(muxerFactory.getLastFrameCountingMuxerCreated());
...@@ -88,13 +85,9 @@ public class TransformerEndToEndTest { ...@@ -88,13 +85,9 @@ public class TransformerEndToEndTest {
// ffprobe -count_frames -select_streams v:0 -show_entries stream=nb_read_frames sample.mp4 // ffprobe -count_frames -select_streams v:0 -show_entries stream=nb_read_frames sample.mp4
int expectedFrameCount = 30; int expectedFrameCount = 30;
runTransformer( new TransformerAndroidTestRunner.Builder(context, transformer)
context, .build()
/* testId= */ "videoEditing_completesWithConsistentFrameCount", .run(/* testId= */ "videoEditing_completesWithConsistentFrameCount", AVC_VIDEO_URI_STRING);
transformer,
AVC_VIDEO_URI_STRING,
/* timeoutSeconds= */ 120,
/* calculateSsim= */ false);
FrameCountingMuxer frameCountingMuxer = FrameCountingMuxer frameCountingMuxer =
checkNotNull(muxerFactory.getLastFrameCountingMuxerCreated()); checkNotNull(muxerFactory.getLastFrameCountingMuxerCreated());
......
...@@ -16,16 +16,16 @@ ...@@ -16,16 +16,16 @@
package androidx.media3.transformer.mh; package androidx.media3.transformer.mh;
import static androidx.media3.common.util.Assertions.checkNotNull; import static androidx.media3.common.util.Assertions.checkNotNull;
import static androidx.media3.transformer.AndroidTestUtil.runTransformer;
import static com.google.common.truth.Truth.assertWithMessage; import static com.google.common.truth.Truth.assertWithMessage;
import android.content.Context; import android.content.Context;
import android.graphics.Matrix; import android.graphics.Matrix;
import androidx.media3.common.MimeTypes; import androidx.media3.common.MimeTypes;
import androidx.media3.transformer.AndroidTestUtil; import androidx.media3.transformer.AndroidTestUtil;
import androidx.media3.transformer.TestTransformationResult;
import androidx.media3.transformer.TransformationRequest; import androidx.media3.transformer.TransformationRequest;
import androidx.media3.transformer.TransformationTestResult;
import androidx.media3.transformer.Transformer; import androidx.media3.transformer.Transformer;
import androidx.media3.transformer.TransformerAndroidTestRunner;
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 java.util.HashSet; import java.util.HashSet;
...@@ -56,14 +56,12 @@ public final class RepeatedTranscodeTransformationTest { ...@@ -56,14 +56,12 @@ public final class RepeatedTranscodeTransformationTest {
Set<Long> differentOutputSizesBytes = new HashSet<>(); Set<Long> differentOutputSizesBytes = new HashSet<>();
for (int i = 0; i < TRANSCODE_COUNT; i++) { for (int i = 0; i < TRANSCODE_COUNT; i++) {
// Use a long video in case an error occurs a while after the start of the video. // Use a long video in case an error occurs a while after the start of the video.
TestTransformationResult testResult = TransformationTestResult testResult =
runTransformer( new TransformerAndroidTestRunner.Builder(context, transformer)
context, .build()
.run(
/* testId= */ "repeatedTranscode_givesConsistentLengthOutput_" + i, /* testId= */ "repeatedTranscode_givesConsistentLengthOutput_" + i,
transformer, AndroidTestUtil.MP4_REMOTE_H264_MP3_URI_STRING);
AndroidTestUtil.MP4_REMOTE_H264_MP3_URI_STRING,
/* timeoutSeconds= */ 120,
/* calculateSsim= */ false);
differentOutputSizesBytes.add(checkNotNull(testResult.transformationResult.fileSizeBytes)); differentOutputSizesBytes.add(checkNotNull(testResult.transformationResult.fileSizeBytes));
} }
...@@ -91,14 +89,12 @@ public final class RepeatedTranscodeTransformationTest { ...@@ -91,14 +89,12 @@ public final class RepeatedTranscodeTransformationTest {
Set<Long> differentOutputSizesBytes = new HashSet<>(); Set<Long> differentOutputSizesBytes = new HashSet<>();
for (int i = 0; i < TRANSCODE_COUNT; i++) { for (int i = 0; i < TRANSCODE_COUNT; i++) {
// Use a long video in case an error occurs a while after the start of the video. // Use a long video in case an error occurs a while after the start of the video.
TestTransformationResult testResult = TransformationTestResult testResult =
runTransformer( new TransformerAndroidTestRunner.Builder(context, transformer)
context, .build()
.run(
/* testId= */ "repeatedTranscodeNoAudio_givesConsistentLengthOutput_" + i, /* testId= */ "repeatedTranscodeNoAudio_givesConsistentLengthOutput_" + i,
transformer, AndroidTestUtil.MP4_REMOTE_H264_MP3_URI_STRING);
AndroidTestUtil.MP4_REMOTE_H264_MP3_URI_STRING,
/* timeoutSeconds= */ 120,
/* calculateSsim= */ false);
differentOutputSizesBytes.add(checkNotNull(testResult.transformationResult.fileSizeBytes)); differentOutputSizesBytes.add(checkNotNull(testResult.transformationResult.fileSizeBytes));
} }
...@@ -121,14 +117,12 @@ public final class RepeatedTranscodeTransformationTest { ...@@ -121,14 +117,12 @@ public final class RepeatedTranscodeTransformationTest {
Set<Long> differentOutputSizesBytes = new HashSet<>(); Set<Long> differentOutputSizesBytes = new HashSet<>();
for (int i = 0; i < TRANSCODE_COUNT; i++) { for (int i = 0; i < TRANSCODE_COUNT; i++) {
// Use a long video in case an error occurs a while after the start of the video. // Use a long video in case an error occurs a while after the start of the video.
TestTransformationResult testResult = TransformationTestResult testResult =
runTransformer( new TransformerAndroidTestRunner.Builder(context, transformer)
context, .build()
.run(
/* testId= */ "repeatedTranscodeNoVideo_givesConsistentLengthOutput_" + i, /* testId= */ "repeatedTranscodeNoVideo_givesConsistentLengthOutput_" + i,
transformer, AndroidTestUtil.MP4_REMOTE_H264_MP3_URI_STRING);
AndroidTestUtil.MP4_REMOTE_H264_MP3_URI_STRING,
/* timeoutSeconds= */ 120,
/* calculateSsim= */ false);
differentOutputSizesBytes.add(checkNotNull(testResult.transformationResult.fileSizeBytes)); differentOutputSizesBytes.add(checkNotNull(testResult.transformationResult.fileSizeBytes));
} }
......
...@@ -16,12 +16,12 @@ ...@@ -16,12 +16,12 @@
package androidx.media3.transformer.mh; package androidx.media3.transformer.mh;
import static androidx.media3.transformer.AndroidTestUtil.MP4_ASSET_WITH_INCREASING_TIMESTAMPS_URI_STRING; import static androidx.media3.transformer.AndroidTestUtil.MP4_ASSET_WITH_INCREASING_TIMESTAMPS_URI_STRING;
import static androidx.media3.transformer.AndroidTestUtil.runTransformer;
import android.content.Context; import android.content.Context;
import android.graphics.Matrix; import android.graphics.Matrix;
import androidx.media3.transformer.TransformationRequest; import androidx.media3.transformer.TransformationRequest;
import androidx.media3.transformer.Transformer; import androidx.media3.transformer.Transformer;
import androidx.media3.transformer.TransformerAndroidTestRunner;
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 org.junit.Test; import org.junit.Test;
...@@ -43,12 +43,10 @@ public class SetTransformationMatrixTransformationTest { ...@@ -43,12 +43,10 @@ public class SetTransformationMatrixTransformationTest {
.build()) .build())
.build(); .build();
runTransformer( new TransformerAndroidTestRunner.Builder(context, transformer)
context, .build()
.run(
/* testId= */ "setTransformationMatrixTransform", /* testId= */ "setTransformationMatrixTransform",
transformer, MP4_ASSET_WITH_INCREASING_TIMESTAMPS_URI_STRING);
MP4_ASSET_WITH_INCREASING_TIMESTAMPS_URI_STRING,
/* timeoutSeconds= */ 120,
/* calculateSsim= */ false);
} }
} }
...@@ -16,15 +16,15 @@ ...@@ -16,15 +16,15 @@
package androidx.media3.transformer.mh; package androidx.media3.transformer.mh;
import static androidx.media3.transformer.AndroidTestUtil.runTransformer;
import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat;
import android.content.Context; import android.content.Context;
import androidx.media3.common.MimeTypes; import androidx.media3.common.MimeTypes;
import androidx.media3.transformer.AndroidTestUtil; import androidx.media3.transformer.AndroidTestUtil;
import androidx.media3.transformer.TestTransformationResult;
import androidx.media3.transformer.TransformationRequest; import androidx.media3.transformer.TransformationRequest;
import androidx.media3.transformer.TransformationTestResult;
import androidx.media3.transformer.Transformer; import androidx.media3.transformer.Transformer;
import androidx.media3.transformer.TransformerAndroidTestRunner;
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 org.junit.Test; import org.junit.Test;
...@@ -45,14 +45,11 @@ public final class TranscodeQualityTest { ...@@ -45,14 +45,11 @@ public final class TranscodeQualityTest {
.build()) .build())
.build(); .build();
TestTransformationResult result = TransformationTestResult result =
runTransformer( new TransformerAndroidTestRunner.Builder(context, transformer)
context, .setCalculateSsim(true)
/* testId= */ "singleTranscode_ssim", .build()
transformer, .run(/* testId= */ "singleTranscode_ssim", AndroidTestUtil.MP4_ASSET_URI_STRING);
AndroidTestUtil.MP4_ASSET_URI_STRING,
/* timeoutSeconds= */ 120,
/* calculateSsim= */ true);
assertThat(result.ssim).isGreaterThan(0.95); assertThat(result.ssim).isGreaterThan(0.95);
} }
......
...@@ -19,13 +19,13 @@ import static androidx.media3.transformer.AndroidTestUtil.MP4_ASSET_SEF_URI_STRI ...@@ -19,13 +19,13 @@ import static androidx.media3.transformer.AndroidTestUtil.MP4_ASSET_SEF_URI_STRI
import static androidx.media3.transformer.AndroidTestUtil.MP4_ASSET_URI_STRING; import static androidx.media3.transformer.AndroidTestUtil.MP4_ASSET_URI_STRING;
import static androidx.media3.transformer.AndroidTestUtil.MP4_ASSET_WITH_INCREASING_TIMESTAMPS_URI_STRING; import static androidx.media3.transformer.AndroidTestUtil.MP4_ASSET_WITH_INCREASING_TIMESTAMPS_URI_STRING;
import static androidx.media3.transformer.AndroidTestUtil.MP4_REMOTE_4K60_PORTRAIT_URI_STRING; import static androidx.media3.transformer.AndroidTestUtil.MP4_REMOTE_4K60_PORTRAIT_URI_STRING;
import static androidx.media3.transformer.AndroidTestUtil.runTransformer;
import android.content.Context; import android.content.Context;
import androidx.media3.common.util.Log; import androidx.media3.common.util.Log;
import androidx.media3.common.util.Util; import androidx.media3.common.util.Util;
import androidx.media3.transformer.TransformationRequest; import androidx.media3.transformer.TransformationRequest;
import androidx.media3.transformer.Transformer; import androidx.media3.transformer.Transformer;
import androidx.media3.transformer.TransformerAndroidTestRunner;
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 org.junit.Test; import org.junit.Test;
...@@ -43,13 +43,10 @@ public class TransformationTest { ...@@ -43,13 +43,10 @@ public class TransformationTest {
Context context = ApplicationProvider.getApplicationContext(); Context context = ApplicationProvider.getApplicationContext();
Transformer transformer = new Transformer.Builder(context).build(); Transformer transformer = new Transformer.Builder(context).build();
runTransformer( new TransformerAndroidTestRunner.Builder(context, transformer)
context, .setCalculateSsim(true)
testId, .build()
transformer, .run(testId, MP4_ASSET_WITH_INCREASING_TIMESTAMPS_URI_STRING);
MP4_ASSET_WITH_INCREASING_TIMESTAMPS_URI_STRING,
/* timeoutSeconds= */ 120,
/* calculateSsim= */ false);
} }
@Test @Test
...@@ -58,13 +55,10 @@ public class TransformationTest { ...@@ -58,13 +55,10 @@ public class TransformationTest {
Context context = ApplicationProvider.getApplicationContext(); Context context = ApplicationProvider.getApplicationContext();
Transformer transformer = new Transformer.Builder(context).build(); Transformer transformer = new Transformer.Builder(context).build();
runTransformer( new TransformerAndroidTestRunner.Builder(context, transformer)
context, .setCalculateSsim(true)
testId, .build()
transformer, .run(testId, MP4_REMOTE_4K60_PORTRAIT_URI_STRING);
MP4_REMOTE_4K60_PORTRAIT_URI_STRING,
/* timeoutSeconds= */ 120,
/* calculateSsim= */ false);
} }
@Test @Test
...@@ -73,13 +67,10 @@ public class TransformationTest { ...@@ -73,13 +67,10 @@ public class TransformationTest {
Context context = ApplicationProvider.getApplicationContext(); Context context = ApplicationProvider.getApplicationContext();
Transformer transformer = new Transformer.Builder(context).setRemoveAudio(true).build(); Transformer transformer = new Transformer.Builder(context).setRemoveAudio(true).build();
runTransformer( new TransformerAndroidTestRunner.Builder(context, transformer)
context, .setCalculateSsim(true)
testId, .build()
transformer, .run(testId, MP4_ASSET_WITH_INCREASING_TIMESTAMPS_URI_STRING);
MP4_ASSET_WITH_INCREASING_TIMESTAMPS_URI_STRING,
/* timeoutSeconds= */ 120,
/* calculateSsim= */ false);
} }
@Test @Test
...@@ -88,13 +79,10 @@ public class TransformationTest { ...@@ -88,13 +79,10 @@ public class TransformationTest {
Context context = ApplicationProvider.getApplicationContext(); Context context = ApplicationProvider.getApplicationContext();
Transformer transformer = new Transformer.Builder(context).setRemoveVideo(true).build(); Transformer transformer = new Transformer.Builder(context).setRemoveVideo(true).build();
runTransformer( new TransformerAndroidTestRunner.Builder(context, transformer)
context, .setCalculateSsim(true)
testId, .build()
transformer, .run(testId, MP4_ASSET_URI_STRING);
MP4_ASSET_URI_STRING,
/* timeoutSeconds= */ 120,
/* calculateSsim= */ false);
} }
@Test @Test
...@@ -113,12 +101,9 @@ public class TransformationTest { ...@@ -113,12 +101,9 @@ public class TransformationTest {
.setTransformationRequest( .setTransformationRequest(
new TransformationRequest.Builder().setFlattenForSlowMotion(true).build()) new TransformationRequest.Builder().setFlattenForSlowMotion(true).build())
.build(); .build();
runTransformer( new TransformerAndroidTestRunner.Builder(context, transformer)
context, .setCalculateSsim(true)
testId, .build()
transformer, .run(testId, MP4_ASSET_SEF_URI_STRING);
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