Increase timeout on decoding accuracy tests

increases the timeout for the accuracy tests to ensure that some of the
older (slower) devices have time to process huge (3840x2160) frames.
The tests decode only 10 frames, so startup time is a more significant
part of the test and had not been well accounted for in the calculation
of what the timeout should be.

Bug: 66144372
Test: ran affected CTS tests on bullhead
Change-Id: I3ca03f85dab4b4aa89f349d726e69aa487151824
diff --git a/tests/tests/media/src/android/media/cts/DecodeAccuracyTestBase.java b/tests/tests/media/src/android/media/cts/DecodeAccuracyTestBase.java
index 58f1607..613a4b8 100644
--- a/tests/tests/media/src/android/media/cts/DecodeAccuracyTestBase.java
+++ b/tests/tests/media/src/android/media/cts/DecodeAccuracyTestBase.java
@@ -137,7 +137,8 @@
     @TargetApi(16)
     static class SimplePlayer {
 
-        public static final long MIN_MS_PER_FRAME = TimeUnit.SECONDS.toMillis(1) / 10; // 10 FPS
+        public static final long MIN_MS_PER_FRAME = TimeUnit.SECONDS.toMillis(1) / 5; // 5 FPS
+        public static final long STARTUP_ALLOW_MS = TimeUnit.SECONDS.toMillis(1) ;
         public static final int END_OF_STREAM = -1;
         public static final int DEQUEUE_SUCCESS = 1;
         public static final int DEQUEUE_FAIL = 0;
@@ -183,7 +184,7 @@
             if (prepareVideoDecode(videoFormat)) {
                 if (startDecoder()) {
                     final long timeout =
-                            Math.max(MIN_MS_PER_FRAME, msPerFrameCap) * numOfTotalFrames * 2;
+                            Math.max(MIN_MS_PER_FRAME, msPerFrameCap) * numOfTotalFrames + STARTUP_ALLOW_MS;
                     playerResult = decodeFramesAndPlay(numOfTotalFrames, timeout, msPerFrameCap);
                 } else {
                     playerResult = PlayerResult.failToStart();
@@ -287,6 +288,9 @@
                     Log.e(TAG, "IllegalStateException in dequeueDecoderOutputBuffer", exception);
                 }
             }
+            // NB: totalTime measures from "first output" instead of
+            // "first INPUT", so does not include first frame latency
+            // and therefore does not tell us if the timeout expired
             final long totalTime = SystemClock.elapsedRealtime() - firstOutputTimeMs;
             return new PlayerResult(true, true, numOfTotalFrames == numOfDecodedFrames, totalTime);
         }