summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarco Nelissen <marcone@google.com>2013-06-04 18:10:36 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2013-06-04 18:10:36 +0000
commit03a036f32fb0f77f4360cb83f052e329608c350d (patch)
treee17d2e965517cfc7907cc65e90a5c654c197e29c
parent6fde66113ca453bd79ce3dbc779bd3eabf478242 (diff)
parent1cb78bd1bff9850ec792a1b73d47fd7707f2f0ec (diff)
downloadcts-03a036f32fb0f77f4360cb83f052e329608c350d.tar.gz
Merge "Don't test reconfiguration for Vorbis" into jb-mr2-dev
-rw-r--r--tests/tests/media/src/android/media/cts/DecoderTest.java25
1 files changed, 14 insertions, 11 deletions
diff --git a/tests/tests/media/src/android/media/cts/DecoderTest.java b/tests/tests/media/src/android/media/cts/DecoderTest.java
index 4700d85d87d..077c9f3c35c 100644
--- a/tests/tests/media/src/android/media/cts/DecoderTest.java
+++ b/tests/tests/media/src/android/media/cts/DecoderTest.java
@@ -69,30 +69,31 @@ public class DecoderTest extends MediaPlayerTestBase {
// This should allow for some variation in decoders, while still detecting
// phase and delay errors, channel swap, etc.
public void testDecodeMp3Lame() throws Exception {
- decode(R.raw.sinesweepmp3lame, 804.f);
+ decode(R.raw.sinesweepmp3lame, 804.f, true);
}
public void testDecodeMp3Smpb() throws Exception {
- decode(R.raw.sinesweepmp3smpb, 413.f);
+ decode(R.raw.sinesweepmp3smpb, 413.f, true);
}
public void testDecodeM4a() throws Exception {
- decode(R.raw.sinesweepm4a, 124.f);
+ decode(R.raw.sinesweepm4a, 124.f, true);
}
public void testDecodeOgg() throws Exception {
- decode(R.raw.sinesweepogg, 168.f);
+ decode(R.raw.sinesweepogg, 168.f, false);
}
public void testDecodeWav() throws Exception {
- decode(R.raw.sinesweepwav, 0.0f);
+ decode(R.raw.sinesweepwav, 0.0f, true);
}
public void testDecodeFlac() throws Exception {
- decode(R.raw.sinesweepflac, 0.0f);
+ decode(R.raw.sinesweepflac, 0.0f, true);
}
/**
* @param testinput the file to decode
* @param maxerror the maximum allowed root mean squared error
+ * @param testReconfigure whether to also test reconfiguring the codec
* @throws IOException
*/
- private void decode(int testinput, float maxerror) throws IOException {
+ private void decode(int testinput, float maxerror, boolean reconfigure) throws IOException {
short [] decoded = decodeToMemory(testinput, false);
@@ -111,10 +112,12 @@ public class DecoderTest extends MediaPlayerTestBase {
double rmse = Math.sqrt(avgErrorSquared);
assertTrue("decoding error too big: " + rmse, rmse <= maxerror);
- short [] decoded2 = decodeToMemory(testinput, true);
- assertEquals("count different with reconfigure", decoded.length, decoded2.length);
- for (int i = 0; i < decoded.length; i++) {
- assertEquals("samples don't match", decoded[i], decoded2[i]);
+ if (reconfigure) {
+ short [] decoded2 = decodeToMemory(testinput, true);
+ assertEquals("count different with reconfigure", decoded.length, decoded2.length);
+ for (int i = 0; i < decoded.length; i++) {
+ assertEquals("samples don't match", decoded[i], decoded2[i]);
+ }
}
}