From d528ded9f88822f0434c149257a00f11f93d449e Mon Sep 17 00:00:00 2001 From: td Date: Wed, 17 Aug 2022 20:11:16 +0530 Subject: [PATCH] fix: setRemoteDescription before adding local stream to prevent early feedsChanged and negotiation --- lib/src/voip/call.dart | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/lib/src/voip/call.dart b/lib/src/voip/call.dart index 9de4a161..1a88e423 100644 --- a/lib/src/voip/call.dart +++ b/lib/src/voip/call.dart @@ -402,6 +402,10 @@ class CallSession { Future 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 _preparePeerConnection() async { try { pc = await _createPeerConnection(); - pc!.onRenegotiationNeeded = onNegotiationNeeded; pc!.onIceCandidate = (RTCIceCandidate candidate) async {