lukeweber / webrtc-jingle-client

Webrtc audio + jingle protocol brought to IOS and Android.
https://groups.google.com/forum/?fromgroups#!forum/webrtc-jingle
BSD 3-Clause "New" or "Revised" License
335 stars 137 forks source link

Can not request audio focus until channel is created. #33

Closed lukeweber closed 11 years ago

lukeweber commented 11 years ago

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.

lukeweber commented 11 years ago

This is resolved since we added a callback from session.cc when stream is readable that becomes an event in the client for audio playout.