The audio driver always always needs to initiate the voice channel (1), before we request audio focus (2). If we do it the other way around, then it will fail with an opensles bad preset error. There isn't a call state to correspond with this as an accepted call may still have some delay due to when the channelmanager actually inits the native driver.
(1) In cc opensles driver in webrtc.
res = (*_slPlayer)->Realize(_slPlayer, SL_BOOLEAN_FALSE);
(2) Java in VoiceClientService
mAudioManager.requestAudioFocus(null, AudioManager.STREAM_VOICE_CALL,
AudioManager.AUDIOFOCUS_GAIN_TRANSIENT);
Few options,
1) Could call a helper class in java directly from the driver if it's an android build.
2) Could figure out in channel manager when it inits the audio stream and pass back an event of some type to java to handle.
The audio driver always always needs to initiate the voice channel (1), before we request audio focus (2). If we do it the other way around, then it will fail with an opensles bad preset error. There isn't a call state to correspond with this as an accepted call may still have some delay due to when the channelmanager actually inits the native driver.
(1) In cc opensles driver in webrtc. res = (*_slPlayer)->Realize(_slPlayer, SL_BOOLEAN_FALSE);
(2) Java in VoiceClientService mAudioManager.requestAudioFocus(null, AudioManager.STREAM_VOICE_CALL, AudioManager.AUDIOFOCUS_GAIN_TRANSIENT);
Few options, 1) Could call a helper class in java directly from the driver if it's an android build. 2) Could figure out in channel manager when it inits the audio stream and pass back an event of some type to java to handle.