cts: add tests to validate decoding profiles defined by CDD.
Bug: 18355427
Change-Id: I64ca4e29ff8c85f0c740656cd9219e7bf70893dd
diff --git a/tests/tests/media/res/raw/video_1280x720_mp4_h264_8192kbps_30fps_aac_stereo_128kbps_44100hz.mp4 b/tests/tests/media/res/raw/video_1280x720_mp4_h264_8192kbps_30fps_aac_stereo_128kbps_44100hz.mp4
new file mode 100644
index 0000000..2c9c3d3
--- /dev/null
+++ b/tests/tests/media/res/raw/video_1280x720_mp4_h264_8192kbps_30fps_aac_stereo_128kbps_44100hz.mp4
Binary files differ
diff --git a/tests/tests/media/res/raw/video_1280x720_mp4_h264_8192kbps_60fps_aac_stereo_128kbps_44100hz.mp4 b/tests/tests/media/res/raw/video_1280x720_mp4_h264_8192kbps_60fps_aac_stereo_128kbps_44100hz.mp4
new file mode 100644
index 0000000..71150af
--- /dev/null
+++ b/tests/tests/media/res/raw/video_1280x720_mp4_h264_8192kbps_60fps_aac_stereo_128kbps_44100hz.mp4
Binary files differ
diff --git a/tests/tests/media/res/raw/video_1280x720_mp4_hevc_4096kbps_30fps_aac_stereo_128kbps_44100hz.mp4 b/tests/tests/media/res/raw/video_1280x720_mp4_hevc_4096kbps_30fps_aac_stereo_128kbps_44100hz.mp4
new file mode 100644
index 0000000..18d53e6
--- /dev/null
+++ b/tests/tests/media/res/raw/video_1280x720_mp4_hevc_4096kbps_30fps_aac_stereo_128kbps_44100hz.mp4
Binary files differ
diff --git a/tests/tests/media/res/raw/video_1280x720_webm_vp8_8192kbps_30fps_vorbis_stereo_128kbps_44100hz.webm b/tests/tests/media/res/raw/video_1280x720_webm_vp8_8192kbps_30fps_vorbis_stereo_128kbps_44100hz.webm
new file mode 100644
index 0000000..9c91510
--- /dev/null
+++ b/tests/tests/media/res/raw/video_1280x720_webm_vp8_8192kbps_30fps_vorbis_stereo_128kbps_44100hz.webm
Binary files differ
diff --git a/tests/tests/media/res/raw/video_1280x720_webm_vp8_8192kbps_60fps_vorbis_stereo_128kbps_44100hz.webm b/tests/tests/media/res/raw/video_1280x720_webm_vp8_8192kbps_60fps_vorbis_stereo_128kbps_44100hz.webm
new file mode 100644
index 0000000..8d9ab8e
--- /dev/null
+++ b/tests/tests/media/res/raw/video_1280x720_webm_vp8_8192kbps_60fps_vorbis_stereo_128kbps_44100hz.webm
Binary files differ
diff --git a/tests/tests/media/res/raw/video_1280x720_webm_vp9_4096kbps_30fps_vorbis_stereo_128kbps_44100hz.webm b/tests/tests/media/res/raw/video_1280x720_webm_vp9_4096kbps_30fps_vorbis_stereo_128kbps_44100hz.webm
new file mode 100644
index 0000000..a5eddd3
--- /dev/null
+++ b/tests/tests/media/res/raw/video_1280x720_webm_vp9_4096kbps_30fps_vorbis_stereo_128kbps_44100hz.webm
Binary files differ
diff --git a/tests/tests/media/res/raw/video_1920x1080_mp4_h264_20480kbps_30fps_aac_stereo_128kbps_44100hz.mp4 b/tests/tests/media/res/raw/video_1920x1080_mp4_h264_20480kbps_30fps_aac_stereo_128kbps_44100hz.mp4
new file mode 100644
index 0000000..35ab7a0
--- /dev/null
+++ b/tests/tests/media/res/raw/video_1920x1080_mp4_h264_20480kbps_30fps_aac_stereo_128kbps_44100hz.mp4
Binary files differ
diff --git a/tests/tests/media/res/raw/video_1920x1080_mp4_h264_20480kbps_60fps_aac_stereo_128kbps_44100hz.mp4 b/tests/tests/media/res/raw/video_1920x1080_mp4_h264_20480kbps_60fps_aac_stereo_128kbps_44100hz.mp4
new file mode 100644
index 0000000..b837dc2
--- /dev/null
+++ b/tests/tests/media/res/raw/video_1920x1080_mp4_h264_20480kbps_60fps_aac_stereo_128kbps_44100hz.mp4
Binary files differ
diff --git a/tests/tests/media/res/raw/video_1920x1080_mp4_hevc_10240kbps_30fps_aac_stereo_128kbps_44100hz.mp4 b/tests/tests/media/res/raw/video_1920x1080_mp4_hevc_10240kbps_30fps_aac_stereo_128kbps_44100hz.mp4
new file mode 100644
index 0000000..631ea04
--- /dev/null
+++ b/tests/tests/media/res/raw/video_1920x1080_mp4_hevc_10240kbps_30fps_aac_stereo_128kbps_44100hz.mp4
Binary files differ
diff --git a/tests/tests/media/res/raw/video_1920x1080_webm_vp8_20480kbps_30fps_vorbis_stereo_128kbps_44100hz.webm b/tests/tests/media/res/raw/video_1920x1080_webm_vp8_20480kbps_30fps_vorbis_stereo_128kbps_44100hz.webm
new file mode 100644
index 0000000..051a6c0
--- /dev/null
+++ b/tests/tests/media/res/raw/video_1920x1080_webm_vp8_20480kbps_30fps_vorbis_stereo_128kbps_44100hz.webm
Binary files differ
diff --git a/tests/tests/media/res/raw/video_1920x1080_webm_vp8_20480kbps_60fps_vorbis_stereo_128kbps_44100hz.webm b/tests/tests/media/res/raw/video_1920x1080_webm_vp8_20480kbps_60fps_vorbis_stereo_128kbps_44100hz.webm
new file mode 100644
index 0000000..d6f0f3b
--- /dev/null
+++ b/tests/tests/media/res/raw/video_1920x1080_webm_vp8_20480kbps_60fps_vorbis_stereo_128kbps_44100hz.webm
Binary files differ
diff --git a/tests/tests/media/res/raw/video_1920x1080_webm_vp9_10240kbps_30fps_vorbis_stereo_128kbps_44100hz.webm b/tests/tests/media/res/raw/video_1920x1080_webm_vp9_10240kbps_30fps_vorbis_stereo_128kbps_44100hz.webm
new file mode 100644
index 0000000..d34d03f
--- /dev/null
+++ b/tests/tests/media/res/raw/video_1920x1080_webm_vp9_10240kbps_30fps_vorbis_stereo_128kbps_44100hz.webm
Binary files differ
diff --git a/tests/tests/media/res/raw/video_2840x2160_mp4_hevc_20480kbps_30fps_aac_stereo_128kbps_44100hz.mp4 b/tests/tests/media/res/raw/video_2840x2160_mp4_hevc_20480kbps_30fps_aac_stereo_128kbps_44100hz.mp4
new file mode 100644
index 0000000..7b663a4
--- /dev/null
+++ b/tests/tests/media/res/raw/video_2840x2160_mp4_hevc_20480kbps_30fps_aac_stereo_128kbps_44100hz.mp4
Binary files differ
diff --git a/tests/tests/media/res/raw/video_320x240_mp4_h264_800kbps_30fps_aac_stereo_128kbps_44100hz.mp4 b/tests/tests/media/res/raw/video_320x240_mp4_h264_800kbps_30fps_aac_stereo_128kbps_44100hz.mp4
new file mode 100644
index 0000000..12e07ce
--- /dev/null
+++ b/tests/tests/media/res/raw/video_320x240_mp4_h264_800kbps_30fps_aac_stereo_128kbps_44100hz.mp4
Binary files differ
diff --git a/tests/tests/media/res/raw/video_320x240_webm_vp8_800kbps_30fps_vorbis_stereo_128kbps_44100hz.webm b/tests/tests/media/res/raw/video_320x240_webm_vp8_800kbps_30fps_vorbis_stereo_128kbps_44100hz.webm
new file mode 100644
index 0000000..15c34b9
--- /dev/null
+++ b/tests/tests/media/res/raw/video_320x240_webm_vp8_800kbps_30fps_vorbis_stereo_128kbps_44100hz.webm
Binary files differ
diff --git a/tests/tests/media/res/raw/video_320x240_webm_vp9_600kbps_30fps_vorbis_stereo_128kbps_44100hz.webm b/tests/tests/media/res/raw/video_320x240_webm_vp9_600kbps_30fps_vorbis_stereo_128kbps_44100hz.webm
new file mode 100644
index 0000000..b9c1134
--- /dev/null
+++ b/tests/tests/media/res/raw/video_320x240_webm_vp9_600kbps_30fps_vorbis_stereo_128kbps_44100hz.webm
Binary files differ
diff --git a/tests/tests/media/res/raw/video_352x288_mp4_hevc_600kbps_30fps_aac_stereo_128kbps_44100hz.mp4 b/tests/tests/media/res/raw/video_352x288_mp4_hevc_600kbps_30fps_aac_stereo_128kbps_44100hz.mp4
new file mode 100644
index 0000000..4404877
--- /dev/null
+++ b/tests/tests/media/res/raw/video_352x288_mp4_hevc_600kbps_30fps_aac_stereo_128kbps_44100hz.mp4
Binary files differ
diff --git a/tests/tests/media/res/raw/video_3840x2160_webm_vp9_20480kbps_30fps_vorbis_stereo_128kbps_44100hz.webm b/tests/tests/media/res/raw/video_3840x2160_webm_vp9_20480kbps_30fps_vorbis_stereo_128kbps_44100hz.webm
new file mode 100644
index 0000000..e5a58e6
--- /dev/null
+++ b/tests/tests/media/res/raw/video_3840x2160_webm_vp9_20480kbps_30fps_vorbis_stereo_128kbps_44100hz.webm
Binary files differ
diff --git a/tests/tests/media/res/raw/video_640x360_webm_vp8_2048kbps_30fps_vorbis_stereo_128kbps_44100hz.webm b/tests/tests/media/res/raw/video_640x360_webm_vp8_2048kbps_30fps_vorbis_stereo_128kbps_44100hz.webm
new file mode 100644
index 0000000..d0df713
--- /dev/null
+++ b/tests/tests/media/res/raw/video_640x360_webm_vp8_2048kbps_30fps_vorbis_stereo_128kbps_44100hz.webm
Binary files differ
diff --git a/tests/tests/media/res/raw/video_640x360_webm_vp9_1638kbps_30fps_vorbis_stereo_128kbps_44100hz.webm b/tests/tests/media/res/raw/video_640x360_webm_vp9_1638kbps_30fps_vorbis_stereo_128kbps_44100hz.webm
new file mode 100644
index 0000000..dbe2f1b
--- /dev/null
+++ b/tests/tests/media/res/raw/video_640x360_webm_vp9_1638kbps_30fps_vorbis_stereo_128kbps_44100hz.webm
Binary files differ
diff --git a/tests/tests/media/res/raw/video_720x480_mp4_h264_2048kbps_30fps_aac_stereo_128kbps_44100hz.mp4 b/tests/tests/media/res/raw/video_720x480_mp4_h264_2048kbps_30fps_aac_stereo_128kbps_44100hz.mp4
new file mode 100644
index 0000000..055e217
--- /dev/null
+++ b/tests/tests/media/res/raw/video_720x480_mp4_h264_2048kbps_30fps_aac_stereo_128kbps_44100hz.mp4
Binary files differ
diff --git a/tests/tests/media/res/raw/video_720x480_mp4_hevc_1638kbps_30fps_aac_stereo_128kbps_44100hz.mp4 b/tests/tests/media/res/raw/video_720x480_mp4_hevc_1638kbps_30fps_aac_stereo_128kbps_44100hz.mp4
new file mode 100644
index 0000000..87c6897
--- /dev/null
+++ b/tests/tests/media/res/raw/video_720x480_mp4_hevc_1638kbps_30fps_aac_stereo_128kbps_44100hz.mp4
Binary files differ
diff --git a/tests/tests/media/src/android/media/cts/DecoderTest.java b/tests/tests/media/src/android/media/cts/DecoderTest.java
index d71d38a..4188973 100644
--- a/tests/tests/media/src/android/media/cts/DecoderTest.java
+++ b/tests/tests/media/src/android/media/cts/DecoderTest.java
@@ -18,6 +18,8 @@
import com.android.cts.media.R;
+import android.content.Context;
+import android.content.pm.PackageManager;
import android.content.res.AssetFileDescriptor;
import android.content.res.Resources;
import android.graphics.ImageFormat;
@@ -844,21 +846,23 @@
return numsamples;
}
+ private void testDecode(int testVideo, int frameNum) throws Exception {
+ // Decode to Surface.
+ Surface s = getActivity().getSurfaceHolder().getSurface();
+ int frames1 = countFrames(testVideo, RESET_MODE_NONE, -1 /* eosframe */, s);
+ assertEquals("wrong number of frames decoded", frameNum, frames1);
+
+ // Decode to buffer.
+ int frames2 = countFrames(testVideo, RESET_MODE_NONE, -1 /* eosframe */, null);
+ assertEquals("different number of frames when using Surface", frames1, frames2);
+ }
+
public void testCodecBasicH264() throws Exception {
if (!hasH264(false)) {
Log.i(TAG, "SKIPPING testCodecBasicH264(): No codec found.");
return;
}
- Surface s = getActivity().getSurfaceHolder().getSurface();
- int frames1 = countFrames(
- R.raw.video_480x360_mp4_h264_1000kbps_25fps_aac_stereo_128kbps_44100hz,
- RESET_MODE_NONE, -1 /* eosframe */, s);
- assertEquals("wrong number of frames decoded", 240, frames1);
-
- int frames2 = countFrames(
- R.raw.video_480x360_mp4_h264_1000kbps_25fps_aac_stereo_128kbps_44100hz,
- RESET_MODE_NONE, -1 /* eosframe */, null);
- assertEquals("different number of frames when using Surface", frames1, frames2);
+ testDecode(R.raw.video_480x360_mp4_h264_1000kbps_25fps_aac_stereo_128kbps_44100hz, 240);
}
public void testCodecBasicHEVC() throws Exception {
@@ -866,16 +870,7 @@
Log.i(TAG, "SKIPPING testCodecBasicHEVC(): No codec found.");
return;
}
- Surface s = getActivity().getSurfaceHolder().getSurface();
- int frames1 = countFrames(
- R.raw.video_1280x720_mp4_hevc_1150kbps_30fps_aac_stereo_128kbps_48000hz,
- RESET_MODE_NONE, -1 /* eosframe */, s);
- assertEquals("wrong number of frames decoded", 300, frames1);
-
- int frames2 = countFrames(
- R.raw.video_1280x720_mp4_hevc_1150kbps_30fps_aac_stereo_128kbps_48000hz,
- RESET_MODE_NONE, -1 /* eosframe */, null);
- assertEquals("different number of frames when using Surface", frames1, frames2);
+ testDecode(R.raw.video_1280x720_mp4_hevc_1150kbps_30fps_aac_stereo_128kbps_48000hz, 300);
}
public void testCodecBasicH263() throws Exception {
@@ -883,16 +878,7 @@
Log.i(TAG, "SKIPPING testCodecBasicH263(): No codec found.");
return;
}
- Surface s = getActivity().getSurfaceHolder().getSurface();
- int frames1 = countFrames(
- R.raw.video_176x144_3gp_h263_300kbps_12fps_aac_stereo_128kbps_22050hz,
- RESET_MODE_NONE, -1 /* eosframe */, s);
- assertEquals("wrong number of frames decoded", 122, frames1);
-
- int frames2 = countFrames(
- R.raw.video_176x144_3gp_h263_300kbps_12fps_aac_stereo_128kbps_22050hz,
- RESET_MODE_NONE, -1 /* eosframe */, null);
- assertEquals("different number of frames when using Surface", frames1, frames2);
+ testDecode(R.raw.video_176x144_3gp_h263_300kbps_12fps_aac_stereo_128kbps_22050hz, 122);
}
public void testCodecBasicMpeg4() throws Exception {
@@ -900,16 +886,7 @@
Log.i(TAG, "SKIPPING testCodecBasicMpeg4(): No codec found.");
return;
}
- Surface s = getActivity().getSurfaceHolder().getSurface();
- int frames1 = countFrames(
- R.raw.video_480x360_mp4_mpeg4_860kbps_25fps_aac_stereo_128kbps_44100hz,
- RESET_MODE_NONE, -1 /* eosframe */, s);
- assertEquals("wrong number of frames decoded", 249, frames1);
-
- int frames2 = countFrames(
- R.raw.video_480x360_mp4_mpeg4_860kbps_25fps_aac_stereo_128kbps_44100hz,
- RESET_MODE_NONE, -1 /* eosframe */, null);
- assertEquals("different number of frames when using Surface", frames1, frames2);
+ testDecode(R.raw.video_480x360_mp4_mpeg4_860kbps_25fps_aac_stereo_128kbps_44100hz, 249);
}
public void testCodecBasicVP8() throws Exception {
@@ -917,16 +894,7 @@
Log.i(TAG, "SKIPPING testCodecBasicVP8(): No codec found.");
return;
}
- Surface s = getActivity().getSurfaceHolder().getSurface();
- int frames1 = countFrames(
- R.raw.video_480x360_webm_vp8_333kbps_25fps_vorbis_stereo_128kbps_44100hz,
- RESET_MODE_NONE, -1 /* eosframe */, s);
- assertEquals("wrong number of frames decoded", 240, frames1);
-
- int frames2 = countFrames(
- R.raw.video_480x360_webm_vp8_333kbps_25fps_vorbis_stereo_128kbps_44100hz,
- RESET_MODE_NONE, -1 /* eosframe */, null);
- assertEquals("different number of frames when using Surface", frames1, frames2);
+ testDecode(R.raw.video_480x360_webm_vp8_333kbps_25fps_vorbis_stereo_128kbps_44100hz, 240);
}
public void testCodecBasicVP9() throws Exception {
@@ -934,16 +902,256 @@
Log.i(TAG, "SKIPPING testCodecBasicVP9(): No codec found.");
return;
}
- Surface s = getActivity().getSurfaceHolder().getSurface();
- int frames1 = countFrames(
- R.raw.video_480x360_webm_vp9_333kbps_25fps_vorbis_stereo_128kbps_44100hz,
- RESET_MODE_NONE, -1 /* eosframe */, s);
- assertEquals("wrong number of frames decoded", 240, frames1);
+ testDecode(R.raw.video_480x360_webm_vp9_333kbps_25fps_vorbis_stereo_128kbps_44100hz, 240);
+ }
- int frames2 = countFrames(
- R.raw.video_480x360_webm_vp9_333kbps_25fps_vorbis_stereo_128kbps_44100hz,
- RESET_MODE_NONE, -1 /* eosframe */, null);
- assertEquals("different number of frames when using Surface", frames1, frames2);
+ public void testH264Decode320x240() throws Exception {
+ if (!hasH264(false)) {
+ Log.i(TAG, "SKIPPING testH264Decode320x240(): No codec found.");
+ return;
+ }
+ testDecode(R.raw.video_320x240_mp4_h264_800kbps_30fps_aac_stereo_128kbps_44100hz, 299);
+ }
+
+ public void testH264Decode720x480() throws Exception {
+ if (!hasH264(false)) {
+ Log.i(TAG, "SKIPPING testH264Decode720x480(): No codec found.");
+ return;
+ }
+ testDecode(R.raw.video_720x480_mp4_h264_2048kbps_30fps_aac_stereo_128kbps_44100hz, 299);
+ }
+
+ public void testH264Decode30fps1280x720Tv() throws Exception {
+ if (isTv() && !isDecodeFormatSupported(MediaFormat.MIMETYPE_VIDEO_AVC, 1280, 720, 30)) {
+ fail("Profile is required for TV device.");
+ }
+ }
+
+ public void testH264Decode30fps1280x720() throws Exception {
+ if (!isDecodeFormatSupported(MediaFormat.MIMETYPE_VIDEO_AVC, 1280, 720, 30)) {
+ Log.i(TAG, "SKIPPING testH264Decode30fps1280x720(): Unsupported profile.");
+ return;
+ }
+
+ testDecode(R.raw.video_1280x720_mp4_h264_8192kbps_30fps_aac_stereo_128kbps_44100hz, 299);
+ }
+
+ public void testH264Decode60fps1280x720Tv() throws Exception {
+ if (isTv() && !isDecodeFormatSupported(MediaFormat.MIMETYPE_VIDEO_AVC, 1280, 720, 60)) {
+ fail("Profile is required for TV device.");
+ }
+ }
+
+ public void testH264Decode60fps1280x720() throws Exception {
+ if (!isDecodeFormatSupported(MediaFormat.MIMETYPE_VIDEO_AVC, 1280, 720, 60)) {
+ Log.i(TAG, "SKIPPING testH264Decode60fps1280x720(): Unsupported profile.");
+ return;
+ }
+ testDecode(R.raw.video_1280x720_mp4_h264_8192kbps_60fps_aac_stereo_128kbps_44100hz, 596);
+ }
+
+ public void testH264Decode30fps1920x1080Tv() throws Exception {
+ if (isTv() && !isDecodeFormatSupported(MediaFormat.MIMETYPE_VIDEO_AVC, 1920, 1080, 30)) {
+ fail("Profile is required for TV device.");
+ }
+ }
+
+ public void testH264Decode30fps1920x1080() throws Exception {
+ if (!isDecodeFormatSupported(MediaFormat.MIMETYPE_VIDEO_AVC, 1920, 1080, 30)) {
+ Log.i(TAG, "SKIPPING testH264Decode30fps1920x1080(): Unsupported profile.");
+ return;
+ }
+ testDecode(R.raw.video_1920x1080_mp4_h264_20480kbps_30fps_aac_stereo_128kbps_44100hz, 299);
+ }
+
+ public void testH264Decode60fps1920x1080Tv() throws Exception {
+ if (isTv() && !isDecodeFormatSupported(MediaFormat.MIMETYPE_VIDEO_AVC, 1920, 1080, 60)) {
+ fail("Profile is required for TV device.");
+ }
+ }
+
+ public void testH264Decode60fps1920x1080() throws Exception {
+ if (!isDecodeFormatSupported(MediaFormat.MIMETYPE_VIDEO_AVC, 1920, 1080, 60)) {
+ Log.i(TAG, "SKIPPING testH264Decode60fps1920x1080(): Unsupported profile.");
+ return;
+ }
+ testDecode(R.raw.video_1920x1080_mp4_h264_20480kbps_60fps_aac_stereo_128kbps_44100hz, 596);
+ }
+
+ public void testVP8Decode320x240() throws Exception {
+ if (!hasVP8(false)) {
+ Log.i(TAG, "SKIPPING testVP8Decode320x240(): No codec found.");
+ return;
+ }
+ testDecode(R.raw.video_320x240_webm_vp8_800kbps_30fps_vorbis_stereo_128kbps_44100hz, 249);
+ }
+
+ public void testVP8Decode640x360() throws Exception {
+ if (!hasVP8(false)) {
+ Log.i(TAG, "SKIPPING testVP8Decode640x360(): No codec found.");
+ return;
+ }
+ testDecode(R.raw.video_640x360_webm_vp8_2048kbps_30fps_vorbis_stereo_128kbps_44100hz, 249);
+ }
+
+ public void testVP8Decode30fps1280x720Tv() throws Exception {
+ if (isTv() && !isDecodeFormatSupported(MediaFormat.MIMETYPE_VIDEO_VP8, 1280, 720, 30)) {
+ fail("Profile is required for TV device.");
+ }
+ }
+
+ public void testVP8Decode30fps1280x720() throws Exception {
+ if (!isDecodeFormatSupported(MediaFormat.MIMETYPE_VIDEO_VP8, 1280, 720, 30)) {
+ Log.i(TAG, "SKIPPING testVP8Decode30fps1280x720(): Unsupported profile.");
+ return;
+ }
+ testDecode(R.raw.video_1280x720_webm_vp8_8192kbps_30fps_vorbis_stereo_128kbps_44100hz, 249);
+ }
+
+ public void testVP8Decode60fps1280x720Tv() throws Exception {
+ if (isTv() && !isDecodeFormatSupported(MediaFormat.MIMETYPE_VIDEO_VP8, 1280, 720, 60)) {
+ fail("Profile is required for TV device.");
+ }
+ }
+
+ public void testVP8Decode60fps1280x720() throws Exception {
+ if (!isDecodeFormatSupported(MediaFormat.MIMETYPE_VIDEO_VP8, 1280, 720, 60)) {
+ Log.i(TAG, "SKIPPING testVP8Decode60fps1280x720(): Unsupported profile.");
+ return;
+ }
+ testDecode(R.raw.video_1280x720_webm_vp8_8192kbps_60fps_vorbis_stereo_128kbps_44100hz, 249);
+ }
+
+ public void testVP8Decode30fps1920x1080Tv() throws Exception {
+ if (isTv() && !isDecodeFormatSupported(MediaFormat.MIMETYPE_VIDEO_VP8, 1920, 1080, 30)) {
+ fail("Profile is required for TV device.");
+ }
+ }
+
+ public void testVP8Decode30fps1920x1080() throws Exception {
+ if (!isDecodeFormatSupported(MediaFormat.MIMETYPE_VIDEO_VP8, 1920, 1080, 30)) {
+ Log.i(TAG, "SKIPPING testVP8Decode30fps1920x1080(): Unsupported profile.");
+ return;
+ }
+ testDecode(R.raw.video_1920x1080_webm_vp8_20480kbps_30fps_vorbis_stereo_128kbps_44100hz,
+ 249);
+ }
+
+ public void testVP8Decode60fps1920x1080Tv() throws Exception {
+ if (isTv() && !isDecodeFormatSupported(MediaFormat.MIMETYPE_VIDEO_VP8, 1920, 1080, 60)) {
+ fail("Profile is required for TV device.");
+ }
+ }
+
+ public void testVP8Decode60fps1920x1080() throws Exception {
+ if (!isDecodeFormatSupported(MediaFormat.MIMETYPE_VIDEO_VP8, 1920, 1080, 60)) {
+ Log.i(TAG, "SKIPPING testVP8Decode60fps1920x1080(): Unsupported profile.");
+ return;
+ }
+ testDecode(R.raw.video_1920x1080_webm_vp8_20480kbps_60fps_vorbis_stereo_128kbps_44100hz,
+ 249);
+ }
+
+ public void testVP9Decode320x240() throws Exception {
+ if (!hasVP9(false)) {
+ Log.i(TAG, "SKIPPING testVP9Decode320x240(): No codec found.");
+ return;
+ }
+ testDecode(R.raw.video_320x240_webm_vp9_600kbps_30fps_vorbis_stereo_128kbps_44100hz, 249);
+ }
+
+ public void testVP9Decode640x360() throws Exception {
+ if (!hasVP9(false)) {
+ Log.i(TAG, "SKIPPING testVP9Decode640x360(): No codec found.");
+ return;
+ }
+ testDecode(R.raw.video_640x360_webm_vp9_1638kbps_30fps_vorbis_stereo_128kbps_44100hz, 249);
+ }
+
+ public void testVP9Decode30fps1280x720Tv() throws Exception {
+ if (isTv() && !isDecodeFormatSupported(MediaFormat.MIMETYPE_VIDEO_VP9, 1280, 720, 30)) {
+ fail("Profile is required for TV device.");
+ }
+ }
+
+ public void testVP9Decode30fps1280x720() throws Exception {
+ if (!isDecodeFormatSupported(MediaFormat.MIMETYPE_VIDEO_VP9, 1280, 720, 30)) {
+ Log.i(TAG, "SKIPPING testVP8Decode30fps1920x1080(): Unsupported profile.");
+ return;
+ }
+ testDecode(R.raw.video_1280x720_webm_vp9_4096kbps_30fps_vorbis_stereo_128kbps_44100hz, 249);
+ }
+
+ public void testVP9Decode30fps1920x1080() throws Exception {
+ if (!isDecodeFormatSupported(MediaFormat.MIMETYPE_VIDEO_VP9, 1920, 1080, 30)) {
+ Log.d(TAG, "SKIPPING testVP9Decode30fps1920x1080(): Unsupported optional profile.");
+ return;
+ }
+
+ testDecode(R.raw.video_1920x1080_webm_vp9_10240kbps_30fps_vorbis_stereo_128kbps_44100hz,
+ 249);
+ }
+
+ public void testVP9Decode30fps3840x2160() throws Exception {
+ if (!isDecodeFormatSupported(MediaFormat.MIMETYPE_VIDEO_VP9, 3840, 2160, 30)) {
+ Log.d(TAG, "SKIPPING testVP9Decode30fps3840x2160(): Unsupported optional profile.");
+ return;
+ }
+
+ testDecode(R.raw.video_3840x2160_webm_vp9_20480kbps_30fps_vorbis_stereo_128kbps_44100hz,
+ 249);
+ }
+
+ public void testHEVCDecode352x288() throws Exception {
+ if (!hasHEVC(false)) {
+ Log.i(TAG, "SKIPPING testHEVCDecode352x288(): No codec found.");
+ return;
+ }
+ testDecode(R.raw.video_352x288_mp4_hevc_600kbps_30fps_aac_stereo_128kbps_44100hz, 299);
+ }
+
+ public void testHEVCDecode720x480() throws Exception {
+ if (!hasHEVC(false)) {
+ Log.i(TAG, "SKIPPING testHEVCDecode720x480(): No codec found.");
+ return;
+ }
+ testDecode(R.raw.video_720x480_mp4_hevc_1638kbps_30fps_aac_stereo_128kbps_44100hz, 299);
+ }
+
+ public void testHEVCDecode30fps1280x720Tv() throws Exception {
+ if (isTv() && !isDecodeFormatSupported(MediaFormat.MIMETYPE_VIDEO_HEVC, 1280, 720, 30)) {
+ fail("Profile is required for TV device.");
+ }
+ }
+
+ public void testHEVCDecode30fps1280x720() throws Exception {
+ if (!isDecodeFormatSupported(MediaFormat.MIMETYPE_VIDEO_HEVC, 1280, 720, 30)) {
+ Log.i(TAG, "SKIPPING testHEVCDecode30fps1280x720(): Unsupported profile.");
+ return;
+ }
+ testDecode(R.raw.video_1280x720_mp4_hevc_4096kbps_30fps_aac_stereo_128kbps_44100hz, 299);
+ }
+
+ public void testHEVCDecode30fps1920x1080Tv() throws Exception {
+ if (isTv() && !isDecodeFormatSupported(MediaFormat.MIMETYPE_VIDEO_HEVC, 1920, 1080, 30)) {
+ fail("Profile is required for TV device.");
+ }
+ }
+
+ public void testHEVCDecode30fps1920x1080() throws Exception {
+ if (!isDecodeFormatSupported(MediaFormat.MIMETYPE_VIDEO_HEVC, 1920, 1080, 30)) {
+ Log.i(TAG, "SKIPPING testHEVCDecode30fps1920x1080(): Unsupported profile.");
+ return;
+ }
+ testDecode(R.raw.video_1920x1080_mp4_hevc_10240kbps_30fps_aac_stereo_128kbps_44100hz, 299);
+ }
+
+ public void testHEVCDecode30fps2840x2160() throws Exception {
+ if (!isDecodeFormatSupported(MediaFormat.MIMETYPE_VIDEO_HEVC, 2840, 2160, 30)) {
+ Log.i(TAG, "SKIPPING testHEVCDecode30fps2840x2160(): Unsupported optional profile.");
+ return;
+ }
+ testDecode(R.raw.video_2840x2160_mp4_hevc_20480kbps_30fps_aac_stereo_128kbps_44100hz, 299);
}
public void testCodecEarlyEOSH263() throws Exception {
diff --git a/tests/tests/media/src/android/media/cts/MediaPlayerTestBase.java b/tests/tests/media/src/android/media/cts/MediaPlayerTestBase.java
index 09a593a..986cd08 100644
--- a/tests/tests/media/src/android/media/cts/MediaPlayerTestBase.java
+++ b/tests/tests/media/src/android/media/cts/MediaPlayerTestBase.java
@@ -381,4 +381,19 @@
return packageManager.hasSystemFeature("android.hardware.type.television") ||
packageManager.hasSystemFeature("android.software.leanback");
}
+
+ private static boolean isFormatSupported(
+ String mimeType, int w, int h, int frameRate, boolean isEncoder) {
+ MediaCodecList mcl = new MediaCodecList(MediaCodecList.REGULAR_CODECS);
+ MediaFormat format = MediaFormat.createVideoFormat(mimeType, w, h);
+ format.setInteger(MediaFormat.KEY_FRAME_RATE, frameRate);
+ String codec = isEncoder
+ ? mcl.findEncoderForFormat(format)
+ : mcl.findDecoderForFormat(format);
+ return (codec != null);
+ }
+
+ public static boolean isDecodeFormatSupported(String mimeType, int w, int h, int frameRate) {
+ return isFormatSupported(mimeType, w, h, frameRate, false /* isEncoder */);
+ }
}