Commit 271cdbed by samrobinson Committed by Ian Baker

Force encoding for the on-device regression tests.

transformWithDecodeEncode is now transformWithoutDecodeEncode,
to test the passthrough path.

PiperOrigin-RevId: 447796892
parent 6ac1306e
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
*/ */
package com.google.android.exoplayer2.transformer.mh; package com.google.android.exoplayer2.transformer.mh;
import static com.google.android.exoplayer2.transformer.AndroidTestUtil.FORCE_ENCODE_ENCODER_FACTORY;
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;
...@@ -45,7 +46,10 @@ public class TransformationTest { ...@@ -45,7 +46,10 @@ public class TransformationTest {
public void transform() throws Exception { public void transform() throws Exception {
String testId = TAG + "_transform"; String testId = TAG + "_transform";
Context context = ApplicationProvider.getApplicationContext(); Context context = ApplicationProvider.getApplicationContext();
Transformer transformer = new Transformer.Builder(context).build(); Transformer transformer =
new Transformer.Builder(context)
.setEncoderFactory(AndroidTestUtil.FORCE_ENCODE_ENCODER_FACTORY)
.build();
new TransformerAndroidTestRunner.Builder(context, transformer) new TransformerAndroidTestRunner.Builder(context, transformer)
.setCalculateSsim(true) .setCalculateSsim(true)
.build() .build()
...@@ -53,15 +57,12 @@ public class TransformationTest { ...@@ -53,15 +57,12 @@ public class TransformationTest {
} }
@Test @Test
public void transformWithDecodeEncode() throws Exception { public void transformWithoutDecodeEncode() throws Exception {
String testId = TAG + "_transformWithDecodeEncode"; String testId = TAG + "_transformWithoutDecodeEncode";
Context context = ApplicationProvider.getApplicationContext(); Context context = ApplicationProvider.getApplicationContext();
Transformer transformer = Transformer transformer = new Transformer.Builder(context).build();
new Transformer.Builder(context) // No need to calculate SSIM because no decode/encoding, so input frames match output frames.
.setEncoderFactory(AndroidTestUtil.FORCE_ENCODE_ENCODER_FACTORY)
.build();
new TransformerAndroidTestRunner.Builder(context, transformer) new TransformerAndroidTestRunner.Builder(context, transformer)
.setCalculateSsim(true)
.build() .build()
.run(testId, MP4_ASSET_WITH_INCREASING_TIMESTAMPS_URI_STRING); .run(testId, MP4_ASSET_WITH_INCREASING_TIMESTAMPS_URI_STRING);
} }
...@@ -89,7 +90,8 @@ public class TransformationTest { ...@@ -89,7 +90,8 @@ 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();
Transformer transformer = new Transformer.Builder(context).build(); Transformer transformer =
new Transformer.Builder(context).setEncoderFactory(FORCE_ENCODE_ENCODER_FACTORY).build();
new TransformerAndroidTestRunner.Builder(context, transformer) new TransformerAndroidTestRunner.Builder(context, transformer)
.setCalculateSsim(true) .setCalculateSsim(true)
.build() .build()
...@@ -100,7 +102,11 @@ public class TransformationTest { ...@@ -100,7 +102,11 @@ public class TransformationTest {
public void transformNoAudio() throws Exception { public void transformNoAudio() throws Exception {
String testId = TAG + "_transformNoAudio"; String testId = TAG + "_transformNoAudio";
Context context = ApplicationProvider.getApplicationContext(); Context context = ApplicationProvider.getApplicationContext();
Transformer transformer = new Transformer.Builder(context).setRemoveAudio(true).build(); Transformer transformer =
new Transformer.Builder(context)
.setEncoderFactory(FORCE_ENCODE_ENCODER_FACTORY)
.setRemoveAudio(true)
.build();
new TransformerAndroidTestRunner.Builder(context, transformer) new TransformerAndroidTestRunner.Builder(context, transformer)
.setCalculateSsim(true) .setCalculateSsim(true)
.build() .build()
...@@ -111,7 +117,11 @@ public class TransformationTest { ...@@ -111,7 +117,11 @@ public class TransformationTest {
public void transformNoVideo() throws Exception { public void transformNoVideo() throws Exception {
String testId = TAG + "_transformNoVideo"; String testId = TAG + "_transformNoVideo";
Context context = ApplicationProvider.getApplicationContext(); Context context = ApplicationProvider.getApplicationContext();
Transformer transformer = new Transformer.Builder(context).setRemoveVideo(true).build(); Transformer transformer =
new Transformer.Builder(context)
.setEncoderFactory(FORCE_ENCODE_ENCODER_FACTORY)
.setRemoveVideo(true)
.build();
new TransformerAndroidTestRunner.Builder(context, transformer) new TransformerAndroidTestRunner.Builder(context, transformer)
.build() .build()
.run(testId, MP4_ASSET_URI_STRING); .run(testId, MP4_ASSET_URI_STRING);
......
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