最近在搞项目上的 xts 认证,解了一些问题,记录一些知识。
1. DeclaredInputStreamConfigSupport/InputStreamTest#SetAudioProperties/1_default_primary_1__11025_AUDIO_CHANNEL_IN_MONO___,flow:
(1)open:
testOpen -> helper.open -> openStream(AudioPrimaryHidlHalTest.h)
open input stream(hal)
(2)getSupportedProfiles:
testSetAudioProperties
->
stream->getSupportedProfiles(AudioPrimaryHidlHalTest.h)
Stream::getSupportedProfiles(Stream.cpp)
getParam分别get keyStreamSupportedFormats、keyStreamSupportedSamplingRates、
keyStreamSupportedChannels
get parameter(hal)
hal需要返回支持的格式字符串,每种format、ch、sr中间用 '|' 隔开。
现在解决的问题就是:如果在get的这一步,hal 已经返回了不支持,那整个测项就会返回Ignore。
(3)setAudioProperties
testSetAudioProperties
->
stream->setAudioProperties(AudioPrimaryHidlHalTest.h)
set parameter(hal)
这一步也得注意要做的事情和返回值。
(4)closeStream
closeStream
-->
helper.close(AudioPrimaryHidlHalTest.h)
mStream->close()
close input stream(HAL)
2. run cts -m CtsMediaTestCases -t android.media.cts.DecoderTest#testTunneledAccurateVideoFlushVp9
该测项遇到create audio track不成功,但xml 里明明有相符的mixport;
log显示,在下面的位置会直接rerun:
bool IOProfile::isCompatibleProfile(……)
{
……
if (!devices.isEmpty()) {
if (!mSupportedDevices.containsAllDevices(devices)) {
return false;
}
}
……
}
devices 是当前要求的输出设备,mSupportedDevices 是当前某个mixport支持的输出设备,定义在xml 中<routes>标签下,当routes中没有时,就会找不到。
3. "Audio Frequency Speaker Test" in CtsVerifier.apk
安照要求,是需要用usb麦克录设备的喇叭出来的声音;但是如果不想那么麻烦的话,直接用耳机播出的声音也可以(因为插上usb声卡,就直接切到usb耳机出声了,设置里也没有可调节的选项)。
测试时,直接用同一个usb耳机自己的麦克录耳机的声音,即可pass。
需注意的是,pm install 安装CtsVerifier.apk时,需要带-g 选项(把所有权限都带上)。