summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernhard Rosenkraenzer <bero@arklinux.org>2011-07-02 20:52:32 +0000
committerBernhard Rosenkraenzer <bero@arklinux.org>2011-07-02 20:52:32 +0000
commit04e7834cbcc92c0201b4fafbc9f254d7cf121918 (patch)
tree238627c439f9a7952e2e4bceaa24faeddc912958
parentf1ce327a37be2edd85a7b3f59beed0b55d70bb2f (diff)
downloadmmtest-04e7834cbcc92c0201b4fafbc9f254d7cf121918.tar.gz
Compare playing time vs. getDuration()
-rw-r--r--mmtest/src/org/linaro/mmtest/MultimediaTest.java15
1 files changed, 13 insertions, 2 deletions
diff --git a/mmtest/src/org/linaro/mmtest/MultimediaTest.java b/mmtest/src/org/linaro/mmtest/MultimediaTest.java
index a0c5be7..ea50154 100644
--- a/mmtest/src/org/linaro/mmtest/MultimediaTest.java
+++ b/mmtest/src/org/linaro/mmtest/MultimediaTest.java
@@ -10,6 +10,7 @@ import android.media.MediaPlayer;
import android.media.MediaPlayer.OnCompletionListener;
import android.view.SurfaceView;
+import java.lang.Math;
import java.util.List;
public class MultimediaTest extends Activity implements android.media.MediaPlayer.OnCompletionListener,android.media.MediaPlayer.OnErrorListener,android.media.MediaPlayer.OnInfoListener {
@@ -17,6 +18,8 @@ public class MultimediaTest extends Activity implements android.media.MediaPlaye
private int currentTest = -1;
private MediaPlayer mp;
private String failure;
+ private long timestamp;
+ private int expectedDuration;
private final Test[] tests = {
// Audio Codecs
new Test("test-AAC-Stereo-96k.m4a", "AAC Stereo 96k", false),
@@ -108,14 +111,22 @@ public class MultimediaTest extends Activity implements android.media.MediaPlaye
Log.i(TAG, "PASS:" + tests[currentTest].name + ":sanityCheck:Test and Player agree about whether or not the content has a video part");
else
Log.i(TAG, "FAIL:" + tests[currentTest].name + ":sanityCheck:Test and Player disagree about whether or not the content has a video part");
+ timestamp = System.currentTimeMillis();
+ expectedDuration = mp.getDuration();
+ if(expectedDuration <= 0)
+ Log.i(TAG, "WARN:" + tests[currentTest].name + ":Couldn't determine duration");
mp.start();
}
@Override
public void onCompletion(MediaPlayer mp) {
- if(failure.length() == 0)
+ long elapsedTime = System.currentTimeMillis() - timestamp;
+ if(failure.length() == 0) {
+ if(expectedDuration >= 0 && Math.abs(elapsedTime - expectedDuration) > 10000) {
+ Log.i(TAG, "WARN:" + tests[currentTest].name + ":Actual playing time (" + Long.toString(elapsedTime) + "ms) differs significantly from expected time (" + Integer.toString(expectedDuration) + "ms)");
+ }
Log.i(TAG, "PASS:" + tests[currentTest].name + ":playback");
- else
+ } else
Log.i(TAG, "FAIL:" + tests[currentTest].name + ":playback:" + failure);
runNextTest();
}