查看声卡状态
//查看模拟声卡播放状态: adb shell cat /proc/asound/card0/*/*/status //查看VOIP声卡播放状态: adb shell cat /proc/asound/card1/*/*/status
实例:
查看声卡顺序,每次开机注册顺序可能不一样,可以看到目前系统有三个声卡: 模拟声卡,打电话的声卡,voip声卡 1|sl8541e_1h10_32b:/ $ cat /proc/asound/cards 0 [sprdphone ]: sprdphone - sprdphone sprdphone 1 [saudiolte ]: saudiolte - saudiolte saudiolte 2 [saudiovoip ]: saudiovoip - saudiovoip saudiovoip 待机: sl8541e_1h10_32b:/ $ cat /proc/asound/card0/*/*/status closed closed closed closed closed closed closed closed sl8541e_1h10_32b:/ $ cat /proc/asound/card1/*/*/status closed closed closed closed 讲话(录音): sl8541e_1h10_32b:/ $ cat /proc/asound/card0/*/*/status closed closed state: RUNNING owner_pid : 7264 trigger_time: 1666836399.469438708 tstamp : 0.000000000 delay : 0 avail : 0 avail_max : 0 ----- hw_ptr : 0 appl_ptr : 0 state: PREPARED owner_pid : 7264 trigger_time: 1666836399.468863862 tstamp : 0.000000000 delay : 0 avail : 320 avail_max : 0 ----- hw_ptr : 0 appl_ptr : 0 closed closed closed closed sl8541e_1h10_32b:/ $ cat /proc/asound/card1/*/*/status closed closed closed closed 收听(播放): sl8541e_1h10_32b:/ $ cat /proc/asound/card0/*/*/status closed state: RUNNING owner_pid : 949 trigger_time: 1179.798942809 tstamp : 1187.602456649 delay : 1200 avail : 720 avail_max : 1360 ----- hw_ptr : 344400 appl_ptr : 345600 closed closed closed closed closed closed sl8541e_1h10_32b:/ $ cat /proc/asound/card1/*/*/status closed closed closed closed
昨晚修改后,VOIP通过LOG看已经打开,但是调试音频参数时发现通道似乎又切走了,再次分析日志。
下图是发起对讲:
image.png
发现VOIP打开后,又立即被关闭。
adb查看发起讲话时的声卡状态:
sl8541e_1h10_32b:/ # cat /proc/asound/cards 0 [sprdphone ]: sprdphone - sprdphone sprdphone 1 [saudiolte ]: saudiolte - saudiolte saudiolte 2 [saudiovoip ]: saudiovoip - saudiovoip saudiovoip sl8541e_1h10_32b:/ # cat /proc/asound/card1/*/*/status closed closed closed closed sl8541e_1h10_32b:/ # cat /proc/asound/card0/*/*/status state: RUNNING owner_pid : 4994 trigger_time: 1176.116787850 tstamp : 1182.896760038 delay : 0 avail : 0 avail_max : 320 ----- hw_ptr : 54080 appl_ptr : 54080 closed closed closed closed closed closed closed sl8541e_1h10_32b:/ # cat /proc/asound/card2/*/*/status closed closed closed sl8541e_1h10_32b:/ #
结论是对讲中,模拟声卡起作用,VOIP声卡关闭,问题还是在软件上。
原因分析:
发起对讲的过程是:按下PTT后,开始录音(打开VOIP),同时播放提示音(打开VOIP),提示音播放完(关闭VOIP)。导致后续的录音VOIP关闭状态。