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);
}
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 {
bool get isValid =>
sdpMLineIndex != null &&
@ -1481,7 +1496,7 @@ class CallSession {
'minFrameRate': '30',
},
'facingMode': 'user',
'optional': [],
'optional': [UserMediaOptions.optionalAudioConfig],
}
: false,
};
@ -1566,7 +1581,7 @@ class CallSession {
Map<String, dynamic> _getOfferAnswerConstraints({bool iceRestart = false}) {
return {
'mandatory': {if (iceRestart) 'IceRestart': true},
'optional': [],
'optional': [UserMediaOptions.optionalAudioConfig],
};
}

View File

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