Browse Source

fix(mobile/call-integration): cleanup if leave takes too long

The conference disconnection process is asynchronous which means there's
no guarantee that there will be CONFERENCE_LEFT event for the old
conference, before the next conference is joined. Because of that we can
end up with two simultaneous calls on the native side which is not
always supported. End the call on CONFERENCE_WILL_LEAVE to fix this
corner case.
master
paweldomas 6 years ago
parent
commit
54c36198d0
1 changed files with 11 additions and 1 deletions
  1. 11
    1
      react/features/mobile/call-integration/middleware.js

+ 11
- 1
react/features/mobile/call-integration/middleware.js View File

8
 import { APP_WILL_MOUNT, APP_WILL_UNMOUNT } from '../../base/app';
8
 import { APP_WILL_MOUNT, APP_WILL_UNMOUNT } from '../../base/app';
9
 import {
9
 import {
10
     CONFERENCE_FAILED,
10
     CONFERENCE_FAILED,
11
+    CONFERENCE_JOINED,
11
     CONFERENCE_LEFT,
12
     CONFERENCE_LEFT,
12
     CONFERENCE_WILL_JOIN,
13
     CONFERENCE_WILL_JOIN,
13
-    CONFERENCE_JOINED,
14
+    CONFERENCE_WILL_LEAVE,
14
     SET_AUDIO_ONLY,
15
     SET_AUDIO_ONLY,
15
     getConferenceName,
16
     getConferenceName,
16
     getCurrentConference
17
     getCurrentConference
63
     case CONFERENCE_JOINED:
64
     case CONFERENCE_JOINED:
64
         return _conferenceJoined(store, next, action);
65
         return _conferenceJoined(store, next, action);
65
 
66
 
67
+    // If a conference is being left in a graceful manner then
68
+    // the CONFERENCE_WILL_LEAVE fires as soon as the conference starts
69
+    // disconnecting. We need to destroy the call on the native side as soon
70
+    // as possible, because the disconnection process is asynchronous and
71
+    // Android not always supports two simultaneous calls at the same time
72
+    // (even though it should according to the spec).
66
     case CONFERENCE_LEFT:
73
     case CONFERENCE_LEFT:
74
+    case CONFERENCE_WILL_LEAVE:
67
         return _conferenceLeft(store, next, action);
75
         return _conferenceLeft(store, next, action);
68
 
76
 
69
     case CONFERENCE_WILL_JOIN:
77
     case CONFERENCE_WILL_JOIN:
141
         const { callUUID } = action.conference;
149
         const { callUUID } = action.conference;
142
 
150
 
143
         if (callUUID) {
151
         if (callUUID) {
152
+            delete action.conference.callUUID;
144
             CallIntegration.reportCallFailed(callUUID);
153
             CallIntegration.reportCallFailed(callUUID);
145
         }
154
         }
146
     }
155
     }
192
     const { callUUID } = action.conference;
201
     const { callUUID } = action.conference;
193
 
202
 
194
     if (callUUID) {
203
     if (callUUID) {
204
+        delete action.conference.callUUID;
195
         CallIntegration.endCall(callUUID);
205
         CallIntegration.endCall(callUUID);
196
     }
206
     }
197
 
207
 

Loading…
Cancel
Save