Usages 和 Audio HAL 之间有什么联系?

问题描述

我正在尝试让音频在我们移植 Android 的板上工作。

目前,使用 USAGE_ALARM (4) 等用法播放的声音是可听的,而使用 USAGE_MEDIA (1) 等用法播放的声音是无声的。

对于可听用法,我们可以看到对音频 HAL 的调用

...
D audioflinger: Client defaulted notificationFrames to 11025 for frameCount 22050
D AF::TrackHandle: OpPlayAudio: track:64 usage:4 not muted
D audio_hw_primary: out_set_parameters: enter: kvpairs: routing=2
D audio_hw_primary: out_set_parameters: exit: code(0)
I audio_hw_primary: start_output_stream_primary... 0xf3856000,device 2,address,mode 0
I audio_hw_primary: select_output_device(),headphone 0,headset 0,speaker 2,earpiece 0,I audio_hw_primary: get_card_for_device adev: 0xf3828000,device: 2,flag: 0,card_index: 0xf3856158
W audio_hw_primary: card 0,port 0 device 0x2
W audio_hw_primary: rate 48000,channel 2 period_size 0xc0
W StreamHAL: Error from HAL stream in function get_presentation_position: Operation not permitted
...

而对于静用法,我们只看到:

...
D audioflinger: Client defaulted notificationFrames to 11025 for frameCount 22050
D AF::TrackHandle: OpPlayAudio: track:65 usage:1 not muted
W StreamHAL: Error from HAL stream in function get_presentation_position: Operation not permitted
...

我认为 /vendor/etc/audio_policy_configuration.xml 可能很重要。我已经将它配对回只有一个输出,但没有任何改变。

        <attachedDevices>
            <item>Speaker</item>
        ...
        <defaultOutputDevice>Speaker</defaultOutputDevice>
        <mixPorts>
            <mixPort name="primary output" role="source" flags="AUdio_OUTPUT_FLAG_PRIMARY">
                <profile name="" format="AUdio_FORMAT_PCM_16_BIT"
                         samplingRates="48000" channelMasks="AUdio_CHANNEL_OUT_STEREO"/>
        ...
        <devicePorts>
            <devicePort tagName="Speaker" type="AUdio_DEVICE_OUT_SPEAKER" role="sink" >
            </devicePort>
        ...
        <routes>
            <route type="mix" sink="Speaker"
                   sources="primary output"/>

AOSP 的哪一部分负责不同用途的路由?

为什么有些工作有些沉

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...