通过查看Log发现,是由于按下PTT键播放Tone音时影响了录音的启动,该Tone音使用的是STREAM_CALL类型,于是修改为STREAM_MUSIC后解决此问题。
分析过程如下:
log分析
建议你们梳理一下上层的流程和配置。你上层开启的stream可能有问题。 08-05 13:24:54.267 145 1898 D AudioPolicyManagerSPRD: startOutput() is_voip_set 0,stream 0, 08-05 13:24:54.267 145 1898 D AudioPolicyManagerSPRD: startOutput() outputDesc->mRefCount[AudioSystem::VOICE_CALL] 1 08-05 13:24:54.267 145 315 D AudioPolicyService: AudioCommandThread() processing set parameters string sprd_voip_start=true, io 0 08-05 13:24:54.267 145 315 V AudioFlinger: setParameters(): io 0, keyvalue sprd_voip_start=true, calling pid 145 08-05 13:24:54.267 145 315 W audio_hw_primary: adev_set_parameters, kvpairs : sprd_voip_start=true AudioSystem::VOICE_CALL这个设置会让sprd_voip_start打开。直到13:24:54.867 tone音播放结束,关闭voip: 08-05 13:24:54.867 145 315 D AudioPolicyService: AudioCommandThread() processing set parameters string sprd_voip_start=false, io 0 08-05 13:24:54.867 145 315 V AudioFlinger: setParameters(): io 0, keyvalue sprd_voip_start=false, calling pid 145 之后,才开始真正的录音: 08-05 13:24:54.867 145 2174 D audio_hw_primary: : in_read sco stop and do standby // 这时 sco的read才关闭 // 正常声卡录音设备才打开 08-05 13:24:54.907 145 357 W audio_hw_primary: open s_tinycard in 08-05 13:24:54.917 145 357 W audio_hw_primary: open s_tinycard successfully 08-05 13:24:54.967 145 2174 E audio_hw_primary: start_input_stream pcm_open_0 08-05 13:24:54.967 145 2174 W audio_hw_primary: rec_mode(3), sample_rate(8000) 08-05 13:24:54.977 1867 2175 D oem_dsp : first record dequed 08-05 13:24:54.977 145 2174 W audio_hw_primary: extendArraySize=118, eq_size=52, dp_size=38 08-05 13:24:54.977 145 2174 I audio_hw_primary: record process module created is successful. 也就是说在“in_read sco stop and do standby”后才可能录音,13:24:54.267 ~ 13:24:54.867之间的都是通话相关的流程(dsp控制vbc和codec设备),不可能录到音。 从log看直到13:24:54.977,才录到第一帧。 08-05 13:24:54.977 1867 2175 D oem_dsp : first record dequed 之前都是录不到的: 08-05 13:24:54.957 1867 1888 W oem_dsp : recorder read none frame