chore: add noice/echo cancelling flags to getUserMedia

This commit is contained in:
td 2024-03-11 10:45:43 +05:30
parent 0fedbc3307
commit 1e90fcee93
No known key found for this signature in database
GPG Key ID: 62A30523D4D6CE28
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,
};