Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions spec/unit/webrtc/groupCall.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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) => {
Expand Down
19 changes: 12 additions & 7 deletions src/webrtc/groupCall.ts
Original file line number Diff line number Diff line change
Expand Up @@ -856,12 +856,22 @@ export class GroupCall extends TypedEventEmitter<
},
);

if (existingCall) {
logger.debug(`Replacing call ${existingCall.callId} to ${member.userId} with ${newCall.callId}`);
this.replaceCall(existingCall, newCall, CallErrorCode.NewSession);
} else {
logger.debug(`Adding call ${newCall.callId} to ${member.userId}`);
this.addCall(newCall);
}

newCall.isPtt = this.isPtt;

const requestScreenshareFeed = opponentDevice.feeds.some(
(feed) => feed.purpose === SDPStreamMetadataPurpose.Screenshare);

logger.log(`Placing call to ${member.userId}.`);
logger.debug(
`Placing call to ${member.userId}/${opponentDevice.device_id} session ID ${opponentDevice.session_id}.`,
);

try {
await newCall.placeCallWithCallFeeds(
Expand All @@ -881,18 +891,13 @@ export class GroupCall extends TypedEventEmitter<
),
);
}
this.removeCall(newCall, CallErrorCode.SignallingFailed);
return;
}

if (this.dataChannelsEnabled) {
newCall.createDataChannel("datachannel", this.dataChannelOptions);
}

if (existingCall) {
this.replaceCall(existingCall, newCall, CallErrorCode.NewSession);
} else {
this.addCall(newCall);
}
};

public getDeviceForMember(userId: string): IGroupCallRoomMemberDevice {
Expand Down