media: workaround: delay encoder creation in EncoderTest
This is to allow the previous encoder to be destroyed.
Bug: 191447420
Change-Id: I5822d9191863ae5c911068580fe16b6581268a2a
(cherry picked from commit ec0e9a8c5dd8b880cc289d6af5af41aceb40de0a)
diff --git a/tests/tests/media/src/android/media/cts/EncoderTest.java b/tests/tests/media/src/android/media/cts/EncoderTest.java
index c77356b..36c6919 100644
--- a/tests/tests/media/src/android/media/cts/EncoderTest.java
+++ b/tests/tests/media/src/android/media/cts/EncoderTest.java
@@ -325,6 +325,7 @@
private void testEncoder(String componentName, MediaFormat format)
throws FileNotFoundException {
+
Log.i(TAG, "testEncoder " + componentName + "/" + format);
// test with all zeroes/silence
testEncoder(componentName, format, 0, null, MODE_SILENT);
@@ -344,7 +345,6 @@
private void testEncoder(String componentName, MediaFormat format,
long startSeed, final String res, int mode) throws FileNotFoundException {
-
Log.i(TAG, "testEncoder " + componentName + "/" + mode + "/" + format);
int sampleRate = format.getInteger(MediaFormat.KEY_SAMPLE_RATE);
int channelCount = format.getInteger(MediaFormat.KEY_CHANNEL_COUNT);
@@ -373,6 +373,14 @@
istream = new FileInputStream(mInpPrefix + res);
}
+ // TODO(b/191447420) WORKAROUND: sleep for 30 msec before starting new codec to allow
+ // previous codec to get deleted.
+ try {
+ Thread.sleep(30);
+ } catch (InterruptedException e) {
+ // ignore interrupted exception for this workaround
+ }
+
Random random = new Random(startSeed);
MediaCodec codec;
try {
@@ -491,4 +499,3 @@
}
}
}
-