RK3576 android14 CtsMediaV2TestCases fail项
平台: RK3576,android14
测试源码:
public void testDecodeAndValidate() throws IOException, InterruptedException {
// 初始化媒体格式列表,遍历所以测试源文件
ArrayList<MediaFormat> formats = new ArrayList<>();
for (String file : mSrcFiles) {
formats.add(setUpSource(MEDIA_DIR + file));
mExtractor.release();
}
// 检查解码器支持
checkFormatSupport(mCodecName, mMediaType, false, formats, null, mSupportRequirements);
{
// 参考输出
OutputManager ref = new OutputManager();
// 测试输出
OutputManager test = new OutputManager(ref.getSharedErrorLogs());
mSaveToMem = true; //将解码结果保存到内存
int loopCounter = 0;
for (String file : mSrcFiles) {
// 初始化输出管理器
mOutputBuff = loopCounter == 0 ? ref : test;
mOutputBuff.reset();
// 配置并启动解码器
mCodec = MediaCodec.createByCodecName(mCodecName);
MediaFormat format = setUpSource(MEDIA_DIR + file);
configureCodec(format, false, true, false); //配置解码器
mCodec.start();
mExtractor.seekTo(0, MediaExtractor.SEEK_TO_CLOSEST_SYNC); // 定位到起始位置
// 执行解码
doWork(Integer.MAX_VALUE); // 解码所以帧
queueEOS(); // 发送结束信号
waitForAllOutputs(); //等待解码完成
mOutFormat = mCodec.getOutputFormat(); // 获取输出格式
// 释放资源
mCodec.stop();
mCodec.release();
mExtractor.release();
// 验证输出一致性
if (!(mIsInterlaced ? ref.equalsInterlaced(mOutputBuff) :
ref.equals(mOutputBuff))) {
fail("Decoder output received for file " + mSrcFiles[0]
+ " is not identical to the output received for file " + file + "\n"
+ mTestConfig + mTestEnv + mOutputBuff.getErrMsg());
}
// 验证输出格式参数
assertEquals("Output sample rate is different from configured sample rate \n"
+ mTestConfig + mTestEnv, mSampleRate,
mOutFormat.getInteger(MediaFormat.KEY_SAMPLE_RATE, -1)); //采样率
assertEquals("Output channel count is different from configured channel count \n"
+ mTestConfig + mTestEnv, mChannelCount,
mOutFormat.getInteger(MediaFormat.KEY_CHANNEL_COUNT, -1)); //声道数
assertEquals("Output width is different from configured width \n" + mTestConfig
+ mTestEnv, mWidth, getWidth(mOutFormat)); // 宽度
assertEquals("Output height is different from configured height \n" + mTestConfig
+ mTestEnv, mHeight, getHeight(mOutFormat)); // 高度
loopCounter++;
}
// 校验和验证
Assume.assumeFalse("skip checksum verification due to tone mapping",
mSkipChecksumVerification);
if (mIsAudio) {
int inputPcmEncoding = formats.get(0)
.getInteger(MediaFormat.KEY_PCM_ENCODING, AudioFormat.ENCODING_PCM_16BIT);
if (mMediaType.equals(MEDIA_TYPE_RAW)
&& inputPcmEncoding != AudioFormat.ENCODING_PCM_16BIT) {
int outputPcmEncoding = mOutFormat.getInteger(MediaFormat.KEY_PCM_ENCODING,
AudioFormat.ENCODING_PCM_16BIT);
Assume.assumeTrue("output pcm encoding is not 16 bit, skipping output"
+ " validation", outputPcmEncoding == AudioFormat.ENCODING_PCM_16BIT);
}
}
CodecDecoderTest.verify(ref, mRefFile, mRmsError, AudioFormat.ENCODING_PCM_16BIT,
mRefCRC, mTestConfig.toString() + mTestEnv.toString());
}
}
整体流程总结
1、准备阶段:收集所有测试文件的媒体格式信息
2、能力检查:确认解码器支持这些格式
3、解码测试:
· 用参考文件建立基准输出
·解码其他文件并对比输出是否一致
·验证输出格式参数的正确性
4、输出校验:通过校验和误差值确保数据的准确性。
测试fail项的log:
03-20 09:15:58.776 10308 12822 12834 E TestRunner: failed: testDecodeAndValidate[264_c2.android.vp8.decoder_video/x-vnd.on2.vp8](android.mediav2.cts.CodecDecoderValidationTest)
03-20 09:15:58.776 10308 12822 12834 E TestRunner: ----- begin exception -----
03-20 09:15:58.776 1046 843 10125 I hw-BpHwBinder: onLastStrongRef automatically unlinking death recipients
03-20 09:15:58.777 10308 12822 12834 E TestRunner: java.lang.AssertionError: format(s) not supported by any component for mediaType : video/x-vnd.on2.vp8 formats: [{color-format=2135033992, track-id=1, durationUs=1000000, mime=video/x-vnd.on2.vp8, width=1920, language=und, color-range=2, height=1080}]
03-20 09:15:58.777 10308 12822 12834 E TestRunner: at org.junit.Assert.fail(Assert.java:89)
03-20 09:15:58.777 10308 12822 12834 E TestRunner: at android.mediav2.common.cts.CodecTestBase.checkFormatSupport(CodecTestBase.java:492)
03-20 09:15:58.777 10308 12822 12834 E TestRunner: at android.mediav2.cts.CodecDecoderValidationTest.testDecodeAndValidate(CodecDecoderValidationTest.java:782)
03-20 09:15:58.777 10308 12822 12834 E TestRunner: at java.lang.reflect.Method.invoke(Native Method)
03-20 09:15:58.777 10308 12822 12834 E TestRunner: at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
03-20 09:15:58.777 10308 12822 12834 E TestRunner: at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
03-20 09:15:58.777 10308 12822 12834 E TestRunner: at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:61)
03-20 09:15:58.777 10308 12822 12834 E TestRunner: at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
03-20 09:15:58.777 10308 12822 12834 E TestRunner: at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:148)
03-20 09:15:58.777 10308 12822 12834 E TestRunner: at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:142)
03-20 09:15:58.777 10308 12822 12834 E TestRunner: at java.util.concurrent.FutureTask.run(FutureTask.java:264)
03-20 09:15:58.777 10308 12822 12834 E TestRunner: at java.lang.Thread.run(Thread.java:1012)
03-20 09:15:58.777 10308 12822 12834 E TestRunner: ----- end exception -----
可以看出 解码器不支持c2.android.vp8.decoder 的1080p 格式。
这个问题询问了下RK的工程师,替换了相关media库文件。
打了如下patch,可以解决问题。
diff --git a/vendor/rockchip/common/vpu/etc/media_codecs_google_c2_rk3576.xml b/vendor/rockchip/common/vpu/etc/media_codecs_google_c2_rk3576.xml
index ea2e31bb1c8..29a468f61fb 100644
--- a/vendor/rockchip/common/vpu/etc/media_codecs_google_c2_rk3576.xml
+++ b/vendor/rockchip/common/vpu/etc/media_codecs_google_c2_rk3576.xml
@@ -38,10 +38,10 @@
<Alias name="OMX.google.vp8.decoder" />
<Limit name="alignment" value="2x2" />
<Limit name="block-size" value="16x16" />
- <Limit name="size" min="2x2" max="1280x1280" />
- <Limit name="block-count" range="1-3600" /> <!-- max 1280x720 -->
- <Limit name="blocks-per-second" range="1-244800" />
- <Limit name="bitrate" range="1-10000000" />
+ <Limit name="size" min="2x2" max="2048x2048" />
+ <Limit name="block-count" range="1-16384" />
+ <Limit name="blocks-per-second" range="1-1000000" />
+ <Limit name="bitrate" range="1-40000000" />
<Feature name="adaptive-playback" />
</MediaCodec>
<MediaCodec name="c2.android.vp9.decoder" type="video/x-vnd.on2.vp9" update="true">
浙公网安备 33010602011771号