mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00
Do not record test skipped for tests skipped on emulator
AndroiTestUtil.recordTestSkipped is useful for MH tests PiperOrigin-RevId: 726397349
This commit is contained in:
parent
56bd32da96
commit
cea67e8826
@ -23,10 +23,10 @@ import static androidx.media3.common.util.Util.isRunningOnEmulator;
|
|||||||
import static androidx.media3.common.util.Util.usToMs;
|
import static androidx.media3.common.util.Util.usToMs;
|
||||||
import static androidx.media3.transformer.AndroidTestUtil.MP4_ASSET;
|
import static androidx.media3.transformer.AndroidTestUtil.MP4_ASSET;
|
||||||
import static androidx.media3.transformer.AndroidTestUtil.PNG_ASSET;
|
import static androidx.media3.transformer.AndroidTestUtil.PNG_ASSET;
|
||||||
import static androidx.media3.transformer.AndroidTestUtil.recordTestSkipped;
|
|
||||||
import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation;
|
import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation;
|
||||||
import static com.google.common.truth.Truth.assertThat;
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
import static java.util.concurrent.TimeUnit.MILLISECONDS;
|
import static java.util.concurrent.TimeUnit.MILLISECONDS;
|
||||||
|
import static org.junit.Assume.assumeFalse;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import androidx.media3.common.Effect;
|
import androidx.media3.common.Effect;
|
||||||
@ -43,19 +43,13 @@ import java.util.concurrent.TimeoutException;
|
|||||||
import java.util.concurrent.atomic.AtomicReference;
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.AssumptionViolatedException;
|
|
||||||
import org.junit.Before;
|
|
||||||
import org.junit.Rule;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.rules.TestName;
|
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
|
||||||
/** Playback tests for {@link CompositionPlayer} */
|
/** Playback tests for {@link CompositionPlayer} */
|
||||||
@RunWith(AndroidJUnit4.class)
|
@RunWith(AndroidJUnit4.class)
|
||||||
public class CompositionPlaybackTest {
|
public class CompositionPlaybackTest {
|
||||||
|
|
||||||
@Rule public final TestName testName = new TestName();
|
|
||||||
|
|
||||||
private static final long TEST_TIMEOUT_MS = isRunningOnEmulator() ? 20_000 : 10_000;
|
private static final long TEST_TIMEOUT_MS = isRunningOnEmulator() ? 20_000 : 10_000;
|
||||||
private static final MediaItem VIDEO_MEDIA_ITEM = MediaItem.fromUri(MP4_ASSET.uri);
|
private static final MediaItem VIDEO_MEDIA_ITEM = MediaItem.fromUri(MP4_ASSET.uri);
|
||||||
private static final long VIDEO_DURATION_US = MP4_ASSET.videoDurationUs;
|
private static final long VIDEO_DURATION_US = MP4_ASSET.videoDurationUs;
|
||||||
@ -73,14 +67,8 @@ public class CompositionPlaybackTest {
|
|||||||
private final Context context = getInstrumentation().getContext().getApplicationContext();
|
private final Context context = getInstrumentation().getContext().getApplicationContext();
|
||||||
private final PlayerTestListener playerTestListener = new PlayerTestListener(TEST_TIMEOUT_MS);
|
private final PlayerTestListener playerTestListener = new PlayerTestListener(TEST_TIMEOUT_MS);
|
||||||
|
|
||||||
private String testId;
|
|
||||||
private @MonotonicNonNull CompositionPlayer player;
|
private @MonotonicNonNull CompositionPlayer player;
|
||||||
|
|
||||||
@Before
|
|
||||||
public void setUp() {
|
|
||||||
testId = testName.getMethodName();
|
|
||||||
}
|
|
||||||
|
|
||||||
@After
|
@After
|
||||||
public void tearDown() {
|
public void tearDown() {
|
||||||
getInstrumentation()
|
getInstrumentation()
|
||||||
@ -222,12 +210,9 @@ public class CompositionPlaybackTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void playback_sequenceOfImageAndVideo_effectsReceiveCorrectTimestamps() throws Exception {
|
public void playback_sequenceOfImageAndVideo_effectsReceiveCorrectTimestamps() throws Exception {
|
||||||
if (isRunningOnEmulator()) {
|
|
||||||
// The MediaCodec decoder's output surface is sometimes dropping frames on emulator despite
|
// The MediaCodec decoder's output surface is sometimes dropping frames on emulator despite
|
||||||
// using MediaFormat.KEY_ALLOW_FRAME_DROP.
|
// using MediaFormat.KEY_ALLOW_FRAME_DROP.
|
||||||
recordTestSkipped(context, testId, /* reason= */ "Skipped due to surface dropping frames");
|
assumeFalse("Skipped on emulator due to surface dropping frames", isRunningOnEmulator());
|
||||||
throw new AssumptionViolatedException("Skipped due to surface dropping frames");
|
|
||||||
}
|
|
||||||
InputTimestampRecordingShaderProgram inputTimestampRecordingShaderProgram =
|
InputTimestampRecordingShaderProgram inputTimestampRecordingShaderProgram =
|
||||||
new InputTimestampRecordingShaderProgram();
|
new InputTimestampRecordingShaderProgram();
|
||||||
Effect videoEffect = (GlEffect) (context, useHdr) -> inputTimestampRecordingShaderProgram;
|
Effect videoEffect = (GlEffect) (context, useHdr) -> inputTimestampRecordingShaderProgram;
|
||||||
|
@ -20,7 +20,6 @@ import static androidx.media3.common.util.Util.isRunningOnEmulator;
|
|||||||
import static androidx.media3.common.util.Util.usToMs;
|
import static androidx.media3.common.util.Util.usToMs;
|
||||||
import static androidx.media3.transformer.AndroidTestUtil.MP4_ASSET;
|
import static androidx.media3.transformer.AndroidTestUtil.MP4_ASSET;
|
||||||
import static androidx.media3.transformer.AndroidTestUtil.PNG_ASSET;
|
import static androidx.media3.transformer.AndroidTestUtil.PNG_ASSET;
|
||||||
import static androidx.media3.transformer.AndroidTestUtil.recordTestSkipped;
|
|
||||||
import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation;
|
import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation;
|
||||||
import static com.google.common.collect.Iterables.getLast;
|
import static com.google.common.collect.Iterables.getLast;
|
||||||
import static com.google.common.collect.Iterables.skip;
|
import static com.google.common.collect.Iterables.skip;
|
||||||
@ -28,6 +27,7 @@ import static com.google.common.collect.Iterables.transform;
|
|||||||
import static com.google.common.truth.Truth.assertThat;
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
import static com.google.common.truth.Truth.assertWithMessage;
|
import static com.google.common.truth.Truth.assertWithMessage;
|
||||||
import static java.util.concurrent.TimeUnit.MILLISECONDS;
|
import static java.util.concurrent.TimeUnit.MILLISECONDS;
|
||||||
|
import static org.junit.Assume.assumeFalse;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.view.SurfaceView;
|
import android.view.SurfaceView;
|
||||||
@ -59,11 +59,9 @@ import java.util.concurrent.TimeoutException;
|
|||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.AssumptionViolatedException;
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.rules.TestName;
|
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -92,8 +90,6 @@ public class CompositionPlayerSeekTest {
|
|||||||
ImmutableList.of(0L, 33_333L, 66_667L, 100_000L, 133_333L, 166_667L);
|
ImmutableList.of(0L, 33_333L, 66_667L, 100_000L, 133_333L, 166_667L);
|
||||||
private static final long VIDEO_GRAPH_END_TIMEOUT_MS = 1_000;
|
private static final long VIDEO_GRAPH_END_TIMEOUT_MS = 1_000;
|
||||||
|
|
||||||
@Rule public final TestName testName = new TestName();
|
|
||||||
|
|
||||||
@Rule
|
@Rule
|
||||||
public ActivityScenarioRule<SurfaceTestActivity> rule =
|
public ActivityScenarioRule<SurfaceTestActivity> rule =
|
||||||
new ActivityScenarioRule<>(SurfaceTestActivity.class);
|
new ActivityScenarioRule<>(SurfaceTestActivity.class);
|
||||||
@ -102,13 +98,11 @@ public class CompositionPlayerSeekTest {
|
|||||||
getInstrumentation().getContext().getApplicationContext();
|
getInstrumentation().getContext().getApplicationContext();
|
||||||
private final PlayerTestListener playerTestListener = new PlayerTestListener(TEST_TIMEOUT_MS);
|
private final PlayerTestListener playerTestListener = new PlayerTestListener(TEST_TIMEOUT_MS);
|
||||||
|
|
||||||
private String testId;
|
|
||||||
private CompositionPlayer compositionPlayer;
|
private CompositionPlayer compositionPlayer;
|
||||||
private SurfaceView surfaceView;
|
private SurfaceView surfaceView;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
testId = testName.getMethodName();
|
|
||||||
rule.getScenario().onActivity(activity -> surfaceView = activity.getSurfaceView());
|
rule.getScenario().onActivity(activity -> surfaceView = activity.getSurfaceView());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -126,10 +120,9 @@ public class CompositionPlayerSeekTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void seekToZero_afterPlayingSingleSequenceOfTwoVideos() throws Exception {
|
public void seekToZero_afterPlayingSingleSequenceOfTwoVideos() throws Exception {
|
||||||
if (isRunningOnEmulator() && Util.SDK_INT == 31) {
|
assumeFalse(
|
||||||
// The audio decoder is failing on API 31 emulator.
|
"Skipped due to failing audio decoder on API 31 emulator",
|
||||||
skipTest("Skipped due to failing decoder");
|
isRunningOnEmulator() && Util.SDK_INT == 31);
|
||||||
}
|
|
||||||
ImmutableList<Long> sequenceTimestampsUs =
|
ImmutableList<Long> sequenceTimestampsUs =
|
||||||
new ImmutableList.Builder<Long>()
|
new ImmutableList.Builder<Long>()
|
||||||
// Plays the first video
|
// Plays the first video
|
||||||
@ -153,10 +146,9 @@ public class CompositionPlayerSeekTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void seekToFirstVideo_afterPlayingSingleSequenceOfTwoVideos() throws Exception {
|
public void seekToFirstVideo_afterPlayingSingleSequenceOfTwoVideos() throws Exception {
|
||||||
if (isRunningOnEmulator() && Util.SDK_INT == 31) {
|
assumeFalse(
|
||||||
// The audio decoder is failing on API 31 emulator.
|
"Skipped due to failing audio decoder on API 31 emulator",
|
||||||
skipTest("Skipped due to failing decoder");
|
isRunningOnEmulator() && Util.SDK_INT == 31);
|
||||||
}
|
|
||||||
// Skips the first three video frames
|
// Skips the first three video frames
|
||||||
long seekTimeMs = 100;
|
long seekTimeMs = 100;
|
||||||
ImmutableList<Long> sequenceTimestampsUs =
|
ImmutableList<Long> sequenceTimestampsUs =
|
||||||
@ -180,10 +172,9 @@ public class CompositionPlayerSeekTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void seekToStartOfSecondVideo_afterPlayingSingleSequenceOfTwoVideos() throws Exception {
|
public void seekToStartOfSecondVideo_afterPlayingSingleSequenceOfTwoVideos() throws Exception {
|
||||||
if (isRunningOnEmulator() && Util.SDK_INT == 31) {
|
assumeFalse(
|
||||||
// The audio decoder is failing on API 31 emulator.
|
"Skipped due to failing audio decoder on API 31 emulator",
|
||||||
skipTest("Skipped due to failing decoder");
|
isRunningOnEmulator() && Util.SDK_INT == 31);
|
||||||
}
|
|
||||||
// Seeks to the end of the first video
|
// Seeks to the end of the first video
|
||||||
long seekTimeMs = usToMs(VIDEO_DURATION_US);
|
long seekTimeMs = usToMs(VIDEO_DURATION_US);
|
||||||
ImmutableList<Long> sequenceTimestampsUs =
|
ImmutableList<Long> sequenceTimestampsUs =
|
||||||
@ -206,10 +197,9 @@ public class CompositionPlayerSeekTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void seekToSecondVideo_afterPlayingSingleSequenceOfTwoVideos() throws Exception {
|
public void seekToSecondVideo_afterPlayingSingleSequenceOfTwoVideos() throws Exception {
|
||||||
if (isRunningOnEmulator() && Util.SDK_INT == 31) {
|
assumeFalse(
|
||||||
// The audio decoder is failing on API 31 emulator.
|
"Skipped due to failing audio decoder on API 31 emulator",
|
||||||
skipTest("Skipped due to failing decoder");
|
isRunningOnEmulator() && Util.SDK_INT == 31);
|
||||||
}
|
|
||||||
// Skips the first three image frames of the second image.
|
// Skips the first three image frames of the second image.
|
||||||
long seekTimeMs = usToMs(VIDEO_DURATION_US) + 100;
|
long seekTimeMs = usToMs(VIDEO_DURATION_US) + 100;
|
||||||
ImmutableList<Long> sequenceTimestampsUs =
|
ImmutableList<Long> sequenceTimestampsUs =
|
||||||
@ -234,10 +224,9 @@ public class CompositionPlayerSeekTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void seekToEndOfSecondVideo_afterPlayingSingleSequenceOfTwoVideos() throws Exception {
|
public void seekToEndOfSecondVideo_afterPlayingSingleSequenceOfTwoVideos() throws Exception {
|
||||||
if (isRunningOnEmulator() && Util.SDK_INT == 31) {
|
assumeFalse(
|
||||||
// The audio decoder is failing on API 31 emulator.
|
"Skipped due to failing audio decoder on API 31 emulator",
|
||||||
skipTest("Skipped due to failing decoder");
|
isRunningOnEmulator() && Util.SDK_INT == 31);
|
||||||
}
|
|
||||||
// Seeks to the end of the second video
|
// Seeks to the end of the second video
|
||||||
long seekTimeMs = usToMs(2 * VIDEO_DURATION_US);
|
long seekTimeMs = usToMs(2 * VIDEO_DURATION_US);
|
||||||
ImmutableList<Long> sequenceTimestampsUs =
|
ImmutableList<Long> sequenceTimestampsUs =
|
||||||
@ -259,10 +248,9 @@ public class CompositionPlayerSeekTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void seekToAfterEndOfSecondVideo_afterPlayingSingleSequenceOfTwoVideos() throws Exception {
|
public void seekToAfterEndOfSecondVideo_afterPlayingSingleSequenceOfTwoVideos() throws Exception {
|
||||||
if (isRunningOnEmulator() && Util.SDK_INT == 31) {
|
assumeFalse(
|
||||||
// The audio decoder is failing on API 31 emulator.
|
"Skipped due to failing audio decoder on API 31 emulator",
|
||||||
skipTest("Skipped due to failing decoder");
|
isRunningOnEmulator() && Util.SDK_INT == 31);
|
||||||
}
|
|
||||||
long seekTimeMs = usToMs(3 * VIDEO_DURATION_US);
|
long seekTimeMs = usToMs(3 * VIDEO_DURATION_US);
|
||||||
ImmutableList<Long> sequenceTimestampsUs =
|
ImmutableList<Long> sequenceTimestampsUs =
|
||||||
new ImmutableList.Builder<Long>()
|
new ImmutableList.Builder<Long>()
|
||||||
@ -416,10 +404,9 @@ public class CompositionPlayerSeekTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void seekToZero_afterPlayingSingleSequenceOfVideoAndImage() throws Exception {
|
public void seekToZero_afterPlayingSingleSequenceOfVideoAndImage() throws Exception {
|
||||||
if (isRunningOnEmulator() && Util.SDK_INT == 31) {
|
assumeFalse(
|
||||||
// The audio decoder is failing on API 31 emulator.
|
"Skipped due to failing audio decoder on API 31 emulator",
|
||||||
skipTest("Skipped due to failing decoder");
|
isRunningOnEmulator() && Util.SDK_INT == 31);
|
||||||
}
|
|
||||||
ImmutableList<Long> sequenceTimestampsUs =
|
ImmutableList<Long> sequenceTimestampsUs =
|
||||||
new ImmutableList.Builder<Long>()
|
new ImmutableList.Builder<Long>()
|
||||||
// Plays the video
|
// Plays the video
|
||||||
@ -443,10 +430,9 @@ public class CompositionPlayerSeekTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void seekToVideo_afterPlayingSingleSequenceOfVideoAndImage() throws Exception {
|
public void seekToVideo_afterPlayingSingleSequenceOfVideoAndImage() throws Exception {
|
||||||
if (isRunningOnEmulator() && Util.SDK_INT == 31) {
|
assumeFalse(
|
||||||
// The audio decoder is failing on API 31 emulator.
|
"Skipped due to failing audio decoder on API 31 emulator",
|
||||||
skipTest("Skipped due to failing decoder");
|
isRunningOnEmulator() && Util.SDK_INT == 31);
|
||||||
}
|
|
||||||
// Skips three video frames
|
// Skips three video frames
|
||||||
long seekTimeMs = 100;
|
long seekTimeMs = 100;
|
||||||
ImmutableList<Long> sequenceTimestampsUs =
|
ImmutableList<Long> sequenceTimestampsUs =
|
||||||
@ -471,10 +457,9 @@ public class CompositionPlayerSeekTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void seekToImage_afterPlayingSingleSequenceOfVideoAndImage() throws Exception {
|
public void seekToImage_afterPlayingSingleSequenceOfVideoAndImage() throws Exception {
|
||||||
if (isRunningOnEmulator() && Util.SDK_INT == 31) {
|
assumeFalse(
|
||||||
// The audio decoder is failing on API 31 emulator.
|
"Skipped due to failing audio decoder on API 31 emulator",
|
||||||
skipTest("Skipped due to failing decoder");
|
isRunningOnEmulator() && Util.SDK_INT == 31);
|
||||||
}
|
|
||||||
// Skips video frames and three image frames
|
// Skips video frames and three image frames
|
||||||
long seekTimeMs = usToMs(VIDEO_DURATION_US) + 100;
|
long seekTimeMs = usToMs(VIDEO_DURATION_US) + 100;
|
||||||
ImmutableList<Long> sequenceTimestampsUs =
|
ImmutableList<Long> sequenceTimestampsUs =
|
||||||
@ -499,11 +484,9 @@ public class CompositionPlayerSeekTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void seekToZero_afterPlayingSingleSequenceOfImageAndVideo() throws Exception {
|
public void seekToZero_afterPlayingSingleSequenceOfImageAndVideo() throws Exception {
|
||||||
if (isRunningOnEmulator()) {
|
|
||||||
// The MediaCodec decoder's output surface is sometimes dropping frames on emulator despite
|
// The MediaCodec decoder's output surface is sometimes dropping frames on emulator despite
|
||||||
// using MediaFormat.KEY_ALLOW_FRAME_DROP.
|
// using MediaFormat.KEY_ALLOW_FRAME_DROP.
|
||||||
skipTest("Skipped due to surface dropping frames");
|
assumeFalse("Skipped on emulator due to surface dropping frames", isRunningOnEmulator());
|
||||||
}
|
|
||||||
ImmutableList<Long> sequenceTimestampsUs =
|
ImmutableList<Long> sequenceTimestampsUs =
|
||||||
new ImmutableList.Builder<Long>()
|
new ImmutableList.Builder<Long>()
|
||||||
// Plays the image
|
// Plays the image
|
||||||
@ -527,11 +510,9 @@ public class CompositionPlayerSeekTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void seekToImage_afterPlayingSingleSequenceOfImageAndVideo() throws Exception {
|
public void seekToImage_afterPlayingSingleSequenceOfImageAndVideo() throws Exception {
|
||||||
if (isRunningOnEmulator()) {
|
|
||||||
// The MediaCodec decoder's output surface is sometimes dropping frames on emulator despite
|
// The MediaCodec decoder's output surface is sometimes dropping frames on emulator despite
|
||||||
// using MediaFormat.KEY_ALLOW_FRAME_DROP.
|
// using MediaFormat.KEY_ALLOW_FRAME_DROP.
|
||||||
skipTest("Skipped due to surface dropping frames");
|
assumeFalse("Skipped on emulator due to surface dropping frames", isRunningOnEmulator());
|
||||||
}
|
|
||||||
// Skips three image frames
|
// Skips three image frames
|
||||||
long seekTimeMs = 100;
|
long seekTimeMs = 100;
|
||||||
ImmutableList<Long> sequenceTimestampsUs =
|
ImmutableList<Long> sequenceTimestampsUs =
|
||||||
@ -555,10 +536,9 @@ public class CompositionPlayerSeekTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void seekToVideo_afterPlayingSingleSequenceOfImageAndVideo() throws Exception {
|
public void seekToVideo_afterPlayingSingleSequenceOfImageAndVideo() throws Exception {
|
||||||
if (isRunningOnEmulator() && Util.SDK_INT == 31) {
|
assumeFalse(
|
||||||
// The audio decoder is failing on API 31 emulator.
|
"Skipped due to failing audio decoder on API 31 emulator",
|
||||||
skipTest("Skipped due to failing decoder");
|
isRunningOnEmulator() && Util.SDK_INT == 31);
|
||||||
}
|
|
||||||
// Skips to the first video frame.
|
// Skips to the first video frame.
|
||||||
long seekTimeMs = usToMs(IMAGE_DURATION_US);
|
long seekTimeMs = usToMs(IMAGE_DURATION_US);
|
||||||
ImmutableList<Long> sequenceTimestampsUs =
|
ImmutableList<Long> sequenceTimestampsUs =
|
||||||
@ -581,10 +561,9 @@ public class CompositionPlayerSeekTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void seekToZero_duringPlayingFirstVideoInSingleSequenceOfTwoVideos() throws Exception {
|
public void seekToZero_duringPlayingFirstVideoInSingleSequenceOfTwoVideos() throws Exception {
|
||||||
if (isRunningOnEmulator() && Util.SDK_INT == 31) {
|
assumeFalse(
|
||||||
// The audio decoder is failing on API 31 emulator.
|
"Skipped due to failing audio decoder on API 31 emulator",
|
||||||
skipTest("Skipped due to failing decoder");
|
isRunningOnEmulator() && Util.SDK_INT == 31);
|
||||||
}
|
|
||||||
ImmutableList<MediaItemConfig> mediaItems =
|
ImmutableList<MediaItemConfig> mediaItems =
|
||||||
ImmutableList.of(VIDEO_MEDIA_ITEM, VIDEO_MEDIA_ITEM);
|
ImmutableList.of(VIDEO_MEDIA_ITEM, VIDEO_MEDIA_ITEM);
|
||||||
int numberOfFramesBeforeSeeking = 15;
|
int numberOfFramesBeforeSeeking = 15;
|
||||||
@ -610,10 +589,9 @@ public class CompositionPlayerSeekTest {
|
|||||||
@Test
|
@Test
|
||||||
public void seekToSecondVideo_duringPlayingFirstVideoInSingleSequenceOfTwoVideos()
|
public void seekToSecondVideo_duringPlayingFirstVideoInSingleSequenceOfTwoVideos()
|
||||||
throws Exception {
|
throws Exception {
|
||||||
if (isRunningOnEmulator() && Util.SDK_INT == 31) {
|
assumeFalse(
|
||||||
// The audio decoder is failing on API 31 emulator.
|
"Skipped due to failing audio decoder on API 31 emulator",
|
||||||
skipTest("Skipped due to failing decoder");
|
isRunningOnEmulator() && Util.SDK_INT == 31);
|
||||||
}
|
|
||||||
ImmutableList<MediaItemConfig> mediaItems =
|
ImmutableList<MediaItemConfig> mediaItems =
|
||||||
ImmutableList.of(VIDEO_MEDIA_ITEM, VIDEO_MEDIA_ITEM);
|
ImmutableList.of(VIDEO_MEDIA_ITEM, VIDEO_MEDIA_ITEM);
|
||||||
int numberOfFramesBeforeSeeking = 15;
|
int numberOfFramesBeforeSeeking = 15;
|
||||||
@ -640,10 +618,9 @@ public class CompositionPlayerSeekTest {
|
|||||||
@Test
|
@Test
|
||||||
public void seekToFirstVideo_duringPlayingSecondVideoInSingleSequenceOfTwoVideos()
|
public void seekToFirstVideo_duringPlayingSecondVideoInSingleSequenceOfTwoVideos()
|
||||||
throws Exception {
|
throws Exception {
|
||||||
if (isRunningOnEmulator() && Util.SDK_INT == 31) {
|
assumeFalse(
|
||||||
// The audio decoder is failing on API 31 emulator.
|
"Skipped due to failing audio decoder on API 31 emulator",
|
||||||
skipTest("Skipped due to failing decoder");
|
isRunningOnEmulator() && Util.SDK_INT == 31);
|
||||||
}
|
|
||||||
ImmutableList<MediaItemConfig> mediaItems =
|
ImmutableList<MediaItemConfig> mediaItems =
|
||||||
ImmutableList.of(VIDEO_MEDIA_ITEM, VIDEO_MEDIA_ITEM);
|
ImmutableList.of(VIDEO_MEDIA_ITEM, VIDEO_MEDIA_ITEM);
|
||||||
int numberOfFramesBeforeSeeking = 45;
|
int numberOfFramesBeforeSeeking = 45;
|
||||||
@ -674,10 +651,9 @@ public class CompositionPlayerSeekTest {
|
|||||||
@Test
|
@Test
|
||||||
public void seekToEndOfFirstVideo_duringPlayingFirstVideoInSingleSequenceOfTwoVideos()
|
public void seekToEndOfFirstVideo_duringPlayingFirstVideoInSingleSequenceOfTwoVideos()
|
||||||
throws Exception {
|
throws Exception {
|
||||||
if (isRunningOnEmulator() && Util.SDK_INT == 31) {
|
assumeFalse(
|
||||||
// The audio decoder is failing on API 31 emulator.
|
"Skipped due to failing audio decoder on API 31 emulator",
|
||||||
skipTest("Skipped due to failing decoder");
|
isRunningOnEmulator() && Util.SDK_INT == 31);
|
||||||
}
|
|
||||||
ImmutableList<MediaItemConfig> mediaItems =
|
ImmutableList<MediaItemConfig> mediaItems =
|
||||||
ImmutableList.of(VIDEO_MEDIA_ITEM, VIDEO_MEDIA_ITEM);
|
ImmutableList.of(VIDEO_MEDIA_ITEM, VIDEO_MEDIA_ITEM);
|
||||||
int numberOfFramesBeforeSeeking = 15;
|
int numberOfFramesBeforeSeeking = 15;
|
||||||
@ -702,10 +678,9 @@ public class CompositionPlayerSeekTest {
|
|||||||
@Test
|
@Test
|
||||||
public void seekToEndOfSecondVideo_duringPlayingFirstVideoInSingleSequenceOfTwoVideos()
|
public void seekToEndOfSecondVideo_duringPlayingFirstVideoInSingleSequenceOfTwoVideos()
|
||||||
throws Exception {
|
throws Exception {
|
||||||
if (isRunningOnEmulator() && Util.SDK_INT == 31) {
|
assumeFalse(
|
||||||
// The audio decoder is failing on API 31 emulator.
|
"Skipped due to failing audio decoder on API 31 emulator",
|
||||||
skipTest("Skipped due to failing decoder");
|
isRunningOnEmulator() && Util.SDK_INT == 31);
|
||||||
}
|
|
||||||
ImmutableList<MediaItemConfig> mediaItems =
|
ImmutableList<MediaItemConfig> mediaItems =
|
||||||
ImmutableList.of(VIDEO_MEDIA_ITEM, VIDEO_MEDIA_ITEM);
|
ImmutableList.of(VIDEO_MEDIA_ITEM, VIDEO_MEDIA_ITEM);
|
||||||
int numberOfFramesBeforeSeeking = 15;
|
int numberOfFramesBeforeSeeking = 15;
|
||||||
@ -728,10 +703,6 @@ public class CompositionPlayerSeekTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void seekToFirstImage_duringPlayingFirstImageInSequenceOfTwoImages() throws Exception {
|
public void seekToFirstImage_duringPlayingFirstImageInSequenceOfTwoImages() throws Exception {
|
||||||
if (isRunningOnEmulator() && Util.SDK_INT == 31) {
|
|
||||||
// The audio decoder is failing on API 31 emulator.
|
|
||||||
skipTest("Skipped due to failing decoder");
|
|
||||||
}
|
|
||||||
ImmutableList<MediaItemConfig> mediaItems = ImmutableList.of(IMAGE_MEDIA_ITEM);
|
ImmutableList<MediaItemConfig> mediaItems = ImmutableList.of(IMAGE_MEDIA_ITEM);
|
||||||
int numberOfFramesBeforeSeeking = 2;
|
int numberOfFramesBeforeSeeking = 2;
|
||||||
// Should skip the first 3 frames.
|
// Should skip the first 3 frames.
|
||||||
@ -778,10 +749,9 @@ public class CompositionPlayerSeekTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void seekToImage_duringPlayingFirstImageInSequenceOfVideoAndImage() throws Exception {
|
public void seekToImage_duringPlayingFirstImageInSequenceOfVideoAndImage() throws Exception {
|
||||||
if (isRunningOnEmulator() && Util.SDK_INT == 31) {
|
assumeFalse(
|
||||||
// The audio decoder is failing on API 31 emulator.
|
"Skipped due to failing audio decoder on API 31 emulator",
|
||||||
skipTest("Skipped due to failing decoder");
|
isRunningOnEmulator() && Util.SDK_INT == 31);
|
||||||
}
|
|
||||||
ImmutableList<MediaItemConfig> mediaItems =
|
ImmutableList<MediaItemConfig> mediaItems =
|
||||||
ImmutableList.of(VIDEO_MEDIA_ITEM, IMAGE_MEDIA_ITEM);
|
ImmutableList.of(VIDEO_MEDIA_ITEM, IMAGE_MEDIA_ITEM);
|
||||||
int numberOfFramesBeforeSeeking = 15;
|
int numberOfFramesBeforeSeeking = 15;
|
||||||
@ -807,10 +777,9 @@ public class CompositionPlayerSeekTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void seekToVideo_duringPlayingFirstImageInSequenceOfImageAndVideo() throws Exception {
|
public void seekToVideo_duringPlayingFirstImageInSequenceOfImageAndVideo() throws Exception {
|
||||||
if (isRunningOnEmulator() && Util.SDK_INT == 31) {
|
assumeFalse(
|
||||||
// The audio decoder is failing on API 31 emulator.
|
"Skipped due to failing audio decoder on API 31 emulator",
|
||||||
skipTest("Skipped due to failing decoder");
|
isRunningOnEmulator() && Util.SDK_INT == 31);
|
||||||
}
|
|
||||||
ImmutableList<MediaItemConfig> mediaItems =
|
ImmutableList<MediaItemConfig> mediaItems =
|
||||||
ImmutableList.of(IMAGE_MEDIA_ITEM, VIDEO_MEDIA_ITEM);
|
ImmutableList.of(IMAGE_MEDIA_ITEM, VIDEO_MEDIA_ITEM);
|
||||||
int numberOfFramesBeforeSeeking = 3;
|
int numberOfFramesBeforeSeeking = 3;
|
||||||
@ -834,11 +803,6 @@ public class CompositionPlayerSeekTest {
|
|||||||
assertThat(actualTimestampsUs).isEqualTo(expectedTimestampsUs);
|
assertThat(actualTimestampsUs).isEqualTo(expectedTimestampsUs);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void skipTest(String reason) throws Exception {
|
|
||||||
recordTestSkipped(applicationContext, testId, reason);
|
|
||||||
throw new AssumptionViolatedException(reason);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Plays the first {@code numberOfFramesBeforeSeeking} frames of the provided sequence, seeks to
|
* Plays the first {@code numberOfFramesBeforeSeeking} frames of the provided sequence, seeks to
|
||||||
* {@code seekTimeMs}, resumes playback until it ends, and returns the timestamps of the processed
|
* {@code seekTimeMs}, resumes playback until it ends, and returns the timestamps of the processed
|
||||||
|
@ -26,9 +26,9 @@ import static androidx.media3.transformer.AndroidTestUtil.JPG_ASSET;
|
|||||||
import static androidx.media3.transformer.AndroidTestUtil.MP4_ASSET;
|
import static androidx.media3.transformer.AndroidTestUtil.MP4_ASSET;
|
||||||
import static androidx.media3.transformer.AndroidTestUtil.assumeFormatsSupported;
|
import static androidx.media3.transformer.AndroidTestUtil.assumeFormatsSupported;
|
||||||
import static androidx.media3.transformer.AndroidTestUtil.extractBitmapsFromVideo;
|
import static androidx.media3.transformer.AndroidTestUtil.extractBitmapsFromVideo;
|
||||||
import static androidx.media3.transformer.AndroidTestUtil.recordTestSkipped;
|
|
||||||
import static com.google.common.truth.Truth.assertThat;
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
import static com.google.common.truth.Truth.assertWithMessage;
|
import static com.google.common.truth.Truth.assertWithMessage;
|
||||||
|
import static org.junit.Assume.assumeFalse;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
@ -51,7 +51,6 @@ import com.google.common.collect.ImmutableList;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.junit.AssumptionViolatedException;
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
@ -235,11 +234,9 @@ public final class TransformerMultiSequenceCompositionTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void export_completesWithConsistentFrameCount() throws Exception {
|
public void export_completesWithConsistentFrameCount() throws Exception {
|
||||||
if (isRunningOnEmulator() && Util.SDK_INT == 31) {
|
assumeFalse(
|
||||||
// The decoder is failing on API 31 emulator.
|
"Skipped due to failing video decoder on API 31 emulator",
|
||||||
recordTestSkipped(context, testId, /* reason= */ "Skipped due to failing decoder");
|
isRunningOnEmulator() && Util.SDK_INT == 31);
|
||||||
throw new AssumptionViolatedException("Skipped due to failing decoder");
|
|
||||||
}
|
|
||||||
assumeFormatsSupported(
|
assumeFormatsSupported(
|
||||||
context,
|
context,
|
||||||
testId,
|
testId,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user