Audio feedback using RIL Audio on smartphone
We are working on a SIP softphone and we get audible feedback when we call from one phone to another. However, when we call from a regular SIP phone (software or hardware) to our application, then everything works fine - it only when calling from one phone using the application to another. Here is the code we use to initialize RIL Audio:
public static void InitRILAudio()
{
IntPtr res;
RILRESULTCALLBACK result = new RILRESULTCALLBACK(f_result);
RILNOTIFYCALLBACK notify = new RILNOTIFYCALLBACK(f_notify);
res = RIL_Initialize(1, result, notify, (0x00010000 | 0x00020000 | 0x00080000), 0, out hRil);
if (res != IntPtr.Zero)
return;
RILAUDIODEVICEINFO audioDeviceInfo = new RILAUDIODEVICEINFO();
audioDeviceInfo.cbSize = 16;
audioDeviceInfo.dwParams = 0x00000003; //RIL_PARAM_ADI_ALL;
audioDeviceInfo.dwRxDevice = 0x00000001; //RIL_AUDIO_HANDSET;
audioDeviceInfo.dwTxDevice = 0x00000001; //RIL_AUDIO_HANDSET;
res = RIL_SetAudioDevices(hRil, audioDeviceInfo);
}
We are using SipEk ( http://voipengine.googlepages.com/sipeksdk ) for the SIP stack. Basically we just use the callback delegate from the SDK for audio files. Anyone else having problems with audio feedback loops? Or with RIL Audio or SipEk? Any suggestions?
Thanks in advance!
Feedback means you are not using echo cancellation (line and / or acoustic, depending on whether it works as a loudspeaker or not), or if you are, latency in your system (jitter buffers, network, encoding / decoding, etc.) etc.) more than the echo canceller can handle. Excessive boost / clipping in the wrong places can also defeat any echo canceller (they don't like non-linear effects).
It looks like you are just dropping audio onto other layers. SipEk is just a wrapper for pjsip, but I am assuming you are doing audio through Microsoft RIL / etc and not through pjmedia. You need to have a good understanding of your audio tracks, where material is fetched, if / how it sounds / echo-echo-cancels, what the echo tail is, how it is encoded and packaged, how it is received, jitter-buffering, loss concealed, decoded and played.
source to share