Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disabling Auto Gain Conctrol with WebRTC App

is there a way to disable the WebRTC "auto gain control feature" by default, by applying some javascript code to the app files?

i am using simplewebrtc.

like image 998
jhon dano Avatar asked May 19 '16 14:05

jhon dano


2 Answers

You can turn off audio processing using constraints (use https fiddle for Chrome):

var constraints = {
  audio: {
    echoCancellation: false,
    noiseSuppression: false,
    autoGainControl: false,
  }
};

navigator.mediaDevices.getUserMedia(constraints)
  .then(stream => audio.srcObject = stream)
  .catch(e => log(e));

var log = msg => div.innerHTML += msg + "<br>";
<audio id="audio" controls autoplay></audio><br>
<div id="div"></div>
<script src="https://webrtc.github.io/adapter/adapter-latest.js"></script>

Chrome apparently turns off all audio processing when echoCancellation: false is specified.

Firefox doesn't do that yet, so include autoGainControl: false and noiseSuppression: false as well for now.

Both Chrome and Firefox (64+) appear to default autoGainControl to true.

Older versions of Firefox would default autoGainControl to false and noiseSuppression to true, but like all device settings, defaults may vary from browser to browser, device to device or even the situation, so if you care about a setting, constrain it.

All three settings can also be controlled individually in Chrome and Firefox.

like image 65
jib Avatar answered Sep 18 '22 18:09

jib


There is now a google extension that can fix this.

https://chrome.google.com/webstore/detail/disable-automatic-gain-co/clpapnmmlmecieknddelobgikompchkk/related

like image 30
Darwin Avatar answered Sep 19 '22 18:09

Darwin