I have the following system:
The proprietary NXP Primary Audio HAL, which supports the SGTL5000 is working correctly. I can play and record sound from Android.
The EM12-G modem appears as a USB sound card. I can use tinyplay, from adb shell, to play .wav files from the modem into a remote telephone (when the call is already set-up). i.e. The EM12-G is working correctly as a sound card at the ALSA layer as the sound is emerging at the remote telephone.
My problem is that when I replace the default usb_audio_policy_configuration.xml
<module name="usb" halVersion="2.0">
<mixPorts>
<mixPort name="usb_accessory output" role="source">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="44100" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
</mixPort>
<mixPort name="usb_device output" role="source"/>
<mixPort name="usb_device input" role="sink"/>
</mixPorts>
<devicePorts>
<devicePort tagName="USB Host Out" type="AUDIO_DEVICE_OUT_USB_ACCESSORY" role="sink">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="44100" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
</devicePort>
<devicePort tagName="USB Device Out" type="AUDIO_DEVICE_OUT_USB_DEVICE" role="sink"/>
<devicePort tagName="USB Headset Out" type="AUDIO_DEVICE_OUT_USB_HEADSET" role="sink"/>
<devicePort tagName="USB Device In" type="AUDIO_DEVICE_IN_USB_DEVICE" role="source"/>
<devicePort tagName="USB Headset In" type="AUDIO_DEVICE_IN_USB_HEADSET" role="source"/>
</devicePorts>
<routes>
<route type="mix" sink="USB Host Out"
sources="usb_accessory output"/>
<route type="mix" sink="USB Device Out"
sources="usb_device output"/>
<route type="mix" sink="USB Headset Out"
sources="usb_device output"/>
<route type="mix" sink="usb_device input"
sources="USB Device In,USB Headset In"/>
</routes>
</module>
with a custom version where the EM12-G USB sound card is treated as a modem:
<module name="usb" halVersion="2.0">
<attachedDevices>
<item>Telephony Tx</item>
<item>Telephony Rx</item>
</attachedDevices>
<mixPorts>
<mixPort name="voice_tx" role="source">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="16000" channelMasks="AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO"/>
</mixPort>
<mixPort name="voice_rx" role="sink">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="16000" channelMasks="AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO"/>
</mixPort>
</mixPorts>
<devicePorts>
<devicePort tagName="Telephony Rx" type="AUDIO_DEVICE_IN_TELEPHONY_RX" role="source">
</devicePort>
<devicePort tagName="Telephony Tx" type="AUDIO_DEVICE_OUT_TELEPHONY_TX" role="sink">
</devicePort>
</devicePorts>
<routes>
<route type="mix" sink="Telephony Tx"
sources="voice_tx"/>
<route type="mix" sink="voice_rx"
sources="Telephony Rx"/>
</routes>
</module>
I still get no call audio.
Investigating this, by added debugging to many of the .c and .cpp audio source files, I see:
I AudioFlinger: nextUniqueId()
I AudioFlinger: loadHwModule() Loaded usb audio interface, handle 18
I AudioPolicyClientImpl: openOutput(), address: ""
I AudioFlinger: openOutput(), address: ""
I AudioFlinger: openOutput() this 0xe8a10dbf1600, module 18 Device 0x10000, SamplingRate 16000, Format 0x000001, Channels 0x3, flags 0
I AudioFlinger: openOutput_l(), address: ""
I AudioFlinger: findSuitableHwDev_l()
I AudioFlinger: nextUniqueId()
I DeviceHAL: openOutputStream()
I DeviceHAL: openOutputStreamImpl()
I DeviceHAL: open_output_stream handle: 21 devices: 10000 flags: 0 srate: 16000 format 0x1 channels 3 address
I modules.usbaudio.audio_hal: adev_open_output_stream()
I modules.usbaudio.audio_hal: adev_open_output_stream() handle:0x15, devicesSpec:0x10000, flags:0x0, address:""
I modules.usbaudio.audio_hal: parse_card_device_params()
I modules.usbaudio.audio_hal: parse_card_device_params() *card: -1, *device: -1
I modules.usbaudio.audio_hal: adev_open_output_stream() ret: 0
I DeviceHAL: open_output_stream status 0 stream 0xf2205540
I DeviceHAL: analyzeStatus()
I modules.usbaudio.audio_hal: out_get_sample_rate()
The principle issue here is that the higher layers are not giving the lower layers any addresses, resulting in *card = -1, *device = -1. The lower layers need to know the card number and device number, of the EM12-G modem sound card, to open it.
When using the headset config I see:
I modules.usbaudio.audio_hal: parse_card_device_params() "card=3;device=0"
I modules.usbaudio.audio_hal: parse_card_device_params() *card: 3, *device: 0
Questions:
- Can the USB Audio HAL be used for a call audio?
- If so, what is wrong with the configuration which I am using?
from How to configure call audio between Primary HAL and USB Audio HAL?

No comments:
Post a Comment