Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I disable automatic gain control (AGC) in WebRTC web-apps such as Google Hangouts or OpenTokRTC

In pre-WebRTC googletalkplugin days, one could disable AGC (automatic gain control for the microphone) by adding audio-flags: 1 to the config file. However, since Google Hangouts now use WebRTC, it often happens that while I'm chatting with someone, my microphone level shoots all the way down so that I'm more or less silent on the other side. I've also had correspondents whose mic volume was boosted all the way up, repeatedly.

I've reproduced this behaviour on http://opentokrtc.com/ which also uses WebRTC. By making loud popping sounds into my microphone, I can get the level to go all the way down in a few steps. I can do this both on Chrome 38 and FireFox 34 beta.

However, when I use a local application, such as Audacity, on my Ubuntu 14.04.1 machine, I am not able to affect the microphone level by making loud popping noises. In other words, it really looks like WebRTC is the culprit here.

It seems that on Chrome's implementation, one can configure WebRTC AGC by passing the googAutoGainControl to the getUserMedia() call. On FireFox I have not been able to find the equivalent.

My question is: As a WebRTC end-user, how can I configure my browser (Chrome or FireFox) to disable AGC, as AGC does not work correctly on my setup?

like image 294
Charl Botha Avatar asked Oct 21 '14 10:10

Charl Botha


People also ask

How do I turn off auto control in Chrome?

Disable Automatic Gain Control (Chrome Extension) The enablement of the extension is controlled on a per-domain basis. For instructions on how to use the extension, please visit the "Usage" page (click on the Extensions icon in the Chrome toolbar → find "Disable Automatic Gain Control" → "⋮" More Actions → "Usage").


2 Answers

The googAutoGainControl as MediaTrackConstraints is specific to Chrome (WebKit).

The WebRTC Working Group Charter still writing the standard and they will finish the next 30 June 2015.

Firefox not support right now.

Note: Use AGC is not recommended that you specify any browser-specific constraint as mandatory, as your call will fail in a browser that does not support the constraint. Instead, specify your constraints as optional. Your browser will do its best to satisfy as many optional constraints as possible.

BTW you can play with the GainNode interface in Firefox: https://developer.mozilla.org/en-US/docs/Web/API/GainNode

Example to disable the googAutoGainControl:

  var webrtc = new SimpleWebRTC({
    localVideoEl: 'localVideo',
    remoteVideosEl: '',
    autoRequestMedia: true,
    //detectSpeakingEvents: true,
    adjustPeerVolume: false,
    peerVolumeWhenSpeaking: 1,  
    media: {
      audio: {
        optional: [
          //{sourceId: audio_source},
          {googAutoGainControl: false}, 
          {googAutoGainControl2: false}, 
          {googEchoCancellation: false},
          {googEchoCancellation2: false},
          {googNoiseSuppression: false},
          {googNoiseSuppression2: false},
          {googHighpassFilter: false},
          {googTypingNoiseDetection: false},
          {googAudioMirroring: false}
        ]
     },
     video: {
        optional: [
          //{sourceId: video_source}
        ]
      }
    }
    //autoAdjustMic: false        
  });

The end-user cannot disable in the browser this functionality right now. The advanced user can edit preferences in the about:config in Firefox but in Chrome does not exist.

like image 133
Alexander Salas Bastidas Avatar answered Oct 01 '22 00:10

Alexander Salas Bastidas


It looks like FireFox added some support for this in 46: https://wiki.mozilla.org/Media/WebRTC/ReleaseNotes/46

Implemented echoCancellation, mozAutoGainControl and mozNoiseSuppression gUM constraints. (See bug 987186.)

like image 31
paleozogt Avatar answered Oct 01 '22 00:10

paleozogt