Fix the timing error when the candidate arrives before the answer sdp.

This commit is contained in:
Duan Weiwei 2023-01-11 02:50:38 +00:00 committed by Nicolas Werner
parent 4ff07b58f4
commit 579b01a405
1 changed files with 7 additions and 0 deletions

View File

@ -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);