Просмотр исходного кода

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.
efficient_tiling
paweldomas 6 лет назад
Родитель
Сommit
54c36198d0
1 измененных файлов: 11 добавлений и 1 удалений
  1. 11
    1
      react/features/mobile/call-integration/middleware.js

+ 11
- 1
react/features/mobile/call-integration/middleware.js Просмотреть файл

@@ -8,9 +8,10 @@ import { appNavigate } from '../../app';
8 8
 import { APP_WILL_MOUNT, APP_WILL_UNMOUNT } from '../../base/app';
9 9
 import {
10 10
     CONFERENCE_FAILED,
11
+    CONFERENCE_JOINED,
11 12
     CONFERENCE_LEFT,
12 13
     CONFERENCE_WILL_JOIN,
13
-    CONFERENCE_JOINED,
14
+    CONFERENCE_WILL_LEAVE,
14 15
     SET_AUDIO_ONLY,
15 16
     getConferenceName,
16 17
     getCurrentConference
@@ -63,7 +64,14 @@ CallIntegration && MiddlewareRegistry.register(store => next => action => {
63 64
     case CONFERENCE_JOINED:
64 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 73
     case CONFERENCE_LEFT:
74
+    case CONFERENCE_WILL_LEAVE:
67 75
         return _conferenceLeft(store, next, action);
68 76
 
69 77
     case CONFERENCE_WILL_JOIN:
@@ -141,6 +149,7 @@ function _conferenceFailed(store, next, action) {
141 149
         const { callUUID } = action.conference;
142 150
 
143 151
         if (callUUID) {
152
+            delete action.conference.callUUID;
144 153
             CallIntegration.reportCallFailed(callUUID);
145 154
         }
146 155
     }
@@ -192,6 +201,7 @@ function _conferenceLeft(store, next, action) {
192 201
     const { callUUID } = action.conference;
193 202
 
194 203
     if (callUUID) {
204
+        delete action.conference.callUUID;
195 205
         CallIntegration.endCall(callUUID);
196 206
     }
197 207
 

Загрузка…
Отмена
Сохранить