1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-11-26 06:49:22 +00:00

Fix a racing issue

This commit is contained in:
Pierre HUBERT 2020-04-23 18:15:24 +02:00
parent 675d1b8588
commit de84fb6113

View File

@ -1,3 +1,5 @@
import 'dart:async';
import 'package:comunic/helpers/calls_helper.dart';
import 'package:comunic/helpers/conversations_helper.dart';
import 'package:comunic/helpers/events_helper.dart';
@ -229,8 +231,10 @@ class _CallScreenState extends SafeState<CallScreen> {
peerConnection.onIceConnectionState = (c) {
print("New connection state: $c");
if (c == RTCIceConnectionState.RTCIceConnectionStateConnected)
CallsHelper.markPeerReady(convID);
if (c == RTCIceConnectionState.RTCIceConnectionStateConnected) {
// Add a delay of two seconds to avoid racing
Timer(Duration(seconds: 2), () => CallsHelper.markPeerReady(convID));
}
};
peerConnection.onSignalingState = (c) => print("New signaling state: $c");