瀏覽代碼

fix(prejoin): disposed track was added to the conference

It is not 100% clear to me when it happens, but I think it could happen
in some race condition where a track is unmuted when it's being disposed
or something around those lines.

The fact is that any muted tracks are disposed by replaceLocalTrack(track.jitsiTrack, null) and they should not be used anymore.

Supposedly fixes a crash:

Failed to add local track to conference Track has been already disposed
master
Pawel Domas 4 年之前
父節點
當前提交
907b51925d
共有 1 個檔案被更改,包括 7 行新增1 行删除
  1. 7
    1
      react/features/prejoin/middleware.js

+ 7
- 1
react/features/prejoin/middleware.js 查看文件

@@ -33,7 +33,7 @@ MiddlewareRegistry.register(store => next => async action => {
33 33
         const { getState, dispatch } = store;
34 34
         const state = getState();
35 35
         const { userSelectedSkipPrejoin } = state['features/prejoin'];
36
-        const localTracks = getLocalTracks(state['features/base/tracks']);
36
+        let localTracks = getLocalTracks(state['features/base/tracks']);
37 37
         const { options } = action;
38 38
 
39 39
         options && store.dispatch(updateConfig(options));
@@ -48,6 +48,12 @@ MiddlewareRegistry.register(store => next => async action => {
48 48
                 await dispatch(replaceLocalTrack(track.jitsiTrack, null));
49 49
             }
50 50
         }
51
+
52
+        // Re-fetch the local tracks after muted tracks have been removed above.
53
+        // This is needed, because the tracks are effectively disposed by the replaceLocalTrack and should not be used
54
+        // anymore.
55
+        localTracks = getLocalTracks(getState()['features/base/tracks']);
56
+
51 57
         const jitsiTracks = localTracks.map(t => t.jitsiTrack);
52 58
 
53 59
         dispatch(setPrejoinPageVisibility(false));

Loading…
取消
儲存