skip CompositionTest if avc encoding is not supported.
bug: 15321262
Change-Id: Ic9dac2d63f750c074d1ec8f592456a2c2c310571
diff --git a/tests/tests/media/src/android/media/cts/EncodeVirtualDisplayWithCompositionTest.java b/tests/tests/media/src/android/media/cts/EncodeVirtualDisplayWithCompositionTest.java
index d7ba82d..42e188c 100644
--- a/tests/tests/media/src/android/media/cts/EncodeVirtualDisplayWithCompositionTest.java
+++ b/tests/tests/media/src/android/media/cts/EncodeVirtualDisplayWithCompositionTest.java
@@ -138,6 +138,10 @@
public void testRendering800x480Locally() throws Throwable {
Log.i(TAG, "testRendering800x480Locally");
Pair<Integer, Integer> maxRes = checkMaxConcurrentEncodingDecodingResolution();
+ if (maxRes == null) {
+ Log.i(TAG, "codec not supported, skipping the test");
+ return;
+ }
if (maxRes.first >= 800 && maxRes.second >= 480) {
runTestRenderingInSeparateThread(800, 480, false, false);
} else {
@@ -148,6 +152,10 @@
public void testRenderingMaxResolutionLocally() throws Throwable {
Log.i(TAG, "testRenderingMaxResolutionLocally");
Pair<Integer, Integer> maxRes = checkMaxConcurrentEncodingDecodingResolution();
+ if (maxRes == null) {
+ Log.i(TAG, "codec not supported, skipping the test");
+ return;
+ }
Log.w(TAG, "Trying resolution w:" + maxRes.first + " h:" + maxRes.second);
runTestRenderingInSeparateThread(maxRes.first, maxRes.second, false, false);
}
@@ -155,6 +163,10 @@
public void testRendering800x480Remotely() throws Throwable {
Log.i(TAG, "testRendering800x480Remotely");
Pair<Integer, Integer> maxRes = checkMaxConcurrentEncodingDecodingResolution();
+ if (maxRes == null) {
+ Log.i(TAG, "codec not supported, skipping the test");
+ return;
+ }
if (maxRes.first >= 800 && maxRes.second >= 480) {
runTestRenderingInSeparateThread(800, 480, true, false);
} else {
@@ -165,6 +177,10 @@
public void testRenderingMaxResolutionRemotely() throws Throwable {
Log.i(TAG, "testRenderingMaxResolutionRemotely");
Pair<Integer, Integer> maxRes = checkMaxConcurrentEncodingDecodingResolution();
+ if (maxRes == null) {
+ Log.i(TAG, "codec not supported, skipping the test");
+ return;
+ }
Log.w(TAG, "Trying resolution w:" + maxRes.first + " h:" + maxRes.second);
runTestRenderingInSeparateThread(maxRes.first, maxRes.second, true, false);
}
@@ -172,6 +188,10 @@
public void testRendering800x480RemotelyWith3Windows() throws Throwable {
Log.i(TAG, "testRendering800x480RemotelyWith3Windows");
Pair<Integer, Integer> maxRes = checkMaxConcurrentEncodingDecodingResolution();
+ if (maxRes == null) {
+ Log.i(TAG, "codec not supported, skipping the test");
+ return;
+ }
if (maxRes.first >= 800 && maxRes.second >= 480) {
runTestRenderingInSeparateThread(800, 480, true, true);
} else {
@@ -182,6 +202,10 @@
public void testRendering800x480LocallyWith3Windows() throws Throwable {
Log.i(TAG, "testRendering800x480LocallyWith3Windows");
Pair<Integer, Integer> maxRes = checkMaxConcurrentEncodingDecodingResolution();
+ if (maxRes == null) {
+ Log.i(TAG, "codec not supported, skipping the test");
+ return;
+ }
if (maxRes.first >= 800 && maxRes.second >= 480) {
runTestRenderingInSeparateThread(800, 480, false, true);
} else {
@@ -400,6 +424,10 @@
private static final int NUM_RENDERING = 10;
private void doTestVirtualDisplayRecycles(int numDisplays) throws Exception {
CodecInfo codecInfo = getAvcSupportedFormatInfo();
+ if (codecInfo == null) {
+ Log.i(TAG, "no codec found, skipping");
+ return;
+ }
VirtualDisplayPresentation[] virtualDisplays = new VirtualDisplayPresentation[numDisplays];
for (int i = 0; i < NUM_CODEC_CREATION; i++) {
mCodecConfigReceived = false;
@@ -1323,6 +1351,9 @@
private static CodecInfo getAvcSupportedFormatInfo() {
MediaCodecInfo mediaCodecInfo = selectCodec(MIME_TYPE);
+ if (mediaCodecInfo == null) {
+ return null;
+ }
CodecCapabilities cap = mediaCodecInfo.getCapabilitiesForType(MIME_TYPE);
if (cap == null) { // not supported
return null;
@@ -1405,6 +1436,9 @@
*/
private Pair<Integer, Integer> checkMaxConcurrentEncodingDecodingResolution() {
CodecInfo codecInfo = getAvcSupportedFormatInfo();
+ if (codecInfo == null) {
+ return null;
+ }
int maxW = codecInfo.mMaxW;
int maxH = codecInfo.mMaxH;
if (maxW >= 1920 && maxH >= 1080) {