Merge branch 'voip/fix-add-ice-candidate-timing' into 'main'

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

See merge request famedly/company/frontend/famedlysdk!1208
This commit is contained in:
Nicolas Werner 2023-01-11 02:50:38 +00:00
commit 1e605c6728
1 changed files with 7 additions and 0 deletions

View File

@ -658,6 +658,13 @@ class CallSession {
json['sdpMLineIndex']?.round() ?? 0, json['sdpMLineIndex']?.round() ?? 0,
); );
if (direction == CallDirection.kOutgoing &&
pc != null &&
await pc!.getRemoteDescription() == null) {
remoteCandidates.add(candidate);
continue;
}
if (pc != null && inviteOrAnswerSent && remotePartyId != null) { if (pc != null && inviteOrAnswerSent && remotePartyId != null) {
try { try {
await pc!.addCandidate(candidate); await pc!.addCandidate(candidate);