1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-07-30 04:23:07 +03:00

Fix race in creating calls (#2662)

* Fix race in creating calls

We ran an async function between checking for an existing call and
adding the new one to the map, so it would have been possible to
start creating another call while we were placing the first call.
This changes the code to add the call to the map as soon as we've
created it.

Also adds more logging.

* Switch to logger.debug

* Fix unit tests
This commit is contained in:
David Baker
2022-09-13 16:30:34 +01:00
committed by GitHub
parent 3e1e99f8e5
commit 41cee6f1cc
2 changed files with 14 additions and 7 deletions

View File

@ -533,6 +533,7 @@ describe('Group Call', function() {
let newCall: MatrixCall;
while (
(newCall = groupCall1.getCallByUserId(client2.userId)) === undefined ||
newCall.peerConn === undefined ||
newCall.callId == oldCall.callId
) {
await flushPromises();
@ -643,6 +644,7 @@ describe('Group Call', function() {
groupCall.localCallFeed.setAudioVideoMuted = jest.fn();
const setAVMutedArray = groupCall.calls.map(call => {
call.localUsermediaFeed.setAudioVideoMuted = jest.fn();
call.localUsermediaFeed.isVideoMuted = jest.fn().mockReturnValue(true);
return call.localUsermediaFeed.setAudioVideoMuted;
});
const tracksArray = groupCall.calls.reduce((acc, call) => {