完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
扫一扫,分享给好友
Platform: RK3399 OS: Android 7.1 Kernel: v4.4.83 需求: 使用思必驰的方案做语音识别功能,并且不影响普通的麦克风录音功能。 分析: 由于speech也是用的内置mic设备(软件中),这样和会系统使用的录音设备冲突,导致audio policy中的input profile只有一个有效。 因此两种方法解决此问题: 1.修改speech使用的设备 2.修改系统自身使用的设备 这里使用后者,相对来说方便并且可控一些。 解决方法: Framework改动: kris@eco:~/rk3399/frameworks/av$ g df diff --git a/services/audiopolicy/enginedefault/src/Engine.cpp b/services/audiopolicy/enginedefault/src/Engine.cpp index a091512..abff1b7 100755 --- a/services/audiopolicy/enginedefault/src/Engine.cpp +++ b/services/audiopolicy/enginedefault/src/Engine.cpp @@ -605,7 +605,11 @@ audio_devices_t Engine::getDeviceForInputSource(audio_source_t inputSource) cons device = AUDIO_DEVICE_IN_WIRED_HEADSET; } else if (availableDeviceTypes & AUDIO_DEVICE_IN_USB_DEVICE) { device = AUDIO_DEVICE_IN_USB_DEVICE; - } else if (availableDeviceTypes & AUDIO_DEVICE_IN_BUILTIN_MIC) { + //Kris, 190116, merge Speech module into audio framework. { + } else if (availableDeviceTypes & AUDIO_DEVICE_IN_BACK_MIC) { + device = AUDIO_DEVICE_IN_BACK_MIC; + //Kris, 190116, merge Speech module into audio framework. } + } else if (availableDeviceTypes & AUDIO_DEVICE_IN_BUILTIN_MIC) { device = AUDIO_DEVICE_IN_BUILTIN_MIC; } break; HAL层改动: kris@eco:~/rk3399/hardware/rockchip/audio$ g df 0fbb25860bb656abc420f06b902255d749ba0952 a0a3a771928a973b03d9ef6adc3e7d7685264448 diff --git a/tinyalsa_hal/audio_hw.c b/tinyalsa_hal/audio_hw.c index e1fb819..c7c244d 100755 --- a/tinyalsa_hal/audio_hw.c +++ b/tinyalsa_hal/audio_hw.c @@ -338,7 +338,13 @@ uint32_t getInputRouteFromDevice(uint32_t device) }*/ ALOGE("%s:device:%x",__FUNCTION__,device); switch (device) { +//Kris, 190116, merge Speech module into audio framework. { +#if 0 case AUDIO_DEVICE_IN_BUILTIN_MIC: +#else + case AUDIO_DEVICE_IN_BACK_MIC: +#endif +//Kris, 190116, merge Speech module into audio framework. } return MAIN_MIC_CAPTURE_ROUTE; case AUDIO_DEVICE_IN_WIRED_HEADSET: return HANDS_FREE_MIC_CAPTURE_ROUTE; 添加speech库: kris@eco:~/rk3399/device/rockchip/rk3399$ g df diff --git a/device.mk b/device.mk index 5d8ced7..5dd0ffd 100644 --- a/device.mk +++ b/device.mk @@ -303,6 +303,12 @@ PRODUCT_COPY_FILES += device/rockchip/rk3399/ril/lib/libreference-ril.so:system/lib/libreference-ril.so device/rockchip/rk3399/ril/lib64/libreference-ril.so:system/lib64/libreference-ril.so +#Kris, 190116, merge Speech module into audio framework. +PRODUCT_COPY_FILES += + device/rockchip/rk3399/aispeech/etc/aispeech_rk3399_ecovacs.bin:system/etc/aispeech_rk3399_ecovacs.bin + device/rockchip/rk3399/aispeech/etc/AEC_ch8-2-ch6_2ref.bin:system/etc/AEC_ch8-2-ch6_2ref.bin + device/rockchip/rk3399/aispeech/lib/arm/audio.aispeech.default.so:system/lib/hw/audio.aispeech.default.so + device/rockchip/rk3399/aispeech/lib/arm64/audio.aispeech.default.so:system/lib64/hw/audio.aispeech.default.so audio policy文件改动: kris@eco:~/rk3399/device/rockchip/common$ g df diff --git a/audio_policy_rk30board.conf b/audio_policy_rk30board.conf index 84315ad..a095d7b 100755 --- a/audio_policy_rk30board.conf +++ b/audio_policy_rk30board.conf @@ -5,7 +5,7 @@ global_configuration { attached_output_devices AUDIO_DEVICE_OUT_SPEAKER default_output_device AUDIO_DEVICE_OUT_SPEAKER - attached_input_devices AUDIO_DEVICE_IN_BUILTIN_MIC|AUDIO_DEVICE_IN_REMOTE_SUBMIX + attached_input_devices AUDIO_DEVICE_IN_BUILTIN_MIC|AUDIO_DEVICE_IN_REMOTE_SUBMIX|AUDIO_DEVICE_IN_BACK_MIC } # audio hardware module section: contains descriptors for all audio hw modules present on the @@ -50,7 +50,17 @@ audio_hw_modules { sampling_rates 8000|11025|16000|22050|32000|44100|48000 channel_masks AUDIO_CHANNEL_IN_MONO|AUDIO_CHANNEL_IN_STEREO formats AUDIO_FORMAT_PCM_16_BIT - devices AUDIO_DEVICE_IN_BUILTIN_MIC|AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET|AUDIO_DEVICE_IN_WIRED_HEADSET + devices AUDIO_DEVICE_IN_BACK_MIC|AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET|AUDIO_DEVICE_IN_WIRED_HEADSET + } + } + } + aispeech { + inputs { + aispeech { + sampling_rates 8000|16000|32000|44100|48000|128000 + channel_masks AUDIO_CHANNEL_IN_MONO|AUDIO_CHANNEL_IN_STEREO + formats AUDIO_FORMAT_PCM_16_BIT + devices AUDIO_DEVICE_IN_BUILTIN_MIC } } } |
|
|
|
你正在撰写答案
如果你是对答案或其他答案精选点评或询问,请使用“评论”功能。
基于米尔瑞芯微RK3576核心板/开发板的人脸疲劳检测应用方案
533 浏览 0 评论
803 浏览 1 评论
700 浏览 1 评论
1926 浏览 1 评论
3171 浏览 1 评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-22 10:52 , Processed in 0.738632 second(s), Total 71, Slave 54 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号