VitalyD
VitalyD

Reputation: 289

Android low latency OpenSLES: Recorder stop working on audio route change to speaker

I'm developing VoIP application using low latency fast path,the problem is that when I change the audio route to speaker I noticed that the recorder callback fires every 100ms instead of 5ms as it should work and the following error is generated:

E/ACDB-LOADER(  183): Error: ACDB AudProc vol returned = -19
D/audio_hw_primary(  183): enable_snd_device: snd_device(32: speaker-mic)
D/audio_hw_primary(  183): enable_audio_route: apply and update mixer path: low-latency-record
D/audio_hw_primary(  183): disable_audio_route: reset and update mixer path: low-latency-record
D/audio_hw_primary(  183): disable_snd_device: snd_device(32: speaker-mic)
E/AudioFlinger(  183): read failed: framesRead=-2147483631
D/audio_hw_primary(  183): select_devices: out_snd_device(0: none) in_snd_device(32: speaker-mic)
D/msm8974_platform(  183): platform_send_audio_calibration: sending audio calibration for snd_device(32) acdb_id(11)
D/        (  183): Failed to fetch the lookup information of the device 0000000B 
E/ACDB-LOADER(  183): Error: ACDB AudProc vol returned = -19
D/audio_hw_primary(  183): enable_snd_device: snd_device(32: speaker-mic)
D/audio_hw_primary(  183): enable_audio_route: apply and update mixer path: low-latency-record
D/audio_hw_primary(  183): disable_audio_route: reset and update mixer path: low-latency-record
D/audio_hw_primary(  183): disable_snd_device: snd_device(32: speaker-mic)
E/AudioFlinger(  183): read failed: framesRead=-2147483631
D/audio_hw_primary(  183): select_devices: out_snd_device(0: none) in_snd_device(32: speaker-mic)
D/msm8974_platform(  183): platform_send_audio_calibration: sending audio calibration for snd_device(32) acdb_id(11)
D/        (  183): Failed to fetch the lookup information of the device 0000000B 
E/ACDB-LOADER(  183): Error: ACDB AudProc vol returned = -19
D/audio_hw_primary(  183): enable_snd_device: snd_device(32: speaker-mic)
D/audio_hw_primary(  183): enable_audio_route: apply and update mixer path: low-latency-record
D/audio_hw_primary(  183): disable_audio_route: reset and update mixer path: low-latency-record
D/audio_hw_primary(  183): disable_snd_device: snd_device(32: speaker-mic)
E/AudioFlinger(  183): read failed: framesRead=-2147483631
D/audio_hw_primary(  183): select_devices: out_snd_device(0: none) in_snd_device(32: speaker-mic)
D/msm8974_platform(  183): platform_send_audio_calibration: sending audio calibration for snd_device(32) acdb_id(11)
D/        (  183): Failed to fetch the lookup information of the device 0000000B 
E/ACDB-LOADER(  183): Error: ACDB AudProc vol returned = -19
D/audio_hw_primary(  183): enable_snd_device: snd_device(32: speaker-mic)
D/audio_hw_primary(  183): enable_audio_route: apply and update mixer path: low-latency-record
D/audio_hw_primary(  183): disable_audio_route: reset and update mixer path: low-latency-record
D/audio_hw_primary(  183): disable_snd_device: snd_device(32: speaker-mic)
E/AudioFlinger(  183): read failed: framesRead=-2147483631
D/audio_hw_primary(  183): select_devices: out_snd_device(0: none) in_snd_device(32: speaker-mic)
D/msm8974_platform(  183): platform_send_audio_calibration: sending audio calibration for snd_device(32) acdb_id(11)
D/        (  183): Failed to fetch the lookup information of the device 0000000B 
E/ACDB-LOADER(  183): Error: ACDB AudProc vol returned = -19
D/audio_hw_primary(  183): enable_snd_device: snd_device(32: speaker-mic)
D/audio_hw_primary(  183): enable_audio_route: apply and update mixer path: low-latency-record
D/audio_hw_primary(  183): disable_audio_route: reset and update mixer path: low-latency-record
D/audio_hw_primary(  183): disable_snd_device: snd_device(32: speaker-mic)
E/AudioFlinger(  183): read failed: framesRead=-2147483631

It's important to note that if the audio route stays on headset it works fine. Is any one knows what the problem?

Upvotes: 1

Views: 1627

Answers (1)

Reaz Murshed
Reaz Murshed

Reputation: 24211

Your code works fine with headset tells me that, changing the route to your speaker is generating the delay.

OpenSL routes the audio playback to the speaker by default. Now when you set the streamType to SL_ANDROID_STREAM_VOICE it routes the audio to your headset. When you route the audio back to speaker, you might need to set the streamType to default and initialize the player again.

I don't know the exact reason, why your recorder callback is fired after 100ms instead of 5ms. But anyway, I think you've set the audio sampling rate of your device correctly.

And there's another thing to check is the buffer size. Yes 240 is okay. But you might try setting lower size as you need to fire the recorder callback often.

Hope that helps.

Upvotes: 1

Related Questions