I am trying to create a real time communication application (SIP like, Skype like, etc.) that is using Android's OpenSL ES implementation.
The thing is, I need to play some WAV audio file over the communication (I am doing this with MediaPlayer in Java).
Of course, mediaplayer works fine when OpenSL ES is not running. But when it is, all hell breaks loose : the result is strongly inconsistent across devices.
I have created an example project to demonstrate that issue, if you play the sound (pweeet button) before starting the engine, it works. If you play it after, it depends on the device.
Here are my observations :
Of course, nothing above is a solution as I need to...
...all at the same time.
Finaly, I should point out that, in the Galaxy S4, when I enqueue frame that I received from the network, OpenSL ES plays it so loud and saturated that the application is unusable. So I don't think the issue is on the MediaPlayer Java side.
Thanks to Michael comment, I have solve my problem by setting Audio mode IN_COMMUNICATION.