I have been using libjingle to make peer connection between four users to share data and also start audio channel. It works ok most of the times but have issues of echo from one user which makes the call very unstable and hard to listen to users.
I have tried adding
this.mediaConstraints.optional.add(new MediaConstraints.KeyValuePair("googNoiseSuppression", "true"));
this.mediaConstraints.optional.add(new MediaConstraints.KeyValuePair("googEchoCancellation", "true"));
I am adding these constraints in the optional parameters in case I add these in mandatory it disconnects the call and throws onRenegotiationNeeded method.
I have listed some cases such as :
1) This might be the cause of 1 user is in loudspeaker(or earphone is loud enough) that voice registers in mic and creates the echo. (But sometimes it happens without this reason as well)
2) There may be 1 audio channel registered twice and creating a reverb effect with same user sending data channel twice. (Cant find how to debug this, I count the audio channel and they are normal)
3) Two users are in the same room and echo happens (This is a normal case which happens but it's not a concern as its unavoidable)
I am looking for suggestions or solutions in case someone else got into such issue with Android webRTC library.
implementation 'io.pristine:libjingle:9694@aar'
The library I am suing is this, but I also found out that latest webRTC official library is updated recently, would migrating to that solve any such issue ?
The latest library which I found is:
implementation 'org.webrtc:google-webrtc:1.0.22672'
Any help would be highly appreciated.
Thanks
Newer versions of WebRTC has WebRtcAudioUtils
class which you can use for WebRTC based Acoustic echo cancellation (AEC).
Here you have two choices either you can use built-in AEC or WebRTC based AEC.
//Disable built-in AEC even if device doesn't supports it
WebRtcAudioUtils.setWebRtcBasedAcousticEchoCanceler(true);
or
//Enable built-in AEC if device supports it"
WebRtcAudioUtils.setWebRtcBasedAcousticEchoCanceler(false);
I think pristine doesn't maintain android WebRTC library anymore. So I would suggest you use new WebRTC libraries hosted by Google because many bug fixes are only available in new version of Google-hosted WebRTC libraries which is at the time of writing is
implementation 'org.webrtc:google-webrtc:1.0.22920'
I had a hard time migrating my pristine based WebRTC project to Google based WebRTC libraries because many classes are deprecated and some of them are not even in the newer version of WebRTC. You can check my GitHub project which is a client of AppRTC where I'm using WebRTC prebuilt libraries from Google OR Checkout official android example on googlesource.com. In PeerConnectionClient
class they are also using WebRtcAudioUtils
to toggle Echo as well as Noice, High pass filter etc.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With