fix: setRemoteDescription before adding local stream to prevent early feedsChanged and negotiation

This commit is contained in:
td 2022-08-17 20:11:16 +05:30
parent 61466c82c9
commit d528ded9f8
No known key found for this signature in database
GPG Key ID: F6D9E9BF14C7D103
1 changed files with 4 additions and 7 deletions

View File

@ -402,6 +402,10 @@ class CallSession {
Future<void> initWithInvite(CallType type, RTCSessionDescription offer,
SDPStreamMetadata? metadata, int lifetime, bool isGroupCall) async {
await _preparePeerConnection();
if (metadata != null) {
_updateRemoteSDPStreamMetadata(metadata);
}
await pc!.setRemoteDescription(offer);
/// only add local stream if it is not a group call.
if (!isGroupCall) {
@ -411,12 +415,6 @@ class CallSession {
}
}
if (metadata != null) {
_updateRemoteSDPStreamMetadata(metadata);
}
await pc!.setRemoteDescription(offer);
setCallState(CallState.kRinging);
ringingTimer = Timer(Duration(seconds: 30), () {
@ -1075,7 +1073,6 @@ class CallSession {
Future<void> _preparePeerConnection() async {
try {
pc = await _createPeerConnection();
pc!.onRenegotiationNeeded = onNegotiationNeeded;
pc!.onIceCandidate = (RTCIceCandidate candidate) async {