1 /*
2  * Copyright (C) 2021 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package android.mediav2.cts;
18 
19 import static android.mediav2.common.cts.CodecTestBase.SupportClass.CODEC_ALL;
20 import static android.mediav2.common.cts.CodecTestBase.SupportClass.CODEC_ANY;
21 import static android.mediav2.common.cts.CodecTestBase.SupportClass.CODEC_DEFAULT;
22 import static android.mediav2.common.cts.CodecTestBase.SupportClass.CODEC_HW;
23 import static android.mediav2.common.cts.CodecTestBase.SupportClass.CODEC_OPTIONAL;
24 
25 import static org.junit.Assert.assertEquals;
26 import static org.junit.Assert.fail;
27 
28 import android.media.AudioFormat;
29 import android.media.MediaCodec;
30 import android.media.MediaExtractor;
31 import android.media.MediaFormat;
32 import android.mediav2.common.cts.CodecDecoderTestBase;
33 import android.mediav2.common.cts.OutputManager;
34 
35 import androidx.test.filters.LargeTest;
36 
37 import com.android.compatibility.common.util.ApiTest;
38 import com.android.compatibility.common.util.CddTest;
39 import com.android.compatibility.common.util.MediaUtils;
40 
41 import org.junit.Assume;
42 import org.junit.Test;
43 import org.junit.runner.RunWith;
44 import org.junit.runners.Parameterized;
45 
46 import java.io.IOException;
47 import java.util.ArrayList;
48 import java.util.Arrays;
49 import java.util.Collection;
50 import java.util.List;
51 
52 /**
53  * The tests accepts multiple test vectors packaged in different way. For instance, Avc elementary
54  * stream can be packed in mp4, avi, mkv, ts, 3gp, webm and so on. These clips when decoded, are
55  * expected to yield same output. Similarly for Vpx, av1, no-show frame can be packaged in to
56  * separate access units or can be combined with a display frame in to one access unit. Both these
57  * scenarios are expected to give same output.
58  * <p>
59  * The test extracts and decodes the stream from all of its listed containers and verifies that
60  * they produce the same output. In short, the tests validate extractors, codecs together.
61  * <p>
62  * Additionally, as the test runs mediacodec in byte buffer mode,
63  * <ul>
64  *     <li>For normative video media types, the test expects the decoded output to be identical to
65  *     reference decoded output. The reference decoded output is represented by its CRC32
66  *     checksum and is sent to the test as a parameter along with the test clip.</li>
67  *     <li>For non normative media types, the decoded output is checked for consistency.</li>
68  *     <li>For lossless audio media types, the test verifies if the rms error between input and
69  *     output is 0.</li>
70  *     <li>For lossy audio media types, the test verifies if the rms error is within 5% of
71  *     reference rms error. The reference value is computed using reference decoder and is sent
72  *     to the test as a parameter along with the test clip.</li>
73  *     <li>For all video components, the test expects the output timestamp list to be identical to
74  *     input timestamp list.</li>
75  *     <li>For all audio components, the test expects the output timestamps to be strictly
76  *     increasing.</li>
77  *     <li>The test also checks correctness of essential keys of output format returned by
78  *     mediacodec.</li>
79  * </ul>
80  */
81 @RunWith(Parameterized.class)
82 public class CodecDecoderValidationTest extends CodecDecoderTestBase {
83     private static final String MEDIA_TYPE_RAW = MediaFormat.MIMETYPE_AUDIO_RAW;
84     private static final String MEDIA_TYPE_AMRNB = MediaFormat.MIMETYPE_AUDIO_AMR_NB;
85     private static final String MEDIA_TYPE_AMRWB = MediaFormat.MIMETYPE_AUDIO_AMR_WB;
86     private static final String MEDIA_TYPE_MP3 = MediaFormat.MIMETYPE_AUDIO_MPEG;
87     private static final String MEDIA_TYPE_AAC = MediaFormat.MIMETYPE_AUDIO_AAC;
88     private static final String MEDIA_TYPE_FLAC = MediaFormat.MIMETYPE_AUDIO_FLAC;
89     private static final String MEDIA_TYPE_VORBIS = MediaFormat.MIMETYPE_AUDIO_VORBIS;
90     private static final String MEDIA_TYPE_OPUS = MediaFormat.MIMETYPE_AUDIO_OPUS;
91     private static final String MEDIA_TYPE_MPEG2 = MediaFormat.MIMETYPE_VIDEO_MPEG2;
92     private static final String MEDIA_TYPE_H263 = MediaFormat.MIMETYPE_VIDEO_H263;
93     private static final String MEDIA_TYPE_MPEG4 = MediaFormat.MIMETYPE_VIDEO_MPEG4;
94     private static final String MEDIA_TYPE_AVC = MediaFormat.MIMETYPE_VIDEO_AVC;
95     private static final String MEDIA_TYPE_VP8 = MediaFormat.MIMETYPE_VIDEO_VP8;
96     private static final String MEDIA_TYPE_HEVC = MediaFormat.MIMETYPE_VIDEO_HEVC;
97     private static final String MEDIA_TYPE_VP9 = MediaFormat.MIMETYPE_VIDEO_VP9;
98     private static final String MEDIA_TYPE_AV1 = MediaFormat.MIMETYPE_VIDEO_AV1;
99     private static final String MEDIA_DIR = WorkDir.getMediaDirString();
100     private final String[] mSrcFiles;
101     private final String mRefFile;
102     private final float mRmsError;
103     private final long mRefCRC;
104     private final int mSampleRate;
105     private final int mChannelCount;
106     private final int mWidth;
107     private final int mHeight;
108     private final SupportClass mSupportRequirements;
109 
CodecDecoderValidationTest(String decoder, String mediaType, String[] srcFiles, String refFile, float rmsError, long refCRC, int sampleRate, int channelCount, int width, int height, SupportClass supportRequirements, String allTestParams)110     public CodecDecoderValidationTest(String decoder, String mediaType, String[] srcFiles,
111             String refFile, float rmsError, long refCRC, int sampleRate, int channelCount,
112             int width, int height, SupportClass supportRequirements, String allTestParams) {
113         super(decoder, mediaType, null, allTestParams);
114         mSrcFiles = srcFiles;
115         mRefFile = MEDIA_DIR + refFile;
116         mRmsError = rmsError;
117         mRefCRC = refCRC;
118         mSampleRate = sampleRate;
119         mChannelCount = channelCount;
120         mWidth = width;
121         mHeight = height;
122         mSupportRequirements = supportRequirements;
123     }
124 
125     @Parameterized.Parameters(name = "{index}_{0}_{1}")
input()126     public static Collection<Object[]> input() {
127         final boolean isEncoder = false;
128         final boolean needAudio = true;
129         final boolean needVideo = true;
130         // mediaType, array list of test files (underlying elementary stream is same, except they
131         // are placed in different containers), ref file, rms error, checksum, sample rate,
132         // channel count, width, height, SupportClass
133         final List<Object[]> exhaustiveArgsList = new ArrayList<>(Arrays.asList(new Object[][]{
134                 // vp9 test vectors with no-show frames signalled in alternate ways
135                 {MEDIA_TYPE_VP9, new String[]{"bbb_340x280_768kbps_30fps_vp9.webm",
136                         "bbb_340x280_768kbps_30fps_split_non_display_frame_vp9.webm"},
137                         null, -1.0f, 4122701060L, -1, -1, 340, 280, CODEC_ALL},
138                 {MEDIA_TYPE_VP9, new String[]{"bbb_520x390_1mbps_30fps_vp9.webm",
139                         "bbb_520x390_1mbps_30fps_split_non_display_frame_vp9.webm"},
140                         null, -1.0f, 1201859039L, -1, -1, 520, 390, CODEC_ALL},
141 
142                 // mpeg2 test vectors with interlaced fields signalled in alternate ways
143                 {MEDIA_TYPE_MPEG2, new String[]{
144                         "bbb_512x288_30fps_1mbps_mpeg2_interlaced_nob_1field.ts",
145                         "bbb_512x288_30fps_1mbps_mpeg2_interlaced_nob_2fields.mp4"},
146                         null, -1.0f, -1L, -1, -1, 512, 288, CODEC_ALL},
147 
148                 // misc mp3 test vectors
149                 {MEDIA_TYPE_MP3, new String[]{"bbb_1ch_16kHz_lame_vbr.mp3"},
150                         "bbb_1ch_16kHz_s16le.raw", 119.256073f, -1L, 16000, 1, -1, -1, CODEC_ALL},
151                 {MEDIA_TYPE_MP3, new String[]{"bbb_2ch_44kHz_lame_vbr.mp3"},
152                         "bbb_2ch_44kHz_s16le.raw", 53.069080f, -1L, 44100, 2, -1, -1, CODEC_ALL},
153 
154                 // mp3 test vectors with CRC
155                 {MEDIA_TYPE_MP3, new String[]{"bbb_2ch_44kHz_lame_crc.mp3"},
156                         "bbb_2ch_44kHz_s16le.raw", 104.089027f, -1L, 44100, 2, -1, -1, CODEC_ALL},
157 
158                 // video test vectors of non standard sizes
159                 {MEDIA_TYPE_MPEG2, new String[]{"bbb_642x642_2mbps_30fps_mpeg2.mp4"},
160                         null, -1.0f, -1L, -1, -1, 642, 642,
161                         MediaUtils.isTv() ? CODEC_ANY : CODEC_OPTIONAL},
162                 {MEDIA_TYPE_AVC, new String[]{"bbb_642x642_1mbps_30fps_avc.mp4"},
163                         null, -1.0f, 3947092788L, -1, -1, 642, 642, CODEC_ANY},
164                 {MEDIA_TYPE_VP8, new String[]{"bbb_642x642_1mbps_30fps_vp8.webm"},
165                         null, -1.0f, 516982978L, -1, -1, 642, 642, CODEC_ANY},
166                 {MEDIA_TYPE_HEVC, new String[]{"bbb_642x642_768kbps_30fps_hevc.mp4"},
167                         null, -1.0f, 3018465268L, -1, -1, 642, 642, CODEC_ANY},
168                 {MEDIA_TYPE_VP9, new String[]{"bbb_642x642_768kbps_30fps_vp9.webm"},
169                         null, -1.0f, 4032809269L, -1, -1, 642, 642, CODEC_ANY},
170                 {MEDIA_TYPE_AV1, new String[]{"bbb_642x642_768kbps_30fps_av1.mp4"},
171                         null, -1.0f, 3684481474L, -1, -1, 642, 642, CODEC_ANY},
172                 {MEDIA_TYPE_MPEG4, new String[]{"bbb_130x130_192kbps_15fps_mpeg4.mp4"},
173                         null, -1.0f, -1L, -1, -1, 130, 130, CODEC_ANY},
174 
175                 // video test vectors covering cdd requirements
176                 // @CddTest(requirement="5.3.1/C-1-1")
177                 {MEDIA_TYPE_MPEG2, new String[]{"bbb_1920x1080_30fps_mpeg2_main_high.mp4"}, null,
178                         -1.0f, -1L, -1, -1, 1920, 1080,
179                         MediaUtils.isTv() ? CODEC_ANY : CODEC_OPTIONAL},
180                 {MEDIA_TYPE_MPEG2,
181                         new String[]{"bbb_1920x1080_60fps_mpeg2_interlaced_main_high.mp4"}, null,
182                         -1.0f, -1L, -1, -1, 1920, 1080,
183                         MediaUtils.isTv() ? CODEC_ANY : CODEC_OPTIONAL},
184 
185                 // @CddTest(requirement="5.3.2/C-1-1")
186                 {MEDIA_TYPE_H263, new String[]{"bbb_352x288_384kbps_30fps_h263_baseline_l3.mp4"},
187                         null, -1.0f, -1L, -1, -1, 352, 288, CODEC_ALL},
188                 {MEDIA_TYPE_H263, new String[]{"bbb_176x144_125kbps_15fps_h263_baseline_l45.mkv"},
189                         null, -1.0f, -1L, -1, -1, 176, 144, CODEC_ALL},
190 
191                 // @CddTest(requirement="5.3.3/C-1-1")
192                 {MEDIA_TYPE_MPEG4, new String[]{"bbb_352x288_384kbps_30fps_mpeg4_simple_l3.mp4"},
193                         null, -1.0f, -1L, -1, -1, 352, 288, CODEC_ALL},
194 
195                 // @CddTest(requirements={"5.3.4/C-1-1", "5.3.4/C-1-2", "5.3.4/C-2-1"})
196                 {MEDIA_TYPE_AVC, new String[]{"bbb_320x240_30fps_avc_baseline_l13.mp4"}, null,
197                         -1.0f, 2227756491L, -1, -1, 320, 240, CODEC_ALL},
198                 {MEDIA_TYPE_AVC, new String[]{"bbb_320x240_30fps_avc_main_l31.mp4"}, null, -1.0f,
199                         3167475817L, -1, -1, 320, 240, CODEC_ALL},
200                 {MEDIA_TYPE_AVC, new String[]{"bbb_720x480_30fps_avc_baseline_l30.mp4"}, null,
201                         -1.0f, 256699624L, -1, -1, 720, 480, CODEC_ALL},
202                 {MEDIA_TYPE_AVC, new String[]{"bbb_720x480_30fps_avc_main_l31.mp4"}, null, -1.0f,
203                         1729385096L, -1, -1, 720, 480, CODEC_ALL},
204                 // 5.3.4/C-1-2 mandates 720p support for avc decoders, hence this is being tested
205                 // without any resolution check unlike the higher resolution tests for other codecs
206                 {MEDIA_TYPE_AVC, new String[]{"bbb_1280x720_30fps_avc_baseline_l31.mp4"}, null,
207                         -1.0f, 4290313980L, -1, -1, 1280, 720, CODEC_ALL},
208                 {MEDIA_TYPE_AVC, new String[]{"bbb_1280x720_30fps_avc_main_l31.mp4"}, null, -1.0f,
209                         3895426718L, -1, -1, 1280, 720, CODEC_ALL},
210                 {MEDIA_TYPE_AVC, new String[]{"bbb_1920x1080_60fps_avc_baseline_l31.mp4"},
211                         null, -1.0f, 3610967164L, -1, -1, 1920, 1080,
212                         MediaUtils.isTv() ? CODEC_ANY : CODEC_OPTIONAL},
213                 {MEDIA_TYPE_AVC, new String[]{"bbb_1920x1080_60fps_avc_main_l31.mp4"}, null, -1.0f,
214                         968877471L, -1, -1, 1920, 1080,
215                         MediaUtils.isTv() ? CODEC_ANY : CODEC_OPTIONAL},
216                 {MEDIA_TYPE_AVC, new String[]{"bbb_1920x1080_60fps_avc_high_l42.mp4"}, null, -1.0f,
217                         3420541750L, -1, -1, 1920, 1080,
218                         MediaUtils.isTv() ? CODEC_ANY : CODEC_OPTIONAL},
219 
220                 // @CddTest(requirement="5.3.5/C-1-1")
221                 {MEDIA_TYPE_HEVC, new String[]{"bbb_352x288_30fps_hevc_main_l2.mp4"}, null, -1.0f,
222                         40958220L, -1, -1, 352, 288, CODEC_ALL},
223                 {MEDIA_TYPE_HEVC, new String[]{"bbb_720x480_30fps_hevc_main_l3.mp4"}, null, -1.0f,
224                         3167173427L, -1, -1, 720, 480, CODEC_ALL},
225                 {MEDIA_TYPE_HEVC, new String[]{"bbb_1920x1080_60fps_hevc_main_l41.mp4"}, null,
226                         -1.0f, 694223139L, -1, -1, 1920, 1080,
227                         MediaUtils.isTv() ? CODEC_HW : CODEC_OPTIONAL},
228                 {MEDIA_TYPE_HEVC, new String[]{"bbb_3840x2160_60fps_hevc_main10_l5.mp4"}, null,
229                         -1.0f, 3762286888L, -1, -1, 3840, 2160,
230                         MediaUtils.isTv() ? CODEC_HW : CODEC_OPTIONAL},
231 
232                 // @CddTest(requirement="5.3.6/C-1-1")
233                 {MEDIA_TYPE_VP8, new String[]{"bbb_320x180_30fps_vp8.mkv"}, null, -1.0f,
234                         434981332L, -1, -1, 320, 180, CODEC_ALL},
235                 {MEDIA_TYPE_VP8, new String[]{"bbb_640x360_512kbps_30fps_vp8.webm"}, null, -1.0f,
236                         1625674868L, -1, -1, 640, 360, CODEC_ALL},
237                 {MEDIA_TYPE_VP8, new String[]{"bbb_1920x1080_60fps_vp8.webm"}, null, -1.0f,
238                         1890868351L, -1, -1, 1920, 1080,
239                         MediaUtils.isTv() ? CODEC_ANY : CODEC_OPTIONAL},
240 
241                 // @CddTest(requirement="5.3.7/C-1-1")
242                 {MEDIA_TYPE_VP9, new String[]{"bbb_320x180_30fps_vp9.mkv"}, null, -1.0f,
243                         2746035687L, -1, -1, 320, 180, CODEC_ALL},
244                 {MEDIA_TYPE_VP9, new String[]{"bbb_640x360_512kbps_30fps_vp9.webm"}, null, -1.0f,
245                         2974952943L, -1, -1, 640, 360, CODEC_ALL},
246                 {MEDIA_TYPE_VP9, new String[]{"bbb_1920x1080_60fps_vp9_profile0.mp4"}, null, -1.0f,
247                         3443986074L, -1, -1, 1920, 1080,
248                         MediaUtils.isTv() ? CODEC_HW : CODEC_OPTIONAL},
249                 {MEDIA_TYPE_VP9, new String[]{"bbb_3840x2160_60fps_vp9_profile0.mp4"}, null, -1.0f,
250                         2669556628L, -1, -1, 3840, 2160,
251                         MediaUtils.isTv() ? CODEC_HW : CODEC_OPTIONAL},
252 
253                 // @CddTest(requirement="5.3.9/C-1-1")
254                 {MEDIA_TYPE_AV1, new String[]{"cosmat_720x480_30fps_av1_10bit.mkv"}, null,
255                         -1.0f, 2380523095L, -1, -1, 720, 480, CODEC_ALL},
256                 {MEDIA_TYPE_AV1, new String[]{"bbb_720x480_30fps_av1.mkv"}, null, -1.0f,
257                         3229978305L, -1, -1, 720, 480, CODEC_ALL},
258 
259 
260                 // audio test vectors covering cdd sec 5.1.3
261                 // amrnb
262                 {MEDIA_TYPE_AMRNB, new String[]{"audio/bbb_mono_8kHz_12.2kbps_amrnb.3gp"},
263                         null, -1.0f, -1L, 8000, 1, -1, -1, CODEC_ALL},
264                 {MEDIA_TYPE_AMRNB, new String[]{"audio/bbb_mono_8kHz_10.2kbps_amrnb.3gp"},
265                         null, -1.0f, -1L, 8000, 1, -1, -1, CODEC_ALL},
266                 {MEDIA_TYPE_AMRNB, new String[]{"audio/bbb_mono_8kHz_7.95kbps_amrnb.3gp"},
267                         null, -1.0f, -1L, 8000, 1, -1, -1, CODEC_ALL},
268                 {MEDIA_TYPE_AMRNB, new String[]{"audio/bbb_mono_8kHz_7.40kbps_amrnb.3gp"},
269                         null, -1.0f, -1L, 8000, 1, -1, -1, CODEC_ALL},
270                 {MEDIA_TYPE_AMRNB, new String[]{"audio/bbb_mono_8kHz_6.70kbps_amrnb.3gp"},
271                         null, -1.0f, -1L, 8000, 1, -1, -1, CODEC_ALL},
272                 {MEDIA_TYPE_AMRNB, new String[]{"audio/bbb_mono_8kHz_5.90kbps_amrnb.3gp"},
273                         null, -1.0f, -1L, 8000, 1, -1, -1, CODEC_ALL},
274                 {MEDIA_TYPE_AMRNB, new String[]{"audio/bbb_mono_8kHz_5.15kbps_amrnb.3gp"},
275                         null, -1.0f, -1L, 8000, 1, -1, -1, CODEC_ALL},
276                 {MEDIA_TYPE_AMRNB, new String[]{"audio/bbb_mono_8kHz_4.75kbps_amrnb.3gp"},
277                         null, -1.0f, -1L, 8000, 1, -1, -1, CODEC_ALL},
278 
279                 // amrwb
280                 {MEDIA_TYPE_AMRWB, new String[]{"audio/bbb_mono_16kHz_6.6kbps_amrwb.3gp"},
281                         null, -1.0f, -1L, 16000, 1, -1, -1, CODEC_ALL},
282                 {MEDIA_TYPE_AMRWB, new String[]{"audio/bbb_mono_16kHz_8.85kbps_amrwb.3gp"},
283                         null, -1.0f, -1L, 16000, 1, -1, -1, CODEC_ALL},
284                 {MEDIA_TYPE_AMRWB, new String[]{"audio/bbb_mono_16kHz_12.65kbps_amrwb.3gp"},
285                         null, -1.0f, -1L, 16000, 1, -1, -1, CODEC_ALL},
286                 {MEDIA_TYPE_AMRWB, new String[]{"audio/bbb_mono_16kHz_14.25kbps_amrwb.3gp"},
287                         null, -1.0f, -1L, 16000, 1, -1, -1, CODEC_ALL},
288                 {MEDIA_TYPE_AMRWB, new String[]{"audio/bbb_mono_16kHz_15.85kbps_amrwb.3gp"},
289                         null, -1.0f, -1L, 16000, 1, -1, -1, CODEC_ALL},
290                 {MEDIA_TYPE_AMRWB, new String[]{"audio/bbb_mono_16kHz_18.25kbps_amrwb.3gp"},
291                         null, -1.0f, -1L, 16000, 1, -1, -1, CODEC_ALL},
292                 {MEDIA_TYPE_AMRWB, new String[]{"audio/bbb_mono_16kHz_19.85kbps_amrwb.3gp"},
293                         null, -1.0f, -1L, 16000, 1, -1, -1, CODEC_ALL},
294                 {MEDIA_TYPE_AMRWB, new String[]{"audio/bbb_mono_16kHz_23.05kbps_amrwb.3gp"},
295                         null, -1.0f, -1L, 16000, 1, -1, -1, CODEC_ALL},
296                 {MEDIA_TYPE_AMRWB, new String[]{"audio/bbb_mono_16kHz_23.85kbps_amrwb.3gp"},
297                         null, -1.0f, -1L, 16000, 1, -1, -1, CODEC_ALL},
298 
299                 // opus
300                 {MEDIA_TYPE_OPUS, new String[]{"audio/bbb_1ch_8kHz_opus.ogg"},
301                         null, -1.0f, -1L, 48000, 1, -1, -1, CODEC_ALL},
302                 {MEDIA_TYPE_OPUS, new String[]{"audio/bbb_1ch_12kHz_opus.ogg"},
303                         null, -1.0f, -1L, 48000, 1, -1, -1, CODEC_ALL},
304                 {MEDIA_TYPE_OPUS, new String[]{"audio/bbb_1ch_16kHz_opus.ogg"},
305                         null, -1.0f, -1L, 48000, 1, -1, -1, CODEC_ALL},
306                 {MEDIA_TYPE_OPUS, new String[]{"audio/bbb_1ch_24kHz_opus.ogg"},
307                         null, -1.0f, -1L, 48000, 1, -1, -1, CODEC_ALL},
308                 {MEDIA_TYPE_OPUS, new String[]{"audio/bbb_1ch_32kHz_opus.ogg"},
309                         null, -1.0f, -1L, 48000, 1, -1, -1, CODEC_ALL},
310                 {MEDIA_TYPE_OPUS, new String[]{"audio/bbb_1ch_48kHz_opus.ogg"},
311                         null, -1.0f, -1L, 48000, 1, -1, -1, CODEC_ALL},
312                 {MEDIA_TYPE_OPUS, new String[]{"audio/bbb_2ch_8kHz_opus.ogg"},
313                         null, -1.0f, -1L, 48000, 2, -1, -1, CODEC_ALL},
314                 {MEDIA_TYPE_OPUS, new String[]{"audio/bbb_2ch_12kHz_opus.ogg"},
315                         null, -1.0f, -1L, 48000, 2, -1, -1, CODEC_ALL},
316                 {MEDIA_TYPE_OPUS, new String[]{"audio/bbb_2ch_16kHz_opus.ogg"},
317                         null, -1.0f, -1L, 48000, 2, -1, -1, CODEC_ALL},
318                 {MEDIA_TYPE_OPUS, new String[]{"audio/bbb_2ch_24kHz_opus.ogg"},
319                         null, -1.0f, -1L, 48000, 2, -1, -1, CODEC_ALL},
320                 {MEDIA_TYPE_OPUS, new String[]{"audio/bbb_2ch_32kHz_opus.ogg"},
321                         null, -1.0f, -1L, 48000, 2, -1, -1, CODEC_ALL},
322                 {MEDIA_TYPE_OPUS, new String[]{"audio/bbb_2ch_48kHz_opus.ogg"},
323                         null, -1.0f, -1L, 48000, 2, -1, -1, CODEC_ALL},
324                 {MEDIA_TYPE_OPUS, new String[]{"audio/bbb_5ch_8kHz_opus.ogg"},
325                         null, -1.0f, -1L, 48000, 5, -1, -1, CODEC_ALL},
326                 {MEDIA_TYPE_OPUS, new String[]{"audio/bbb_5ch_12kHz_opus.ogg"},
327                         null, -1.0f, -1L, 48000, 5, -1, -1, CODEC_ALL},
328                 {MEDIA_TYPE_OPUS, new String[]{"audio/bbb_5ch_16kHz_opus.ogg"},
329                         null, -1.0f, -1L, 48000, 5, -1, -1, CODEC_ALL},
330                 {MEDIA_TYPE_OPUS, new String[]{"audio/bbb_5ch_24kHz_opus.ogg"},
331                         null, -1.0f, -1L, 48000, 5, -1, -1, CODEC_ALL},
332                 {MEDIA_TYPE_OPUS, new String[]{"audio/bbb_5ch_32kHz_opus.ogg"},
333                         null, -1.0f, -1L, 48000, 5, -1, -1, CODEC_ALL},
334                 {MEDIA_TYPE_OPUS, new String[]{"audio/bbb_5ch_48kHz_opus.ogg"},
335                         null, -1.0f, -1L, 48000, 5, -1, -1, CODEC_ALL},
336                 {MEDIA_TYPE_OPUS, new String[]{"audio/bbb_6ch_8kHz_opus.ogg"},
337                         null, -1.0f, -1L, 48000, 6, -1, -1, CODEC_ALL},
338                 {MEDIA_TYPE_OPUS, new String[]{"audio/bbb_6ch_12kHz_opus.ogg"},
339                         null, -1.0f, -1L, 48000, 6, -1, -1, CODEC_ALL},
340                 {MEDIA_TYPE_OPUS, new String[]{"audio/bbb_6ch_16kHz_opus.ogg"},
341                         null, -1.0f, -1L, 48000, 6, -1, -1, CODEC_ALL},
342                 {MEDIA_TYPE_OPUS, new String[]{"audio/bbb_6ch_24kHz_opus.ogg"},
343                         null, -1.0f, -1L, 48000, 6, -1, -1, CODEC_ALL},
344                 {MEDIA_TYPE_OPUS, new String[]{"audio/bbb_6ch_32kHz_opus.ogg"},
345                         null, -1.0f, -1L, 48000, 6, -1, -1, CODEC_ALL},
346                 {MEDIA_TYPE_OPUS, new String[]{"audio/bbb_6ch_48kHz_opus.ogg"},
347                         null, -1.0f, -1L, 48000, 6, -1, -1, CODEC_ALL},
348 
349                 // vorbis
350                 //TODO(b/285072724) Review the following once CDD specifies vorbis requirements
351                 {MEDIA_TYPE_VORBIS, new String[]{"audio/bbb_1ch_8kHz_q10_vorbis.ogg"},
352                         null, -1.0f, -1L, 8000, 1, -1, -1, CODEC_ALL},
353                 {MEDIA_TYPE_VORBIS, new String[]{"audio/bbb_1ch_12kHz_q10_vorbis.ogg"},
354                         null, -1.0f, -1L, 12000, 1, -1, -1, CODEC_ALL},
355                 {MEDIA_TYPE_VORBIS, new String[]{"audio/bbb_1ch_16kHz_q10_vorbis.ogg"},
356                         null, -1.0f, -1L, 16000, 1, -1, -1, CODEC_ALL},
357                 {MEDIA_TYPE_VORBIS, new String[]{"audio/bbb_1ch_24kHz_q10_vorbis.ogg"},
358                         null, -1.0f, -1L, 24000, 1, -1, -1, CODEC_ALL},
359                 {MEDIA_TYPE_VORBIS, new String[]{"audio/bbb_1ch_32kHz_q10_vorbis.ogg"},
360                         null, -1.0f, -1L, 32000, 1, -1, -1, CODEC_ALL},
361                 {MEDIA_TYPE_VORBIS, new String[]{"audio/bbb_1ch_48kHz_q10_vorbis.ogg"},
362                         null, -1.0f, -1L, 48000, 1, -1, -1, CODEC_ALL},
363                 {MEDIA_TYPE_VORBIS, new String[]{"audio/bbb_2ch_8kHz_q10_vorbis.ogg"},
364                         null, -1.0f, -1L, 8000, 2, -1, -1, CODEC_ALL},
365                 {MEDIA_TYPE_VORBIS, new String[]{"audio/bbb_2ch_12kHz_q10_vorbis.ogg"},
366                         null, -1.0f, -1L, 12000, 2, -1, -1, CODEC_ALL},
367                 {MEDIA_TYPE_VORBIS, new String[]{"audio/bbb_2ch_16kHz_q10_vorbis.ogg"},
368                         null, -1.0f, -1L, 16000, 2, -1, -1, CODEC_ALL},
369                 {MEDIA_TYPE_VORBIS, new String[]{"audio/bbb_2ch_24kHz_q10_vorbis.ogg"},
370                         null, -1.0f, -1L, 24000, 2, -1, -1, CODEC_ALL},
371                 {MEDIA_TYPE_VORBIS, new String[]{"audio/bbb_2ch_32kHz_q10_vorbis.ogg"},
372                         null, -1.0f, -1L, 32000, 2, -1, -1, CODEC_ALL},
373                 {MEDIA_TYPE_VORBIS, new String[]{"audio/bbb_2ch_48kHz_q10_vorbis.ogg"},
374                         null, -1.0f, -1L, 48000, 2, -1, -1, CODEC_ALL},
375                 {MEDIA_TYPE_VORBIS, new String[]{"audio/highres_1ch_96kHz_q10_vorbis.ogg"},
376                         null, -1.0f, -1L, 96000, 1, -1, -1,
377                         MediaUtils.isWatch() ? CODEC_OPTIONAL : CODEC_ALL},
378                 {MEDIA_TYPE_VORBIS, new String[]{"audio/highres_2ch_96kHz_q10_vorbis.ogg"},
379                         null, -1.0f, -1L, 96000, 2, -1, -1,
380                         MediaUtils.isWatch() ? CODEC_OPTIONAL : CODEC_ALL},
381 
382                 // flac
383                 {MEDIA_TYPE_FLAC, new String[]{"audio/bbb_1ch_8kHz_lvl4_flac.mka"},
384                         "audio/bbb_1ch_8kHz_s16le_3s.raw", 0.0f, -1L, 8000, 1, -1, -1, CODEC_ALL},
385                 {MEDIA_TYPE_FLAC, new String[]{"audio/bbb_1ch_12kHz_lvl4_flac.mka"},
386                         "audio/bbb_1ch_12kHz_s16le_3s.raw", 0.0f, -1L, 12000, 1, -1, -1, CODEC_ALL},
387                 {MEDIA_TYPE_FLAC, new String[]{"audio/bbb_1ch_16kHz_lvl4_flac.mka"},
388                         "audio/bbb_1ch_16kHz_s16le_3s.raw", 0.0f, -1L, 16000, 1, -1, -1, CODEC_ALL},
389                 {MEDIA_TYPE_FLAC, new String[]{"audio/bbb_1ch_22kHz_lvl4_flac.mka"},
390                         "audio/bbb_1ch_22kHz_s16le_3s.raw", 0.0f, -1L, 22050, 1, -1, -1, CODEC_ALL},
391                 {MEDIA_TYPE_FLAC, new String[]{"audio/bbb_1ch_24kHz_lvl4_flac.mka"},
392                         "audio/bbb_1ch_24kHz_s16le_3s.raw", 0.0f, -1L, 24000, 1, -1, -1, CODEC_ALL},
393                 {MEDIA_TYPE_FLAC, new String[]{"audio/bbb_1ch_32kHz_lvl4_flac.mka"},
394                         "audio/bbb_1ch_32kHz_s16le_3s.raw", 0.0f, -1L, 32000, 1, -1, -1, CODEC_ALL},
395                 {MEDIA_TYPE_FLAC, new String[]{"audio/bbb_1ch_44kHz_lvl4_flac.mka"},
396                         "audio/bbb_1ch_44kHz_s16le_3s.raw", 0.0f, -1L, 44100, 1, -1, -1, CODEC_ALL},
397                 {MEDIA_TYPE_FLAC, new String[]{"audio/bbb_1ch_48kHz_lvl4_flac.mka"},
398                         "audio/bbb_1ch_48kHz_s16le_3s.raw", 0.0f, -1L, 48000, 1, -1, -1, CODEC_ALL},
399                 {MEDIA_TYPE_FLAC, new String[]{"audio/bbb_2ch_8kHz_lvl4_flac.mka"},
400                         "audio/bbb_2ch_8kHz_s16le_3s.raw", 0.0f, -1L, 8000, 2, -1, -1, CODEC_ALL},
401                 {MEDIA_TYPE_FLAC, new String[]{"audio/bbb_2ch_12kHz_lvl4_flac.mka"},
402                         "audio/bbb_2ch_12kHz_s16le_3s.raw", 0.0f, -1L, 12000, 2, -1, -1, CODEC_ALL},
403                 {MEDIA_TYPE_FLAC, new String[]{"audio/bbb_2ch_16kHz_lvl4_flac.mka"},
404                         "audio/bbb_2ch_16kHz_s16le_3s.raw", 0.0f, -1L, 16000, 2, -1, -1, CODEC_ALL},
405                 {MEDIA_TYPE_FLAC, new String[]{"audio/bbb_2ch_22kHz_lvl4_flac.mka"},
406                         "audio/bbb_2ch_22kHz_s16le_3s.raw", 0.0f, -1L, 22050, 2, -1, -1, CODEC_ALL},
407                 {MEDIA_TYPE_FLAC, new String[]{"audio/bbb_2ch_24kHz_lvl4_flac.mka"},
408                         "audio/bbb_2ch_24kHz_s16le_3s.raw", 0.0f, -1L, 24000, 2, -1, -1, CODEC_ALL},
409                 {MEDIA_TYPE_FLAC, new String[]{"audio/bbb_2ch_32kHz_lvl4_flac.mka"},
410                         "audio/bbb_2ch_32kHz_s16le_3s.raw", 0.0f, -1L, 32000, 2, -1, -1, CODEC_ALL},
411                 {MEDIA_TYPE_FLAC, new String[]{"audio/bbb_2ch_44kHz_lvl4_flac.mka"},
412                         "audio/bbb_2ch_44kHz_s16le_3s.raw", 0.0f, -1L, 44100, 2, -1, -1, CODEC_ALL},
413                 {MEDIA_TYPE_FLAC, new String[]{"audio/bbb_2ch_48kHz_lvl4_flac.mka"},
414                         "audio/bbb_2ch_48kHz_s16le_3s.raw", 0.0f, -1L, 48000, 2, -1, -1, CODEC_ALL},
415                 {MEDIA_TYPE_FLAC, new String[]{"audio/highres_1ch_96kHz_lvl4_flac.mka"},
416                         "audio/highres_1ch_96kHz_s16le_5s.raw", 0.0f, -1L, 96000, 1, -1, -1,
417                         CODEC_ALL},
418                 {MEDIA_TYPE_FLAC, new String[]{"audio/highres_1ch_176kHz_lvl4_flac.mka"},
419                         "audio/highres_1ch_176kHz_s16le_5s.raw", 0.0f, -1L, 176400, 1, -1, -1,
420                         CODEC_ALL},
421                 {MEDIA_TYPE_FLAC, new String[]{"audio/highres_1ch_192kHz_lvl4_flac.mka"},
422                         "audio/highres_1ch_192kHz_s16le_5s.raw", 0.0f, -1L, 192000, 1, -1, -1,
423                         CODEC_ALL},
424                 {MEDIA_TYPE_FLAC, new String[]{"audio/highres_2ch_96kHz_lvl4_flac.mka"},
425                         "audio/highres_2ch_96kHz_s16le_5s.raw", 0.0f, -1L, 96000, 2, -1, -1,
426                         CODEC_ALL},
427                 {MEDIA_TYPE_FLAC, new String[]{"audio/highres_2ch_176kHz_lvl4_flac.mka"},
428                         "audio/highres_2ch_176kHz_s16le_5s.raw", 0.0f, -1L, 176400, 2, -1, -1,
429                         CODEC_ALL},
430                 {MEDIA_TYPE_FLAC, new String[]{"audio/highres_2ch_192kHz_lvl4_flac.mka"},
431                         "audio/highres_2ch_192kHz_s16le_5s.raw", 0.0f, -1L, 192000, 2, -1, -1,
432                         CODEC_ALL},
433                 {MEDIA_TYPE_FLAC, new String[]{"audio/sd_2ch_48kHz_lvl4_flac.mka"},
434                         "audio/sd_2ch_48kHz_s16le.raw", 1.0f, -1L, 48000, 2, -1, -1, CODEC_ALL},
435 
436                 // raw
437                 {MEDIA_TYPE_RAW, new String[]{"audio/bbb_1ch_8kHz.wav"},
438                         "audio/bbb_1ch_8kHz_s16le_3s.raw", 0.0f, -1L, 8000, 1, -1, -1, CODEC_ALL},
439                 {MEDIA_TYPE_RAW, new String[]{"audio/bbb_1ch_16kHz.wav"},
440                         "audio/bbb_1ch_16kHz_s16le_3s.raw", 0.0f, -1L, 16000, 1, -1, -1, CODEC_ALL},
441                 {MEDIA_TYPE_RAW, new String[]{"audio/bbb_1ch_22kHz.wav"},
442                         "audio/bbb_1ch_22kHz_s16le_3s.raw", 0.0f, -1L, 22050, 1, -1, -1, CODEC_ALL},
443                 {MEDIA_TYPE_RAW, new String[]{"audio/bbb_1ch_24kHz.wav"},
444                         "audio/bbb_1ch_24kHz_s16le_3s.raw", 0.0f, -1L, 24000, 1, -1, -1, CODEC_ALL},
445                 {MEDIA_TYPE_RAW, new String[]{"audio/bbb_1ch_32kHz.wav"},
446                         "audio/bbb_1ch_32kHz_s16le_3s.raw", 0.0f, -1L, 32000, 1, -1, -1, CODEC_ALL},
447                 {MEDIA_TYPE_RAW, new String[]{"audio/bbb_1ch_44kHz.wav"},
448                         "audio/bbb_1ch_44kHz_s16le_3s.raw", 0.0f, -1L, 44100, 1, -1, -1, CODEC_ALL},
449                 {MEDIA_TYPE_RAW, new String[]{"audio/bbb_1ch_48kHz.wav"},
450                         "audio/bbb_1ch_48kHz_s16le_3s.raw", 0.0f, -1L, 48000, 1, -1, -1, CODEC_ALL},
451                 {MEDIA_TYPE_RAW, new String[]{"audio/bbb_2ch_8kHz.wav"},
452                         "audio/bbb_2ch_8kHz_s16le_3s.raw", 0.0f, -1L, 8000, 2, -1, -1, CODEC_ALL},
453                 {MEDIA_TYPE_RAW, new String[]{"audio/bbb_2ch_16kHz.wav"},
454                         "audio/bbb_2ch_16kHz_s16le_3s.raw", 0.0f, -1L, 16000, 2, -1, -1, CODEC_ALL},
455                 {MEDIA_TYPE_RAW, new String[]{"audio/bbb_2ch_22kHz.wav"},
456                         "audio/bbb_2ch_22kHz_s16le_3s.raw", 0.0f, -1L, 22050, 2, -1, -1, CODEC_ALL},
457                 {MEDIA_TYPE_RAW, new String[]{"audio/bbb_2ch_24kHz.wav"},
458                         "audio/bbb_2ch_24kHz_s16le_3s.raw", 0.0f, -1L, 24000, 2, -1, -1, CODEC_ALL},
459                 {MEDIA_TYPE_RAW, new String[]{"audio/bbb_2ch_32kHz.wav"},
460                         "audio/bbb_2ch_32kHz_s16le_3s.raw", 0.0f, -1L, 32000, 2, -1, -1, CODEC_ALL},
461                 {MEDIA_TYPE_RAW, new String[]{"audio/bbb_2ch_44kHz.wav"},
462                         "audio/bbb_2ch_44kHz_s16le_3s.raw", 0.0f, -1L, 44100, 2, -1, -1, CODEC_ALL},
463                 {MEDIA_TYPE_RAW, new String[]{"audio/bbb_2ch_48kHz.wav"},
464                         "audio/bbb_2ch_48kHz_s16le_3s.raw", 0.0f, -1L, 48000, 2, -1, -1, CODEC_ALL},
465                 {MEDIA_TYPE_RAW, new String[]{"audio/highres_1ch_96kHz.wav"},
466                         "audio/highres_1ch_96kHz_s16le_5s.raw", 0.0f, -1L, 96000, 1, -1, -1,
467                         CODEC_ALL},
468                 {MEDIA_TYPE_RAW, new String[]{"audio/highres_2ch_96kHz.wav"},
469                         "audio/highres_2ch_96kHz_s16le_5s.raw", 0.0f, -1L, 96000, 2, -1, -1,
470                         CODEC_ALL},
471                 {MEDIA_TYPE_RAW, new String[]{"audio/sd_2ch_48kHz.wav"},
472                         "audio/sd_2ch_48kHz_s16le.raw", 1.0f, -1L, 48000, 2, -1, -1, CODEC_ALL},
473                 {MEDIA_TYPE_RAW, new String[]{"audio/bellezza_2ch_48kHz_s32le.wav"},
474                         "audio/bellezza_2ch_48kHz_s16le.raw", 1.0f, -1L, 48000, 2, -1, -1,
475                         CODEC_ALL},
476                 {MEDIA_TYPE_RAW, new String[]{"audio/bellezza_2ch_48kHz_s24le.wav"},
477                         "audio/bellezza_2ch_48kHz_s16le.raw", 1.0f, -1L, 48000, 2, -1, -1,
478                         CODEC_ALL},
479 
480                 // aac-lc
481                 {MEDIA_TYPE_AAC, new String[]{"audio/bbb_1ch_8kHz_aac_lc.m4a"},
482                         "audio/bbb_1ch_8kHz_s16le_3s.raw", 26.910906f, -1L, 8000, 1, -1, -1,
483                         CODEC_ALL},
484                 {MEDIA_TYPE_AAC, new String[]{"audio/bbb_1ch_12kHz_aac_lc.m4a"},
485                         "audio/bbb_1ch_12kHz_s16le_3s.raw", 23.380817f, -1L, 12000, 1, -1, -1,
486                         CODEC_ALL},
487                 {MEDIA_TYPE_AAC, new String[]{"audio/bbb_1ch_16kHz_aac_lc.m4a"},
488                         "audio/bbb_1ch_16kHz_s16le_3s.raw", 21.368309f, -1L, 16000, 1, -1, -1,
489                         CODEC_ALL},
490                 {MEDIA_TYPE_AAC, new String[]{"audio/bbb_1ch_22kHz_aac_lc.m4a"},
491                         "audio/bbb_1ch_22kHz_s16le_3s.raw", 25.995440f, -1L, 22050, 1, -1, -1,
492                         CODEC_ALL},
493                 {MEDIA_TYPE_AAC, new String[]{"audio/bbb_1ch_24kHz_aac_lc.m4a"},
494                         "audio/bbb_1ch_24kHz_s16le_3s.raw", 26.373266f, -1L, 24000, 1, -1, -1,
495                         CODEC_ALL},
496                 {MEDIA_TYPE_AAC, new String[]{"audio/bbb_1ch_32kHz_aac_lc.m4a"},
497                         "audio/bbb_1ch_32kHz_s16le_3s.raw", 28.642658f, -1L, 32000, 1, -1, -1,
498                         CODEC_ALL},
499                 {MEDIA_TYPE_AAC, new String[]{"audio/bbb_1ch_44kHz_aac_lc.m4a"},
500                         "audio/bbb_1ch_44kHz_s16le_3s.raw", 29.294861f, -1L, 44100, 1, -1, -1,
501                         CODEC_ALL},
502                 {MEDIA_TYPE_AAC, new String[]{"audio/bbb_1ch_48kHz_aac_lc.m4a"},
503                         "audio/bbb_1ch_48kHz_s16le_3s.raw", 29.335669f, -1L, 48000, 1, -1, -1,
504                         CODEC_ALL},
505                 {MEDIA_TYPE_AAC, new String[]{"audio/bbb_2ch_8kHz_aac_lc.m4a"},
506                         "audio/bbb_2ch_8kHz_s16le_3s.raw", 26.381552f, -1L, 8000, 2, -1, -1,
507                         CODEC_ALL},
508                 {MEDIA_TYPE_AAC, new String[]{"audio/bbb_2ch_12kHz_aac_lc.m4a"},
509                         "audio/bbb_2ch_12kHz_s16le_3s.raw", 21.934900f, -1L, 12000, 2, -1, -1,
510                         CODEC_ALL},
511                 {MEDIA_TYPE_AAC, new String[]{"audio/bbb_2ch_16kHz_aac_lc.m4a"},
512                         "audio/bbb_2ch_16kHz_s16le_3s.raw", 22.072184f, -1L, 16000, 2, -1, -1,
513                         CODEC_ALL},
514                 {MEDIA_TYPE_AAC, new String[]{"audio/bbb_2ch_22kHz_aac_lc.m4a"},
515                         "audio/bbb_2ch_22kHz_s16le_3s.raw", 25.334206f, -1L, 22050, 2, -1, -1,
516                         CODEC_ALL},
517                 {MEDIA_TYPE_AAC, new String[]{"audio/bbb_2ch_24kHz_aac_lc.m4a"},
518                         "audio/bbb_2ch_24kHz_s16le_3s.raw", 25.653538f, -1L, 24000, 2, -1, -1,
519                         CODEC_ALL},
520                 {MEDIA_TYPE_AAC, new String[]{"audio/bbb_2ch_32kHz_aac_lc.m4a"},
521                         "audio/bbb_2ch_32kHz_s16le_3s.raw", 27.312286f, -1L, 32000, 2, -1, -1,
522                         CODEC_ALL},
523                 {MEDIA_TYPE_AAC, new String[]{"audio/bbb_2ch_44kHz_aac_lc.m4a"},
524                         "audio/bbb_2ch_44kHz_s16le_3s.raw", 27.316111f, -1L, 44100, 2, -1, -1,
525                         CODEC_ALL},
526                 {MEDIA_TYPE_AAC, new String[]{"audio/bbb_2ch_48kHz_aac_lc.m4a"},
527                         "audio/bbb_2ch_48kHz_s16le_3s.raw", 27.684767f, -1L, 48000, 2, -1, -1,
528                         CODEC_ALL},
529                 {MEDIA_TYPE_AAC, new String[]{"audio/bbb_5ch_8kHz_aac_lc.m4a"},
530                         "audio/bbb_5ch_8kHz_s16le_3s.raw", 43.121964f, -1L, 8000, 5, -1, -1,
531                         CODEC_ALL},
532                 {MEDIA_TYPE_AAC, new String[]{"audio/bbb_5ch_12kHz_aac_lc.m4a"},
533                         "audio/bbb_5ch_12kHz_s16le_3s.raw", 35.983891f, -1L, 12000, 5, -1, -1,
534                         CODEC_ALL},
535                 {MEDIA_TYPE_AAC, new String[]{"audio/bbb_5ch_16kHz_aac_lc.m4a"},
536                         "audio/bbb_5ch_16kHz_s16le_3s.raw", 32.720196f, -1L, 16000, 5, -1, -1,
537                         CODEC_ALL},
538                 {MEDIA_TYPE_AAC, new String[]{"audio/bbb_5ch_22kHz_aac_lc.m4a"},
539                         "audio/bbb_5ch_22kHz_s16le_3s.raw", 39.286514f, -1L, 22050, 5, -1, -1,
540                         CODEC_ALL},
541                 {MEDIA_TYPE_AAC, new String[]{"audio/bbb_5ch_24kHz_aac_lc.m4a"},
542                         "audio/bbb_5ch_24kHz_s16le_3s.raw", 40.963005f, -1L, 24000, 5, -1, -1,
543                         CODEC_ALL},
544                 {MEDIA_TYPE_AAC, new String[]{"audio/bbb_5ch_32kHz_aac_lc.m4a"},
545                         "audio/bbb_5ch_32kHz_s16le_3s.raw", 49.437782f, -1L, 32000, 5, -1, -1,
546                         CODEC_ALL},
547                 {MEDIA_TYPE_AAC, new String[]{"audio/bbb_5ch_44kHz_aac_lc.m4a"},
548                         "audio/bbb_5ch_44kHz_s16le_3s.raw", 43.891609f, -1L, 44100, 5, -1, -1,
549                         CODEC_ALL},
550                 {MEDIA_TYPE_AAC, new String[]{"audio/bbb_5ch_48kHz_aac_lc.m4a"},
551                         "audio/bbb_5ch_48kHz_s16le_3s.raw", 44.275997f, -1L, 48000, 5, -1, -1,
552                         CODEC_ALL},
553                 {MEDIA_TYPE_AAC, new String[]{"audio/bbb_6ch_8kHz_aac_lc.m4a"},
554                         "audio/bbb_6ch_8kHz_s16le_3s.raw", 39.666485f, -1L, 8000, 6, -1, -1,
555                         CODEC_ALL},
556                 {MEDIA_TYPE_AAC, new String[]{"audio/bbb_6ch_12kHz_aac_lc.m4a"},
557                         "audio/bbb_6ch_12kHz_s16le_3s.raw", 34.979305f, -1L, 12000, 6, -1, -1,
558                         CODEC_ALL},
559                 {MEDIA_TYPE_AAC, new String[]{"audio/bbb_6ch_16kHz_aac_lc.m4a"},
560                         "audio/bbb_6ch_16kHz_s16le_3s.raw", 29.069729f, -1L, 16000, 6, -1, -1,
561                         CODEC_ALL},
562                 {MEDIA_TYPE_AAC, new String[]{"audio/bbb_6ch_22kHz_aac_lc.m4a"},
563                         "audio/bbb_6ch_22kHz_s16le_3s.raw", 29.440094f, -1L, 22050, 6, -1, -1,
564                         CODEC_ALL},
565                 {MEDIA_TYPE_AAC, new String[]{"audio/bbb_6ch_24kHz_aac_lc.m4a"},
566                         "audio/bbb_6ch_24kHz_s16le_3s.raw", 30.333755f, -1L, 24000, 6, -1, -1,
567                         CODEC_ALL},
568                 {MEDIA_TYPE_AAC, new String[]{"audio/bbb_6ch_32kHz_aac_lc.m4a"},
569                         "audio/bbb_6ch_32kHz_s16le_3s.raw", 33.927166f, -1L, 32000, 6, -1, -1,
570                         CODEC_ALL},
571                 {MEDIA_TYPE_AAC, new String[]{"audio/bbb_6ch_44kHz_aac_lc.m4a"},
572                         "audio/bbb_6ch_44kHz_s16le_3s.raw", 31.733339f, -1L, 44100, 6, -1, -1,
573                         CODEC_ALL},
574                 {MEDIA_TYPE_AAC, new String[]{"audio/bbb_6ch_48kHz_aac_lc.m4a"},
575                         "audio/bbb_6ch_48kHz_s16le_3s.raw", 31.033596f, -1L, 48000, 6, -1, -1,
576                         CODEC_ALL},
577 
578                 // aac-he
579                 {MEDIA_TYPE_AAC, new String[]{"audio/bbb_2ch_16kHz_aac_he.m4a"},
580                         null, -1.0f, -1L, 16000, 2, -1, -1, CODEC_DEFAULT},
581                 {MEDIA_TYPE_AAC, new String[]{"audio/bbb_2ch_22kHz_aac_he.m4a"},
582                         null, -1.0f, -1L, 22050, 2, -1, -1, CODEC_DEFAULT},
583                 {MEDIA_TYPE_AAC, new String[]{"audio/bbb_2ch_24kHz_aac_he.m4a"},
584                         null, -1.0f, -1L, 24000, 2, -1, -1, CODEC_DEFAULT},
585                 {MEDIA_TYPE_AAC, new String[]{"audio/bbb_2ch_32kHz_aac_he.m4a"},
586                         null, -1.0f, -1L, 32000, 2, -1, -1, CODEC_DEFAULT},
587                 {MEDIA_TYPE_AAC, new String[]{"audio/bbb_2ch_44kHz_aac_he.m4a"},
588                         null, -1.0f, -1L, 44100, 2, -1, -1, CODEC_DEFAULT},
589                 {MEDIA_TYPE_AAC, new String[]{"audio/bbb_2ch_48kHz_aac_he.m4a"},
590                         null, -1.0f, -1L, 48000, 2, -1, -1, CODEC_DEFAULT},
591                 {MEDIA_TYPE_AAC, new String[]{"audio/bbb_5ch_16kHz_aac_he.m4a"},
592                         null, -1.0f, -1L, 16000, 5, -1, -1, CODEC_DEFAULT},
593                 {MEDIA_TYPE_AAC, new String[]{"audio/bbb_5ch_22kHz_aac_he.m4a"},
594                         null, -1.0f, -1L, 22050, 5, -1, -1, CODEC_DEFAULT},
595                 {MEDIA_TYPE_AAC, new String[]{"audio/bbb_5ch_24kHz_aac_he.m4a"},
596                         null, -1.0f, -1L, 24000, 5, -1, -1, CODEC_DEFAULT},
597                 {MEDIA_TYPE_AAC, new String[]{"audio/bbb_5ch_32kHz_aac_he.m4a"},
598                         null, -1.0f, -1L, 32000, 5, -1, -1, CODEC_DEFAULT},
599                 {MEDIA_TYPE_AAC, new String[]{"audio/bbb_5ch_44kHz_aac_he.m4a"},
600                         null, -1.0f, -1L, 44100, 5, -1, -1, CODEC_DEFAULT},
601                 {MEDIA_TYPE_AAC, new String[]{"audio/bbb_5ch_48kHz_aac_he.m4a"},
602                         null, -1.0f, -1L, 48000, 5, -1, -1, CODEC_DEFAULT},
603                 {MEDIA_TYPE_AAC, new String[]{"audio/bbb_6ch_16kHz_aac_he.m4a"},
604                         null, -1.0f, -1L, 16000, 6, -1, -1, CODEC_DEFAULT},
605                 {MEDIA_TYPE_AAC, new String[]{"audio/bbb_6ch_22kHz_aac_he.m4a"},
606                         null, -1.0f, -1L, 22050, 6, -1, -1, CODEC_DEFAULT},
607                 {MEDIA_TYPE_AAC, new String[]{"audio/bbb_6ch_24kHz_aac_he.m4a"},
608                         null, -1.0f, -1L, 24000, 6, -1, -1, CODEC_DEFAULT},
609                 {MEDIA_TYPE_AAC, new String[]{"audio/bbb_6ch_32kHz_aac_he.m4a"},
610                         null, -1.0f, -1L, 32000, 6, -1, -1, CODEC_DEFAULT},
611                 {MEDIA_TYPE_AAC, new String[]{"audio/bbb_6ch_44kHz_aac_he.m4a"},
612                         null, -1.0f, -1L, 44100, 6, -1, -1, CODEC_DEFAULT},
613                 {MEDIA_TYPE_AAC, new String[]{"audio/bbb_6ch_48kHz_aac_he.m4a"},
614                         null, -1.0f, -1L, 48000, 6, -1, -1, CODEC_DEFAULT},
615 
616                 // aac-hev2
617                 {MEDIA_TYPE_AAC, new String[]{"audio/bbb_2ch_16kHz_aac_hev2.m4a"},
618                         null, -1.0f, -1L, 16000, 2, -1, -1, CODEC_DEFAULT},
619                 {MEDIA_TYPE_AAC, new String[]{"audio/bbb_2ch_22kHz_aac_hev2.m4a"},
620                         null, -1.0f, -1L, 22050, 2, -1, -1, CODEC_DEFAULT},
621                 {MEDIA_TYPE_AAC, new String[]{"audio/bbb_2ch_24kHz_aac_hev2.m4a"},
622                         null, -1.0f, -1L, 24000, 2, -1, -1, CODEC_DEFAULT},
623                 {MEDIA_TYPE_AAC, new String[]{"audio/bbb_2ch_32kHz_aac_hev2.m4a"},
624                         null, -1.0f, -1L, 32000, 2, -1, -1, CODEC_DEFAULT},
625                 {MEDIA_TYPE_AAC, new String[]{"audio/bbb_2ch_44kHz_aac_hev2.m4a"},
626                         null, -1.0f, -1L, 44100, 2, -1, -1, CODEC_DEFAULT},
627                 {MEDIA_TYPE_AAC, new String[]{"audio/bbb_2ch_48kHz_aac_hev2.m4a"},
628                         null, -1.0f, -1L, 48000, 2, -1, -1, CODEC_DEFAULT},
629 
630                 // aac-eld
631                 {MEDIA_TYPE_AAC, new String[]{"audio/bbb_1ch_16kHz_aac_eld.m4a"},
632                         "audio/bbb_1ch_16kHz_s16le_3s.raw", -1.000000f, -1L, 16000, 1, -1, -1,
633                         CODEC_DEFAULT},
634                 {MEDIA_TYPE_AAC, new String[]{"audio/bbb_1ch_22kHz_aac_eld.m4a"},
635                         "audio/bbb_1ch_22kHz_s16le_3s.raw", 24.969662f, -1L, 22050, 1, -1, -1,
636                         CODEC_DEFAULT},
637                 {MEDIA_TYPE_AAC, new String[]{"audio/bbb_1ch_24kHz_aac_eld.m4a"},
638                         "audio/bbb_1ch_24kHz_s16le_3s.raw", 26.498655f, -1L, 24000, 1, -1, -1,
639                         CODEC_DEFAULT},
640                 {MEDIA_TYPE_AAC, new String[]{"audio/bbb_1ch_32kHz_aac_eld.m4a"},
641                         "audio/bbb_1ch_32kHz_s16le_3s.raw", 31.468872f, -1L, 32000, 1, -1, -1,
642                         CODEC_DEFAULT},
643                 {MEDIA_TYPE_AAC, new String[]{"audio/bbb_1ch_44kHz_aac_eld.m4a"},
644                         "audio/bbb_1ch_44kHz_s16le_3s.raw", 33.866409f, -1L, 44100, 1, -1, -1,
645                         CODEC_DEFAULT},
646                 {MEDIA_TYPE_AAC, new String[]{"audio/bbb_1ch_48kHz_aac_eld.m4a"},
647                         "audio/bbb_1ch_48kHz_s16le_3s.raw", 33.148113f, -1L, 48000, 1, -1, -1,
648                         CODEC_DEFAULT},
649                 {MEDIA_TYPE_AAC, new String[]{"audio/bbb_2ch_16kHz_aac_eld.m4a"},
650                         "audio/bbb_2ch_16kHz_s16le_3s.raw", -1.000000f, -1L, 16000, 2, -1, -1,
651                         CODEC_DEFAULT},
652                 {MEDIA_TYPE_AAC, new String[]{"audio/bbb_2ch_22kHz_aac_eld.m4a"},
653                         "audio/bbb_2ch_22kHz_s16le_3s.raw", 24.979313f, -1L, 22050, 2, -1, -1,
654                         CODEC_DEFAULT},
655                 {MEDIA_TYPE_AAC, new String[]{"audio/bbb_2ch_24kHz_aac_eld.m4a"},
656                         "audio/bbb_2ch_24kHz_s16le_3s.raw", 26.977774f, -1L, 24000, 2, -1, -1,
657                         CODEC_DEFAULT},
658                 {MEDIA_TYPE_AAC, new String[]{"audio/bbb_2ch_32kHz_aac_eld.m4a"},
659                         "audio/bbb_2ch_32kHz_s16le_3s.raw", 27.790754f, -1L, 32000, 2, -1, -1,
660                         CODEC_DEFAULT},
661                 {MEDIA_TYPE_AAC, new String[]{"audio/bbb_2ch_44kHz_aac_eld.m4a"},
662                         "audio/bbb_2ch_44kHz_s16le_3s.raw", 29.236626f, -1L, 44100, 2, -1, -1,
663                         CODEC_DEFAULT},
664                 {MEDIA_TYPE_AAC, new String[]{"audio/bbb_2ch_48kHz_aac_eld.m4a"},
665                         "audio/bbb_2ch_48kHz_s16le_3s.raw", 29.183796f, -1L, 48000, 2, -1, -1,
666                         CODEC_DEFAULT},
667 
668                 // aac-usac
669                 {MEDIA_TYPE_AAC, new String[]{"audio/bbb_1ch_8kHz_usac.m4a"},
670                         null, -1.0f, -1L, 8000, 1, -1, -1, CODEC_DEFAULT},
671                 {MEDIA_TYPE_AAC, new String[]{"audio/bbb_1ch_16kHz_usac.m4a"},
672                         null, -1.0f, -1L, 16000, 1, -1, -1, CODEC_DEFAULT},
673                 {MEDIA_TYPE_AAC, new String[]{"audio/bbb_1ch_22kHz_usac.m4a"},
674                         null, -1.0f, -1L, 22050, 1, -1, -1, CODEC_DEFAULT},
675                 {MEDIA_TYPE_AAC, new String[]{"audio/bbb_1ch_24kHz_usac.m4a"},
676                         null, -1.0f, -1L, 24000, 1, -1, -1, CODEC_DEFAULT},
677                 {MEDIA_TYPE_AAC, new String[]{"audio/bbb_1ch_32kHz_usac.m4a"},
678                         null, -1.0f, -1L, 32000, 1, -1, -1, CODEC_DEFAULT},
679                 {MEDIA_TYPE_AAC, new String[]{"audio/bbb_1ch_44kHz_usac.m4a"},
680                         null, -1.0f, -1L, 44100, 1, -1, -1, CODEC_DEFAULT},
681                 {MEDIA_TYPE_AAC, new String[]{"audio/bbb_1ch_48kHz_usac.m4a"},
682                         null, -1.0f, -1L, 48000, 1, -1, -1, CODEC_DEFAULT},
683                 {MEDIA_TYPE_AAC, new String[]{"audio/bbb_2ch_8kHz_usac.m4a"},
684                         null, -1.0f, -1L, 8000, 2, -1, -1, CODEC_DEFAULT},
685                 {MEDIA_TYPE_AAC, new String[]{"audio/bbb_2ch_16kHz_usac.m4a"},
686                         null, -1.0f, -1L, 16000, 2, -1, -1, CODEC_DEFAULT},
687                 {MEDIA_TYPE_AAC, new String[]{"audio/bbb_2ch_22kHz_usac.m4a"},
688                         null, -1.0f, -1L, 22050, 2, -1, -1, CODEC_DEFAULT},
689                 {MEDIA_TYPE_AAC, new String[]{"audio/bbb_2ch_24kHz_usac.m4a"},
690                         null, -1.0f, -1L, 24000, 2, -1, -1, CODEC_DEFAULT},
691                 {MEDIA_TYPE_AAC, new String[]{"audio/bbb_2ch_32kHz_usac.m4a"},
692                         null, -1.0f, -1L, 32000, 2, -1, -1, CODEC_DEFAULT},
693                 {MEDIA_TYPE_AAC, new String[]{"audio/bbb_2ch_44kHz_usac.m4a"},
694                         null, -1.0f, -1L, 44100, 2, -1, -1, CODEC_DEFAULT},
695                 {MEDIA_TYPE_AAC, new String[]{"audio/bbb_2ch_48kHz_usac.m4a"},
696                         null, -1.0f, -1L, 48000, 2, -1, -1, CODEC_DEFAULT},
697         }));
698         if (IS_AT_LEAST_U) {
699             exhaustiveArgsList.addAll(Arrays.asList(new Object[][]{
700                     // Support for 176kHz and 192kHz for c2.android.raw.decoder was added in
701                     // Android U
702                     {MEDIA_TYPE_RAW, new String[]{"audio/highres_1ch_176kHz.wav"},
703                             "audio/highres_1ch_176kHz_s16le_5s.raw", 0.0f, -1L, 176400, 1, -1, -1,
704                             CODEC_ALL},
705                     {MEDIA_TYPE_RAW, new String[]{"audio/highres_1ch_192kHz.wav"},
706                             "audio/highres_1ch_192kHz_s16le_5s.raw", 0.0f, -1L, 192000, 1, -1, -1,
707                             CODEC_ALL},
708                     {MEDIA_TYPE_RAW, new String[]{"audio/highres_2ch_176kHz.wav"},
709                             "audio/highres_2ch_176kHz_s16le_5s.raw", 0.0f, -1L, 176400, 2, -1, -1,
710                             CODEC_ALL},
711                     {MEDIA_TYPE_RAW, new String[]{"audio/highres_2ch_192kHz.wav"},
712                             "audio/highres_2ch_192kHz_s16le_5s.raw", 0.0f, -1L, 192000, 2, -1, -1,
713                             CODEC_ALL},
714             }));
715         }
716 
717         // video test vectors covering cdd requirements
718         if (MAX_DISPLAY_HEIGHT_LAND >= 2160) {
719             exhaustiveArgsList.addAll(Arrays.asList(new Object[][]{
720                     // @CddTest(requirements={"5.3.5/C-1-2", "5.3.5/C-2-1"})
721                     {MEDIA_TYPE_HEVC, new String[]{"bbb_3840x2160_30fps_hevc_main_l50.mp4"}, null,
722                             -1.0f, 2312004815L, -1, -1, 3840, 2160, CODEC_ANY},
723                     // @CddTest(requirements={"5.3.7/C-2-1", "5.3.7/C-3-1"})
724                     {MEDIA_TYPE_VP9, new String[]{"bbb_3840x2160_30fps_vp9.mkv"}, null, -1.0f,
725                             279585450L, -1, -1, 3840, 2160, CODEC_ANY},
726                     // @CddTest(requirements={"5.3.9/C-2-2"})
727                     {MEDIA_TYPE_AV1, new String[]{"bbb_3840x2160_30fps_av1.mkv"}, null, -1.0f,
728                             100543644L, -1, -1, 3840, 2160, CODEC_OPTIONAL},
729                     {MEDIA_TYPE_AV1, new String[]{"cosmat_3840x2160_30fps_av1_10bit.mkv"}, null,
730                             -1.0f, 4214931794L, -1, -1, 3840, 2160, CODEC_OPTIONAL},
731             }));
732         }
733         if (MAX_DISPLAY_HEIGHT_LAND >= 1080) {
734             exhaustiveArgsList.addAll(Arrays.asList(new Object[][]{
735                     // @CddTest(requirement="5.3.4/C-2-2")
736                     {MEDIA_TYPE_AVC, new String[]{"bbb_1920x1080_avc_baseline_l40.mp4"}, null,
737                             -1.0f, 1332773556L, -1, -1, 1920, 1080, CODEC_ANY},
738                     {MEDIA_TYPE_AVC, new String[]{"bbb_1920x1080_avc_main_l40.mp4"}, null, -1.0f,
739                             2656846432L, -1, -1, 1920, 1080, CODEC_ANY},
740                     // @CddTest(requirements={"5.3.5/C-1-2", "5.3.5/C-2-1"})
741                     {MEDIA_TYPE_HEVC, new String[]{"bbb_1920x1080_hevc_main_l40.mp4"}, null,
742                             -1.0f, 3214459078L, -1, -1, 1920, 1080, CODEC_ANY},
743                     // @CddTest(requirement="5.3.6/C-2-2")
744                     {MEDIA_TYPE_VP8, new String[]{"bbb_1920x1080_30fps_vp8.mkv"}, null, -1.0f,
745                             2302247702L, -1, -1, 1920, 1080, CODEC_ANY},
746                     // @CddTest(requirements={"5.3.7/C-2-1", "5.3.7/C-3-1"})
747                     {MEDIA_TYPE_VP9, new String[]{"bbb_1920x1080_vp9_main_l40.mkv"}, null, -1.0f,
748                             2637993192L, -1, -1, 1920, 1080, CODEC_ANY},
749                     // @CddTest(requirements={"5.3.9/C-2-2"})
750                     {MEDIA_TYPE_AV1, new String[]{"bbb_1920x1080_30fps_av1.mkv"}, null, -1.0f,
751                             3428220318L, -1, -1, 1920, 1080, CODEC_HW},
752                     {MEDIA_TYPE_AV1, new String[]{"cosmat_1920x1080_30fps_av1_10bit.mkv"}, null,
753                             -1.0f, 3477727836L, -1, -1, 1920, 1080, CODEC_HW},
754             }));
755         }
756         if (MAX_DISPLAY_HEIGHT_LAND >= 720) {
757             exhaustiveArgsList.addAll(Arrays.asList(new Object[][]{
758                     // @CddTest(requirement="5.3.5/C-1-2")
759                     {MEDIA_TYPE_HEVC, new String[]{"bbb_1280x720_1mbps_30fps_hevc_nob.mp4"},
760                             null, -1.0f, 3576783828L, -1, -1, 1280, 720, CODEC_ANY},
761                     // @CddTest(requirement="5.3.6/C-2-1")
762                     {MEDIA_TYPE_VP8, new String[]{"bbb_1280x720_30fps_vp8.mkv"}, null, -1.0f,
763                             2390565854L, -1, -1, 1280, 720, CODEC_ANY},
764                     // @CddTest(requirements={"5.3.7/C-2-1", "5.3.7/C-3-1"})
765                     {MEDIA_TYPE_VP9, new String[]{"bbb_1280x720_2000kbps_30fps_vp9.webm"}, null,
766                             -1.0f, 3902485256L, -1, -1, 1280, 720, CODEC_ANY},
767                     // @CddTest(requirements={"5.3.9/C-2-1"})
768                     {MEDIA_TYPE_AV1, new String[]{"bbb_1280x720_1mbps_30fps_av1.webm"}, null, -1.0f,
769                             4202081555L, -1, -1, 1280, 720, CODEC_HW},
770                     {MEDIA_TYPE_AV1, new String[]{"cosmat_1280x720_24fps_1200kbps_av1_10bit.mkv"},
771                             null, -1.0f, 2039973562L, -1, -1, 1280, 720, CODEC_HW},
772 
773                     // vp9 test vectors with AQ mode enabled
774                     {MEDIA_TYPE_VP9, new String[]{"bbb_1280x720_800kbps_30fps_vp9.webm"},
775                             null, -1.0f, 1319105122L, -1, -1, 1280, 720, CODEC_ANY},
776                     {MEDIA_TYPE_VP9, new String[]{"bbb_1280x720_1200kbps_30fps_vp9.webm"},
777                             null, -1.0f, 4128150660L, -1, -1, 1280, 720, CODEC_ANY},
778                     {MEDIA_TYPE_VP9, new String[]{"bbb_1280x720_1600kbps_30fps_vp9.webm"},
779                             null, -1.0f, 156928091L, -1, -1, 1280, 720, CODEC_ANY},
780                     {MEDIA_TYPE_VP9, new String[]{"bbb_1280x720_2000kbps_30fps_vp9.webm"},
781                             null, -1.0f, 3902485256L, -1, -1, 1280, 720, CODEC_ANY},
782             }));
783         }
784         return prepareParamList(exhaustiveArgsList, isEncoder, needAudio, needVideo, false);
785     }
786 
787     /**
788      * Extract, Decode and Validate. Check description of class {@link CodecDecoderValidationTest}
789      */
790     @ApiTest(apis = {"android.media.MediaCodecInfo.CodecCapabilities#COLOR_FormatYUV420Flexible",
791             "android.media.MediaCodecInfo.CodecCapabilities#COLOR_FormatYUVP010",
792             "android.media.AudioFormat#ENCODING_PCM_16BIT"})
793     // "5.1.3", "5.1.2/C-1-11" are covered partially
794     @CddTest(requirements = {"5.1.2/C-1-1", "5.1.2/C-1-2", "5.1.2/C-1-3", "5.1.2/C-1-4",
795             "5.1.2/C-1-11", "5.1.2/C-1-5", "5.1.2/C-1-6", "5.1.2/C-1-8", "5.1.2/C-1-9",
796             "5.1.2/C-1-10", "5.1.2/C-2-1", "5.1.2/C-6-1", "5.1.3", "5.3.1/C-1-1", "5.3.2/C-1-1",
797             "5.3.3/C-1-1", "5.3.4/C-1-1", "5.3.4/C-1-2", "5.3.4/C-2-1", "5.3.4/C-2-2",
798             "5.3.5/C-1-1", "5.3.5/C-1-2", "5.3.5/C-2-1", "5.3.6/C-1-1", "5.3.6/C-2-1",
799             "5.3.6/C-2-2", "5.3.7/C-1-1", "5.3.7/C-2-1", "5.3.7/C-3-1", "5.3.9/C-1-1",
800             "5.3.9/C-2-1", "5.3.9/C-2-2"})
801     @LargeTest
802     @Test(timeout = PER_TEST_TIMEOUT_LARGE_TEST_MS)
testDecodeAndValidate()803     public void testDecodeAndValidate() throws IOException, InterruptedException {
804         ArrayList<MediaFormat> formats = new ArrayList<>();
805         for (String file : mSrcFiles) {
806             formats.add(setUpSource(MEDIA_DIR + file));
807             mExtractor.release();
808         }
809         checkFormatSupport(mCodecName, mMediaType, false, formats, null, mSupportRequirements);
810         {
811             OutputManager ref = new OutputManager();
812             OutputManager test = new OutputManager(ref.getSharedErrorLogs());
813             mSaveToMem = true;
814             int loopCounter = 0;
815             for (String file : mSrcFiles) {
816                 mOutputBuff = loopCounter == 0 ? ref : test;
817                 mOutputBuff.reset();
818                 mCodec = MediaCodec.createByCodecName(mCodecName);
819                 MediaFormat format = setUpSource(MEDIA_DIR + file);
820                 configureCodec(format, false, true, false);
821                 mCodec.start();
822                 mExtractor.seekTo(0, MediaExtractor.SEEK_TO_CLOSEST_SYNC);
823                 doWork(Integer.MAX_VALUE);
824                 queueEOS();
825                 waitForAllOutputs();
826                 mOutFormat = mCodec.getOutputFormat();
827                 mCodec.stop();
828                 mCodec.release();
829                 mExtractor.release();
830                 if (!(mIsInterlaced ? ref.equalsDequeuedOutput(mOutputBuff) :
831                         ref.equals(mOutputBuff))) {
832                     fail("Decoder output received for file " + mSrcFiles[0]
833                             + " is not identical to the output received for file " + file + "\n"
834                             + mTestConfig + mTestEnv + mOutputBuff.getErrMsg());
835                 }
836                 assertEquals("Output sample rate is different from configured sample rate \n"
837                                 + mTestConfig + mTestEnv, mSampleRate,
838                         mOutFormat.getInteger(MediaFormat.KEY_SAMPLE_RATE, -1));
839                 assertEquals("Output channel count is different from configured channel count \n"
840                                 + mTestConfig + mTestEnv, mChannelCount,
841                         mOutFormat.getInteger(MediaFormat.KEY_CHANNEL_COUNT, -1));
842                 assertEquals("Output width is different from configured width \n" + mTestConfig
843                         + mTestEnv, mWidth, getWidth(mOutFormat));
844                 assertEquals("Output height is different from configured height \n" + mTestConfig
845                         + mTestEnv, mHeight, getHeight(mOutFormat));
846                 loopCounter++;
847             }
848             Assume.assumeFalse("skip checksum verification due to tone mapping",
849                     mSkipChecksumVerification);
850             if (mIsAudio) {
851                 int inputPcmEncoding = formats.get(0)
852                         .getInteger(MediaFormat.KEY_PCM_ENCODING, AudioFormat.ENCODING_PCM_16BIT);
853                 if (mMediaType.equals(MEDIA_TYPE_RAW)
854                         && inputPcmEncoding != AudioFormat.ENCODING_PCM_16BIT) {
855                     int outputPcmEncoding = mOutFormat.getInteger(MediaFormat.KEY_PCM_ENCODING,
856                             AudioFormat.ENCODING_PCM_16BIT);
857                     Assume.assumeTrue("output pcm encoding is not 16 bit, skipping output"
858                             + " validation", outputPcmEncoding == AudioFormat.ENCODING_PCM_16BIT);
859                 }
860             }
861             CodecDecoderTest.verify(ref, mRefFile, mRmsError, AudioFormat.ENCODING_PCM_16BIT,
862                     mRefCRC, mTestConfig.toString() + mTestEnv.toString());
863         }
864     }
865 }
866