From 31a0d08c7681f67c48b46733ced48d2ba071ae9a Mon Sep 17 00:00:00 2001 From: TabascoEye Date: Sat, 30 Jan 2021 02:13:03 +0100 Subject: [PATCH 1/2] disable automatic gain control on microphone MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit AGC really makes the soundqulity way worse than it could be. Especially since it is so noticeable when entering a Jitsi where AGC is disabled (and suddenly some people sound much better). In the long run, this should probably be configurable. On the other hand the setting changes the audio _going out_ from a user, so it might be hard for him to judge which settings are a good or a bad idea… --- front/src/WebRtc/MediaManager.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/front/src/WebRtc/MediaManager.ts b/front/src/WebRtc/MediaManager.ts index 1a84d4a9..10a505cd 100644 --- a/front/src/WebRtc/MediaManager.ts +++ b/front/src/WebRtc/MediaManager.ts @@ -18,6 +18,12 @@ let videoConstraint: boolean|MediaTrackConstraints = { resizeMode: 'crop-and-scale', aspectRatio: 1.777777778 }; +let audioConstraint: boolean|MediaTrackConstraints = { + //TODO: make these values configurable in the game settings menu and store them in localstorage + autoGainControl: false, + echoCancellation: true, + noiseSuppression: false +}; export type UpdatedLocalStreamCallback = (media: MediaStream|null) => void; export type StartScreenSharingCallback = (media: MediaStream) => void; @@ -40,7 +46,7 @@ export class MediaManager { webrtcInAudio: HTMLAudioElement; private webrtcOutAudio: HTMLAudioElement; constraintsMedia : MediaStreamConstraints = { - audio: true, + audio: audioConstraint, video: videoConstraint }; updatedLocalStreamCallBacks : Set = new Set(); From 58b7d85bf3037f1b8de2b88e578da6dc37cfd3dc Mon Sep 17 00:00:00 2001 From: TabascoEye Date: Sat, 30 Jan 2021 02:24:36 +0100 Subject: [PATCH 2/2] bugfix and linting * use 'const' on constraints which never change * also re-enable constraints ater mic was re-enabled (after mute/unmute) --- front/src/WebRtc/MediaManager.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/front/src/WebRtc/MediaManager.ts b/front/src/WebRtc/MediaManager.ts index 10a505cd..57879ca6 100644 --- a/front/src/WebRtc/MediaManager.ts +++ b/front/src/WebRtc/MediaManager.ts @@ -18,7 +18,7 @@ let videoConstraint: boolean|MediaTrackConstraints = { resizeMode: 'crop-and-scale', aspectRatio: 1.777777778 }; -let audioConstraint: boolean|MediaTrackConstraints = { +const audioConstraint: boolean|MediaTrackConstraints = { //TODO: make these values configurable in the game settings menu and store them in localstorage autoGainControl: false, echoCancellation: true, @@ -243,7 +243,7 @@ export class MediaManager { } public enableMicrophone() { - this.constraintsMedia.audio = true; + this.constraintsMedia.audio = audioConstraint; this.getCamera().then((stream) => { //TODO show error message tooltip upper of camera button