概述
RK SDK:安卓7.1/8.1/9.0
默认情况下,安卓只支持单个录音app使用mic,如果需要多个录音app能同时使用mic,可加下述patch。
修改方案1:
文件:frameworks/av/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
~/frameworks/av/services/audiopolicy/managerdefault$ git diff ./
diff --git a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
index e947c8be0..8c4c8cfff 100755
--- a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
+++ b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
@@ -1760,7 +1760,7 @@ audio_io_handle_t AudioPolicyManager::getInputForDevice(audio_devices_t device,
policyMix, mpClientInterface);
// FIXME: disable concurrent capture until UI is ready
-#if 0
+#if 1
// reuse an open input if possible
sp<AudioInputDescriptor> reusedInputDesc;
for (size_t i = 0; i < mInputs.size(); i++) {
修改方案二:
文件:frameworks/av/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
diff --git a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
index 504d588..bb9155d 100755
--- a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
+++ b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
@@ -16,7 +16,7 @@
#define LOG_TAG "APM_AudioPolicyManager"
#define LOG_NDEBUG 0
-
+#define ANDROID8_1_SUPPORT_MULIT_CHANNEL_RECORDING
//#define VERY_VERBOSE_LOGGING
#ifdef VERY_VERBOSE_LOGGING
#define ALOGVV ALOGV
@@ -1782,6 +1782,18 @@ audio_io_handle_t AudioPolicyManager::getInputForDevice(audio_devices_t device,
}
#endif
+#ifdef ANDROID8_1_SUPPORT_MULIT_CHANNEL_RECORDING
+ for (size_t input_index = 0; input_index < mInputs.size(); input_index++) {
+ sp<AudioInputDescriptor> desc;
+ desc = mInputs.valueAt(input_index);
+ if (desc->mProfile == profile) {
+ audioSession->changeActiveCount(1); // reference count add
+ desc->addAudioSession(session, audioSession);
+ return desc->mIoHandle;
+ }
+ }
+#endif
+
if (!profile->canOpenNewIo()) {
return AUDIO_IO_HANDLE_NONE;
}
@@ -1939,6 +1951,7 @@ status_t AudioPolicyManager::startInput(audio_io_handle_t input,
*concurrency |= API_INPUT_CONCURRENCY_CAPTURE;
}
#else
+#ifndef ANDROID8_1_SUPPORT_MULIT_CHANNEL_RECORDING
if (!is_virtual_input_device(inputDesc->mDevice)) {
if (mCallTxPatch != 0 &&
inputDesc->getModuleHandle() == mCallTxPatch->mPatch.sources[0].ext.device.hw_module) {
@@ -2035,6 +2048,7 @@ status_t AudioPolicyManager::startInput(audio_io_handle_t input,
}
}
#endif
+#endif
// Make sure we start with the correct silence state
audioSession->setSilenced(silenced);
最后
以上就是忧虑小鸽子为你收集整理的RK系列SDK -- 支持多个录音应用同时使用mic功能的全部内容,希望文章能够帮你解决RK系列SDK -- 支持多个录音应用同时使用mic功能所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复