部分客戶客戶使用第三方視頻播放器,有立體聲與單聲道之間切換,發現切換後無作用
原因是由於在HAL層預設沒有處理上層發的stereo 轉mono的命令,所以會沒有效果,
可按如下修改,添加相關處理:
1修改AudioMTKHardware.cpp
添加:static String8 keySetStereo2MonoMode = String8("EnableStereoOutput");
2.修改status_t AudioMTKHardware::setParameters(const String8 &keyValuePairs)
在EXIT_SETPARAMETERS:
之前添加: 複製代碼 代碼如下:if (param.getInt(keySetStereo2MonoMode, value) == NO_ERROR) {
ALOGD("setParameters(): %s value=%d", keyValuePairs.string(),value);
((AudioMTKStreamManager*)mAudioMTKStreamManager)->ForceSterer2Mono(value);
}
3.修改AudioMTKStreamManager.h
添加public方法定義: 複製代碼 代碼如下:status_t ForceSterer2Mono(bool flag);
status_t AudioMTKStreamManager::ForceSterer2Mono(bool flag)
{
// force all stream to standby
ALOGD("ForceSterer2Mono = %d",flag);
if (mStreamOutVector.size()) {
for (size_t i = 0; i < mStreamOutVector.size() ; i++) {
AudioMTKStreamOut *pTempOut = (AudioMTKStreamOut *)mStreamOutVector.valueAt(i);
pTempOut->SetStereoToMonoFlagForce(flag);
}
}
return NO_ERROR;
}
4.修改AudioMTKStreamOut.h
t添加定義: 複製代碼 代碼如下:status_t SetStereoToMonoFlagForce(bool flag);
status_t AudioMTKStreamOut::SetStereoToMonoFlagForce(bool flag)
{
ALOGD("SetStereoToMonoFlagForce = %d",flag);
mSteroToMono = flag;
return NO_ERROR;
}