DecoderTest: add testLowLatencyVp9
Also fix calculation of average latency
Test: this test
Bug: 134970151
Change-Id: I326dbed92746418c3ac4e712ab33bd7a0fa848f8
diff --git a/tests/tests/media/src/android/media/cts/DecoderTest.java b/tests/tests/media/src/android/media/cts/DecoderTest.java
index 041b112..7bcef3c 100644
--- a/tests/tests/media/src/android/media/cts/DecoderTest.java
+++ b/tests/tests/media/src/android/media/cts/DecoderTest.java
@@ -57,7 +57,6 @@
import java.util.concurrent.TimeUnit;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import java.util.stream.LongStream;
import static android.media.MediaCodecInfo.CodecProfileLevel.*;
@@ -3340,12 +3339,27 @@
return pm.hasSystemFeature(PackageManager.FEATURE_VR_MODE_HIGH_PERFORMANCE);
}
- public void testLowLatencyAVC() throws Exception {
+ public void testLowLatencyVp9At1280x720() throws Exception {
+ testLowLatencyVideo(
+ R.raw.video_1280x720_webm_vp9_csd_309kbps_25fps_vorbis_stereo_128kbps_48000hz, 300);
+ }
+
+ public void testLowLatencyVp9At1920x1080() throws Exception {
+ testLowLatencyVideo(
+ R.raw.bbb_s2_1920x1080_webm_vp9_0p41_10mbps_60fps_vorbis_6ch_384kbps_22050hz, 300);
+ }
+
+ public void testLowLatencyVp9At3840x2160() throws Exception {
+ testLowLatencyVideo(
+ R.raw.bbb_s2_3840x2160_webm_vp9_0p51_20mbps_60fps_vorbis_6ch_384kbps_32000hz, 300);
+ }
+
+ public void testLowLatencyAVCAt1280x720() throws Exception {
testLowLatencyVideo(
R.raw.video_1280x720_mp4_h264_1000kbps_25fps_aac_stereo_128kbps_44100hz, 300);
}
- public void testLowLatencyHEVC() throws Exception {
+ public void testLowLatencyHEVCAt480x360() throws Exception {
testLowLatencyVideo(
R.raw.video_480x360_mp4_hevc_650kbps_30fps_aac_stereo_128kbps_48000hz, 300);
}
@@ -3448,10 +3462,21 @@
assertTrue("No INFO_OUTPUT_FORMAT_CHANGED from decoder", decoderOutputFormat != null);
- LongStream longStream = Arrays.stream(latencyMs);
- long latencyMean = (long)longStream.average().getAsDouble();
- long latencyMax = longStream.max().getAsLong();
- Log.d(TAG, "latency average " + latencyMean + " ms, max " + latencyMax + " ms");
+ long latencyMean = 0;
+ long latencyMax = 0;
+ int maxIndex = 0;
+ for (int i = 0; i < bufferCounter; ++i) {
+ latencyMean += latencyMs[i];
+ if (latencyMs[i] > latencyMax) {
+ latencyMax = latencyMs[i];
+ maxIndex = i;
+ }
+ }
+ if (bufferCounter > 0) {
+ latencyMean /= bufferCounter;
+ }
+ Log.d(TAG, "latency average " + latencyMean + " ms, max " + latencyMax + " ms at frame " +
+ maxIndex);
DeviceReportLog log = new DeviceReportLog(REPORT_LOG_NAME, "video_decoder_latency");
String message = MediaPerfUtils.addPerformanceHeadersToLog(