Merge pull request #1728 from famedly/td/audioProcessing

chore: add noice/echo cancelling flags to getUserMedia
This commit is contained in:
td 2024-03-11 10:53:56 +05:30 committed by GitHub
commit dabe2fc97f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 18 additions and 3 deletions

View File

@ -44,6 +44,21 @@ class CallTimeouts {
static const delayBeforeOffer = Duration(milliseconds: 100); static const delayBeforeOffer = Duration(milliseconds: 100);
} }
class UserMediaOptions {
static const optionalAudioConfig = {
'echoCancellation': true,
'googDAEchoCancellation': true,
'googEchoCancellation': true,
'googEchoCancellation2': true,
'noiseSuppression': true,
'googNoiseSuppression': true,
'googNoiseSuppression2': true,
'googAutoGainControl': true,
'googHighpassFilter': true,
'googTypingNoiseDetection': true,
};
}
extension RTCIceCandidateExt on RTCIceCandidate { extension RTCIceCandidateExt on RTCIceCandidate {
bool get isValid => bool get isValid =>
sdpMLineIndex != null && sdpMLineIndex != null &&
@ -1481,7 +1496,7 @@ class CallSession {
'minFrameRate': '30', 'minFrameRate': '30',
}, },
'facingMode': 'user', 'facingMode': 'user',
'optional': [], 'optional': [UserMediaOptions.optionalAudioConfig],
} }
: false, : false,
}; };
@ -1566,7 +1581,7 @@ class CallSession {
Map<String, dynamic> _getOfferAnswerConstraints({bool iceRestart = false}) { Map<String, dynamic> _getOfferAnswerConstraints({bool iceRestart = false}) {
return { return {
'mandatory': {if (iceRestart) 'IceRestart': true}, 'mandatory': {if (iceRestart) 'IceRestart': true},
'optional': [], 'optional': [UserMediaOptions.optionalAudioConfig],
}; };
} }

View File

@ -324,7 +324,7 @@ class GroupCall {
'minFrameRate': '30', 'minFrameRate': '30',
}, },
'facingMode': 'user', 'facingMode': 'user',
'optional': [], 'optional': [UserMediaOptions.optionalAudioConfig],
} }
: false, : false,
}; };