Echo and noise in a sound webRTC android

I am working on webRTC, I am doing a live broadcast between two Android devices on the local network, it works fine for me, except for the problem with sound quality, there is noise and echo in the sound. If I use hands-free at one end, it gets better, but I do not want to use hands-free.

So, how can I improve the sound quality, what are the methods for improving the sound quality. He also said that webRTC has an echo cancellation function built into it than why echo is still there.

+5
source share
3 answers

You can try to add special sound restrictions when creating a sound source. It should look like this:

MediaConstraints audioConstarints = new MediaConstraints(); audioConstarints.mandatory.add(new MediaConstraints.KeyValuePair("googNoiseSuppression", "true")); audioConstarints.mandatory.add(new MediaConstraints.KeyValuePair("googEchoCancellation", "true")); 

There are many restrictions on media related to audio functions, and I suggest trying various combinations of them, the full list can be found here https://chromium.googlesource.com/external/webrtc/+/master/talk/app/webrtc/mediaconstraintsinterface .cc

+2
source

I think you experience the Larsen effect, 2 audio outputs are reproduced by both microphones, creating endless sound loops. There is not much that you can do against this if both devices are in the same room, but browsers have echo cancellation options that you can activate this way (not sure if they are the default):

  if (window.chrome) { audioConstraints = { mandatory: { echoCancellation: true } } } else { audioConstraints = { echoCancellation: true } } var constraints = {video: videoConstraints, audio: audioConstraints}; navigator.getUserMedia(constraints, userMediaSuccess, userMediaError); 

Also, turn off the local video, users obviously do not need it.

+1
source

What happens is that you yourself play your own local sound. This creates a feedback loop between your microphone and speakers. That's why it sounds better when you have a speakerphone. You can remove the local sound by changing the getUserMedia () stream:

 var constraints = {video: true, audio: true}; getUserMedia(constraints, function(stream){ var videoOnly = new MediaStream(stream.getVideoTracks()); }, errorHandler); 
+1
source

Source: https://habr.com/ru/post/1216056/


All Articles