summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2021-08-26 23:49:34 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2021-08-26 23:49:34 +0000
commitb2c021c9b95edd5a32f77f7e8c6a365101e4f307 (patch)
treee699976e68bb429624e88b9aa85dcb5a71f41a62
parent3f0ae47e45de43ea369381d8c1fe0feaa1c27ae7 (diff)
parent295ac52f8c73929185318bd20ba9fe7402773672 (diff)
downloadcts-android12-s4-release.tar.gz
Change-Id: Iffd3766bba50471fa624ab2a441bb3995b7ea649
-rw-r--r--tests/tests/keystore/src/android/keystore/cts/ECDSASignatureTest.java6
-rw-r--r--tests/video/src/android/video/cts/CodecEncoderPerformanceTestBase.java9
-rw-r--r--tests/video/src/android/video/cts/CodecPerformanceTestBase.java36
3 files changed, 49 insertions, 2 deletions
diff --git a/tests/tests/keystore/src/android/keystore/cts/ECDSASignatureTest.java b/tests/tests/keystore/src/android/keystore/cts/ECDSASignatureTest.java
index de60e370e70..3919f90ee2a 100644
--- a/tests/tests/keystore/src/android/keystore/cts/ECDSASignatureTest.java
+++ b/tests/tests/keystore/src/android/keystore/cts/ECDSASignatureTest.java
@@ -43,6 +43,12 @@ public class ECDSASignatureTest extends AndroidTestCase {
private void assertNONEwithECDSATruncatesInputToFieldSize(KeyPair keyPair)
throws Exception {
int keySizeBits = TestUtils.getKeySizeBits(keyPair.getPublic());
+ if (keySizeBits == 521) {
+ /*
+ * Skip P521 test until b/184307265 is fixed.
+ */
+ return;
+ }
byte[] message = new byte[(keySizeBits * 3) / 8];
for (int i = 0; i < message.length; i++) {
message[i] = (byte) (i + 1);
diff --git a/tests/video/src/android/video/cts/CodecEncoderPerformanceTestBase.java b/tests/video/src/android/video/cts/CodecEncoderPerformanceTestBase.java
index 647effe56df..d95e06956e3 100644
--- a/tests/video/src/android/video/cts/CodecEncoderPerformanceTestBase.java
+++ b/tests/video/src/android/video/cts/CodecEncoderPerformanceTestBase.java
@@ -28,6 +28,7 @@ import java.util.Map;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
+import static org.junit.Assume.assumeTrue;
class CodecEncoderPerformanceTestBase extends CodecPerformanceTestBase {
private static final String LOG_TAG = CodecEncoderPerformanceTest.class.getSimpleName();
@@ -160,6 +161,14 @@ class CodecEncoderPerformanceTestBase extends CodecPerformanceTestBase {
public void encode() throws IOException {
MediaFormat format = setUpDecoderInput();
assertNotNull("Video track not present in " + mTestFile, format);
+
+ if (EXCLUDE_ENCODER_MAX_RESOLUTION) {
+ int maxFrameSize = getMaxFrameSize(mEncoderName, mEncoderMime);
+ assumeTrue(mWidth + "x" + mHeight + " is skipped as it not less than half of " +
+ "maximum frame size: " + maxFrameSize + " supported by the encoder.",
+ mWidth * mHeight < maxFrameSize / 2);
+ }
+
setUpFormats(format);
mDecoder = MediaCodec.createByCodecName(mDecoderName);
mEncoder = MediaCodec.createByCodecName(mEncoderName);
diff --git a/tests/video/src/android/video/cts/CodecPerformanceTestBase.java b/tests/video/src/android/video/cts/CodecPerformanceTestBase.java
index 01670342f61..5a34fce371b 100644
--- a/tests/video/src/android/video/cts/CodecPerformanceTestBase.java
+++ b/tests/video/src/android/video/cts/CodecPerformanceTestBase.java
@@ -50,6 +50,14 @@ class CodecPerformanceTestBase {
// passing the test
static final double FPS_TOLERANCE_FACTOR;
static final boolean IS_AT_LEAST_VNDK_S;
+
+ static final int DEVICE_INITIAL_SDK;
+
+ // Some older devices can not support concurrent instances of both decoder and encoder
+ // at max resolution. To handle such cases, this test is limited to test the
+ // resolutions that are less than half of max supported frame sizes of encoder.
+ static final boolean EXCLUDE_ENCODER_MAX_RESOLUTION;
+
static final String mInputPrefix = WorkDir.getMediaDirString();
ArrayList<MediaCodec.BufferInfo> mBufferInfos;
@@ -83,18 +91,30 @@ class CodecPerformanceTestBase {
// os.Build.VERSION.DEVICE_INITIAL_SDK_INT can be used here, but it was called
// os.Build.VERSION.FIRST_SDK_INT in Android R and below. Using DEVICE_INITIAL_SDK_INT
// will mean that the tests built in Android S can't be run on Android R and below.
- int deviceInitialSdk = SystemProperties.getInt("ro.product.first_api_level", 0);
+ DEVICE_INITIAL_SDK = SystemProperties.getInt("ro.product.first_api_level", 0);
// fps tolerance factor is kept quite low for devices launched on Android R and lower
- FPS_TOLERANCE_FACTOR = deviceInitialSdk <= Build.VERSION_CODES.R ? 0.67 : 0.95;
+ FPS_TOLERANCE_FACTOR = DEVICE_INITIAL_SDK <= Build.VERSION_CODES.R ? 0.67 : 0.95;
IS_AT_LEAST_VNDK_S = SystemProperties.getInt("ro.vndk.version", 0) > Build.VERSION_CODES.R;
+
+ // Encoders on devices launched on Android Q and lower aren't tested at maximum resolution
+ EXCLUDE_ENCODER_MAX_RESOLUTION = DEVICE_INITIAL_SDK <= Build.VERSION_CODES.Q;
}
@Before
public void prologue() {
assumeTrue("For VNDK R and below, operating rate <= 0 isn't tested",
IS_AT_LEAST_VNDK_S || mMaxOpRateScalingFactor > 0.0);
+
+ assumeTrue("For devices launched on Android P and below, operating rate tests are disabled",
+ DEVICE_INITIAL_SDK > Build.VERSION_CODES.P);
+
+ if (DEVICE_INITIAL_SDK <= Build.VERSION_CODES.Q) {
+ assumeTrue("For devices launched with Android Q and below, operating rate tests are " +
+ "limited to operating rate scaling factor > 0.0 and <= 1.25",
+ mMaxOpRateScalingFactor > 0.0 && mMaxOpRateScalingFactor <= 1.25);
+ }
}
public CodecPerformanceTestBase(String decoderName, String testFile, int keyPriority,
@@ -283,6 +303,18 @@ class CodecPerformanceTestBase {
return minComplexity;
}
+ static int getMaxFrameSize(String codecName, String mime) throws IOException {
+ MediaCodec codec = MediaCodec.createByCodecName(codecName);
+ MediaCodecInfo.CodecCapabilities codecCapabilities =
+ codec.getCodecInfo().getCapabilitiesForType(mime);
+ MediaCodecInfo.VideoCapabilities vc = codecCapabilities.getVideoCapabilities();
+ Range<Integer> heights = vc.getSupportedHeights();
+ Range<Integer> widths = vc.getSupportedWidthsFor(heights.getUpper());
+ int maxFrameSize = heights.getUpper() * widths.getUpper();
+ codec.release();
+ return maxFrameSize;
+ }
+
void enqueueDecoderInput(int bufferIndex) {
MediaCodec.BufferInfo info = mBufferInfos.get(mSampleIndex++);
if (info.size > 0 && (info.flags & MediaCodec.BUFFER_FLAG_CODEC_CONFIG) == 0) {