|
发表于 2020-5-23 11:15:50
7411 浏览 0 回复
mic占用问题。 前后Camera同时录制。
当多个应用同时使用mic时导致程序奔溃,是因为系统默认mic为独占资源,不可被多个应用或者一个应用中的多个实列同时使用。
修改记录:android8.1
- frameworks\av\services\audiopolicy\managerdefault\AudioPolicyManager.cpp
- 1. audio_io_handle_t AudioPolicyManager::getInputForDevice()方法如下位置添加
- if (address == "") {
- DeviceVector inputDevices = mAvailableInputDevices.getDevicesFromType(device);
- // the inputs vector must be of size 1, but we don't want to crash here
- address = inputDevices.size() > 0 ? inputDevices.itemAt(0)->mAddress : String8("");
- }
- //add by jyj
- // Modify Tower 20190612: check wether have an AudioInputDescriptor Use the same profile
- 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;
- }
- }
- //end by jyj
- 2.status_t AudioPolicyManager::startInput()注释如下代码段
- #else
- /*if (!is_virtual_input_device(inputDesc->mDevice))
- .....
- .....注释的代码段
-
- }*/
- #endif
复制代码
修改之后本人试过camera前后摄像头同时录制视频。。。 |
|
|
|
|
|
|
登录或注册
|