android7.1+msm8937双MIC改为单MIC(晓龙相机录像声音小)

490 阅读3分钟
  1. 问题背景

晓龙相机录像的时候,回播视频发现外放声音非常小,但如果用耳机来听则正常。

  1. 产品和参考设计MIC的差别

image.png

  1. 录音时抓log和分析

录像的时候用logcat | grep snd_device抓log,如下

01-03 06:15:41.267 704 1035 D audio_hw_primary: select_devices: out_snd_device(2: speaker)in_snd_device(0: )

01-03 06:15:41.267 704 1035 D msm8916_platform: platform_can_split_snd_device: snd_device(2)num devices(1) new_snd_devices(5)

01-03 06:15:41.267 704 1035 I msm8916_platform: platform_check_and_set_codec_backend_cfg: becf:new_snd_devices[0] is speaker

01-03 06:15:41.267 704 1035 E msm8916_platform: platform_check_backends_match: Invalidsnd_device =

01-03 06:15:41.267 704 1035 D msm8916_platform: platform_can_split_snd_device: snd_device(2)num devices(0) new_snd_devices(0)

01-03 06:15:41.267 704 1035 D audio_hw_primary: enable_snd_device: snd_device(2: speaker)

01-03 06:15:41.309 704 1035 D msm8916_platform: platform_can_split_snd_device: snd_device(2)num devices(1) new_snd_devices(-299367304)

01-03 06:15:44.810 704 1035 D audio_hw_primary: disable_snd_device: snd_device(2: speaker)

01-03 06:15:44.810 704 1035 D msm8916_platform: platform_can_split_snd_device: snd_device(2)num devices(0) new_snd_devices(0)

01-03 06:15:53.127 704 1035 D audio_hw_primary: select_devices: out_snd_device(2: speaker)in_snd_device(0: )

01-03 06:15:53.127 704 1035 D msm8916_platform: platform_can_split_snd_device: snd_device(2)num devices(1) new_snd_devices(6)

01-03 06:15:53.127 704 1035 I msm8916_platform: platform_check_and_set_codec_backend_cfg: becf:new_snd_devices[0] is speaker

01-03 06:15:53.127 704 1035 E msm8916_platform: platform_check_backends_match: Invalidsnd_device =

01-03 06:15:53.128 704 1035 D msm8916_platform: platform_can_split_snd_device: snd_device(2)num devices(0) new_snd_devices(0)

01-03 06:15:53.128 704 1035 D audio_hw_primary: enable_snd_device: snd_device(2: speaker)

01-03 06:15:53.152 704 1035 D msm8916_platform: platform_can_split_snd_device: snd_device(2)num devices(1) new_snd_devices(-299367304)

01-03 06:15:57.753 704 1035 D audio_hw_primary: disable_snd_device: snd_device(2: speaker)

01-03 06:15:57.753 704 1035 D msm8916_platform: platform_can_split_snd_device: snd_device(2)num devices(0) new_snd_devices(0)

01-03 06:18:01.804 704 1035 D audio_hw_primary: select_devices: out_snd_device(2: speaker)in_snd_device(0: )

01-03 06:18:01.805 704 1035 D msm8916_platform: platform_can_split_snd_device: snd_device(2)num devices(1) new_snd_devices(8)

01-03 06:18:01.805 704 1035 I msm8916_platform: platform_check_and_set_codec_backend_cfg: becf:new_snd_devices[0] is speaker

01-03 06:18:01.805 704 1035 E msm8916_platform: platform_check_backends_match: Invalidsnd_device =

01-03 06:18:01.805 704 1035 D msm8916_platform: platform_can_split_snd_device: snd_device(2)num devices(0) new_snd_devices(0)

01-03 06:18:01.805 704 1035 D audio_hw_primary: enable_snd_device: snd_device(2: speaker)

01-03 06:18:01.838 704 1035 D msm8916_platform: platform_can_split_snd_device: snd_device(2)num devices(1) new_snd_devices(-299367304)

01-03 06:18:10.213 704 1035 D audio_hw_primary: disable_snd_device: snd_device(2: speaker)

01-03 06:18:10.213 704 1035 D msm8916_platform: platform_can_split_snd_device: snd_device(2)num devices(0) new_snd_devices(0)

01-03 06:18:10.294 704 3960 Daudio_hw_primary: select_devices: out_snd_device(0: ) in_snd_device(87:handset-stereo-dmic-ef)

01-03 06:18:10.295 704 3960 D msm8916_platform: platform_can_split_snd_device: snd_device(87)num devices(0) new_snd_devices(0)

01-03 06:18:10.295 704 3960 D audio_hw_primary: enable_snd_device: snd_device(87:handset-stereo-dmic-ef)

01-03 06:18:10.331 704 3960 D msm8916_platform: platform_can_split_snd_device: snd_device(87)num devices(1) new_snd_devices(-350227112)

01-03 06:18:10.519 704 1035 D audio_hw_primary: select_devices: out_snd_device(2: speaker)in_snd_device(0: )

01-03 06:18:10.519 704 1035 D msm8916_platform: platform_can_split_snd_device: snd_device(2)num devices(1) new_snd_devices(18)

01-03 06:18:10.519 704 1035 I msm8916_platform: platform_check_and_set_codec_backend_cfg: becf:new_snd_devices[0] is speaker

通过红色部分关键内容D audio_hw_primary:select_devices: out_snd_device(0: ) in_snd_device(87: handset-stereo-dmic-ef)可知录音的时候用到了副MIC(也就是snd_device),对应的设备名称为handset-stereo-dmic-ef

我们通过系统采用的hardware\qcom\audio\configs\msm8937\mixer_paths_qrd_sku2.xml文件,查看handset-stereo-dmic-ef的内容如下:

<pathname="handset-stereo-dmic-ef">

   <path name="speaker-dmic-endfire" />

可知handset-stereo-dmic-ef调用了speaker-dmic-endfire,接着看speaker-dmic-endfire

   <path name="adc1" />

   <ctl name="DEC2 MUX" value="ADC2" />

   <ctl name="MI2S_TX Channels" value="Two" />

   <ctl name="ADC2 MUX" value="INP3" />

可知采用的是双升到,要改为单MIC,修改后如下:

<pathname="speaker-dmic-endfire">

   <path name="adc1" />

同时新修hardware\qcom\audio\configs\msm8937\msm8937.mk下相关内容,修改前如下:

##fluencetype can be "fluence" or"fluencepro" or "none"

PRODUCT_PROPERTY_OVERRIDES += \

ro.qc.sdk.audio.fluencetype=fluence\

persist.audio.fluence.voicecall=true\

persist.audio.fluence.voicerec=false\

persist.audio.fluence.audiorec=true\

persist.audio.fluence.speaker=true

改后

##fluencetype can be "fluence" or"fluencepro" or "none"

PRODUCT_PROPERTY_OVERRIDES += \

ro.qc.sdk.audio.fluencetype=none\

#ro.qc.sdk.audio.fluencetype=fluence\

persist.audio.fluence.voicecall=true\

persist.audio.fluence.voicerec=false\

#persist.audio.fluence.audiorec=true\

persist.audio.fluence.speaker=true