Skip to content

Commit

Permalink
Keep peerName on recreation of peerConnectionWrapper
Browse files Browse the repository at this point in the history
Signed-off-by: Marcel Müller <[email protected]>
  • Loading branch information
SystemKeeper committed Aug 8, 2024
1 parent cc3ecb7 commit 2c2727d
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion NextcloudTalk/NCCallController.m
Original file line number Diff line number Diff line change
Expand Up @@ -1311,16 +1311,26 @@ - (void)processSignalingMessage:(NCSignalingMessage *)signalingMessage
// If there is already a peer connection but a new offer is received with a different sid the existing
// peer connection is stale, so it needs to be removed and a new one created instead.
NCPeerConnection *peerConnectionWrapper = [self getPeerConnectionWrapperForSessionId:signalingMessage.from ofType:signalingMessage.roomType forOwnScreenshare:isAnswerToOwnScreenshare];
NSString *peerName;
if (signalingMessage.messageType == kNCSignalingMessageTypeOffer && peerConnectionWrapper &&
signalingMessage.sid.length > 0 && ![signalingMessage.sid isEqualToString:peerConnectionWrapper.sid]) {

// Remember the peerName for the new connectionWrapper
peerName = peerConnectionWrapper.peerName;
[self cleanPeerConnectionForSessionId:signalingMessage.from ofType:signalingMessage.roomType forOwnScreenshare:isAnswerToOwnScreenshare];
}

peerConnectionWrapper = [self getOrCreatePeerConnectionWrapperForSessionId:signalingMessage.from withSid:signalingMessage.sid ofType:signalingMessage.roomType forOwnScreenshare:isAnswerToOwnScreenshare];
NCSessionDescriptionMessage *sdpMessage = (NCSessionDescriptionMessage *)signalingMessage;
RTCSessionDescription *sessionDescription = sdpMessage.sessionDescription;
[peerConnectionWrapper setPeerName:sdpMessage.nick];
[peerConnectionWrapper setRemoteDescription:sessionDescription];

if (sdpMessage.nick && ![sdpMessage.nick isEqualToString:@""]) {
[peerConnectionWrapper setPeerName:sdpMessage.nick];
} else if (peerName) {
[peerConnectionWrapper setPeerName:peerName];
}

break;
}
case kNCSignalingMessageTypeCandidate:
Expand Down

0 comments on commit 2c2727d

Please sign in to comment.