From 579b01a40554f8afe8af30c582e13014bef456e9 Mon Sep 17 00:00:00 2001 From: Duan Weiwei Date: Wed, 11 Jan 2023 02:50:38 +0000 Subject: [PATCH] Fix the timing error when the candidate arrives before the answer sdp. --- lib/src/voip/call.dart | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/src/voip/call.dart b/lib/src/voip/call.dart index 713fc1a1..7d43e19c 100644 --- a/lib/src/voip/call.dart +++ b/lib/src/voip/call.dart @@ -658,6 +658,13 @@ class CallSession { json['sdpMLineIndex']?.round() ?? 0, ); + if (direction == CallDirection.kOutgoing && + pc != null && + await pc!.getRemoteDescription() == null) { + remoteCandidates.add(candidate); + continue; + } + if (pc != null && inviteOrAnswerSent && remotePartyId != null) { try { await pc!.addCandidate(candidate);