How to set google experimental audio media constraints on getUserMedia

91 views Asked by At

When using Google Meet, there are several unpublished audio constraints that get set. Looking at webrtc-internals shows the audio constraints as:

{deviceId: {exact: ["default"]}, advanced: [{googEchoCancellation: {exact: true}}, {googExperimentalEchoCancellation: {exact: true}}, {autoGainControl: {exact: true}}, {noiseSuppression: {exact: true}}, {googHighpassFilter: {exact: true}}, {googAudioMirroring: {exact: true}}]}

I'm currently having issues with the standard echo cancellation in Chrome that I do not experience when using Google Meet. So I want to run some tests enabling the googEchoCancellation and googExperimentalEchoCancellation, however when I set those constraints in getUserMedia they do not get applied. Instead looking at webrtc-internals shows my constraints as:

{deviceId: {exact: ["default"]}, advanced: [{}, {}, {autoGainControl: {exact: true}}, {noiseSuppression: {exact: true}}, {}, {}]}

Chrome is ignoring the goog* specific constraints when I try to set them, but Meet is able to set them.

I can see these constraints exist in Chrome's source code at: https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/modules/mediastream/media_constraints.cc

But I can't figure out how to set them.

So my question is how does Google Meet set those additional audio constraints?

I have tried setting the constraints in getUserMedia as:

let gum = await navigator.mediaDevices.getUserMedia({deviceId: {exact: ["default"]}, advanced: [{googEchoCancellation: {exact: true}}, {googExperimentalEchoCancellation: {exact: true}}, {autoGainControl: {exact: true}}, {noiseSuppression: {exact: true}}, {googHighpassFilter: {exact: true}}, {googAudioMirroring: {exact: true}}]})

I have also tried applying them to the audio track directly with:

let tracks = await gum.getAudioTracks() await tracks[0].applyConstraints({advanced: [{googEchoCancellation: {exact: true}}, {googExperimentalEchoCancellation: {exact: true}}, {autoGainControl: {exact: true}}, {noiseSuppression: {exact: true}}, {googHighpassFilter: {exact: true}}, {googAudioMirroring: {exact: true}}]})

Neither of these approaches set the googEchoCancellation or googExperimentalEchoCancellation.

0

There are 0 answers