AnsweredAssumed Answered

hfp support at android hal

Question asked by verma on Aug 7, 2015
Latest reply on Jul 28, 2016 by bai aaren

Hi,

 

We want to support hfp profile along with normal audio on our board. Please let me know what changes required in android hal to support both?

 

On our board, We have created two sound cards in kernel:

sound card 0: for noarmal audio data. It works as a primary sound card.

sound card 1: for bluetooth sco data.

 

We have seperately tested both. Both are working fine.(I have disabled the "sound card 0" for audio codec, so "sound card 1" becomes "sound card 0".Doing this all the bt sco data goes to primary. This way I tested bt through android & it is working fine.)

 

To support both,

I created one more "myandroid/hardware/imx/alsa_hfp" directory & added the hfp entry in /system/etc/audio_policy.conf.

It is able to properly found the "sound card 1" for bt. but it is failing at  function "str_parms_get_str()" inside "out_set_parameters()".

Please see the below logs:

=====================

W/audio_hw_hfp( 2137): file = hardware/imx/alsa_hfp/tinyalsa_hal.c === line = 3301 ===

W/audio_hw_hfp( 2137): out rate 8000

W/audio_hw_hfp( 2137): in rate 8000, channels 1 format 0

E/audio_hw_hfp( 2137): select_output_device,387

E/audio_hw_hfp( 2137): headphone 0 ,headset 0 ,speaker 0, earpiece 0,

I/AudioFlinger( 2137): loadHwModule() Loaded hfp audio interface from Freescale i.MX Audio HW HAL (audio) handle 5

W/audio_hw_hfp( 2137): In channels 1, rate 44100, devices 0x4

W/audio_hw_hfp( 2137): get_input_buffer_size size = 5648, channel_count = 1

W/audio_hw_hfp( 2137): get_input_buffer_size size = 5648, channel_count = 1

I/AudioFlinger( 2137): AudioFlinger's thread 0x75a52000 ready to run

E/AudioService(  414): Media server started.

W/audio_hw_primary( 2137): set parameters restarting=true

E/audio_hw_hfp( 2137): MIT: adev_set_parameters,2989

W/audio_hw_hfp( 2137): set parameters restarting=true

E/audio_hw_hfp( 2137): MIT: file - hardware/imx/alsa_hfp/tinyalsa_hal.c adev_open_output_stream,2827

W/audio_hw_hfp( 2137): open output stream devices 32, format 1, channels 1, sample_rate 8000, flag 1

W/audio_hw_hfp( 2137): opened out stream...1964143488, type 1

I/AudioFlinger( 2137): HAL output buffer size 192 frames, normal sink buffer size 192 frames

I/AudioFlinger( 2137): AudioFlinger's thread 0x75138300 ready to run

W/audio_hw_hfp( 2137): out_set_parameters 80:57:19:8A:B4:0D, ret -2, out 1964143488

W/audio_hw_hfp( 2137): out_set_parameters closing=true, ret -2, out 1964143488

W/audio_hw_hfp( 2137): out_set_parameters exiting=1, ret -2, out 1964143488

W/audio_hw_hfp( 2137): adev_close_output_stream...1964143488

W/audio_hw_primary( 2137): out_set_parameters routing=0, ret 0, out 1980319936

W/audio_hw_hfp( 2137): In channels 1, rate 44100, devices 0x80000008

W/audio_hw_hfp( 2137): get_input_buffer_size size = 5648, channel_count = 1

W/audio_hw_hfp( 2137): get_input_buffer_size size = 5648, channel_count = 1

I/AudioFlinger( 2137): AudioFlinger's thread 0x74f25000 ready to run

W/audio_hw_hfp( 2137): in_set_parameters 80:57:19:8A:B4:0D, ret -2

W/audio_hw_primary( 2137): Leaving IN_CALL state, in_call=0, mode=3

W/audio_hw_primary( 2137): out_set_parameters routing=2, ret 0, out 1980319936

W/audio_hw_primary( 2137): set parameters restarting=false

W/audio_hw_hfp( 2137): set parameters restarting=false

 

 

Please let me know what is the reason for this error? Is there any code which i could refer to support hfp?

Outcomes