Skip to content

Commit af281d9

Browse files
author
evgeny-nadymov
committed
Fix double offer for voice chats
1 parent 68a8561 commit af281d9

1 file changed

Lines changed: 10 additions & 9 deletions

File tree

‎src/Stores/CallStore.js‎

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -464,15 +464,15 @@ class CallStore extends EventEmitter {
464464
description.updateFromServer(data);
465465
const sdp = description.generateSdp();
466466

467-
LOG_CALL(`[conn][updateGroupCallParticipants] setRemoteDescription participantsCount=${participants.length} signaling=${connection.signalingState} ice=${connection.iceConnectionState} gathering=${connection.iceGatheringState} connection=${connection.connectionState}`, sdp);
467+
LOG_CALL(`[conn][updateGroupCallParticipants][sdp] setRemoteDescription participantsCount=${participants.length} signaling=${connection.signalingState} ice=${connection.iceConnectionState} gathering=${connection.iceGatheringState} connection=${connection.connectionState}`, sdp);
468468
await connection.setRemoteDescription({
469469
type: 'offer',
470470
sdp,
471471
});
472472

473473
LOG_CALL(`[conn][updateGroupCallParticipants] createAnswer id=${groupCallId}`, ts);
474474
const answer = await connection.createAnswer();
475-
LOG_CALL(`[conn][updateGroupCallParticipants] setLocalDescription id=${groupCallId}`, ts);
475+
LOG_CALL(`[conn][updateGroupCallParticipants][sdp] createAnswer setLocalDescription id=${groupCallId}`, ts, answer.sdp);
476476
await connection.setLocalDescription(answer);
477477
} finally {
478478
LOG_CALL(`updateGroupCallParticipants id=${groupCallId} updateSdp finish`, ts);
@@ -759,18 +759,18 @@ class CallStore extends EventEmitter {
759759
offerToReceiveVideo: 0,
760760
};
761761
let offer = await connection.createOffer(offerOptions);
762-
LOG_CALL('[conn][joinGroupCallInternal] setLocalDescription', offer);
762+
LOG_CALL('[conn][joinGroupCallInternal][sdp] setLocalDescription', offer.sdp);
763763
await connection.setLocalDescription(offer);
764764
let clientInfo = parseSdp(offer.sdp);
765765
let { ufrag, pwd, hash, setup, fingerprint, source } = clientInfo;
766766
LOG_CALL('[conn][joinGroupCallInternal] clientInfo', clientInfo);
767767

768768

769-
offer = await connection.createOffer(offerOptions);
770-
LOG_CALL('[conn][joinGroupCallInternal] setLocalDescription', offer);
771-
await connection.setLocalDescription(offer);
772-
clientInfo = parseSdp(offer.sdp);
773-
LOG_CALL('[conn][joinGroupCallInternal] clientInfo', clientInfo);
769+
// offer = await connection.createOffer(offerOptions);
770+
// LOG_CALL('[conn][joinGroupCallInternal][sdp] setLocalDescription', offer.sdp);
771+
// await connection.setLocalDescription(offer);
772+
// clientInfo = parseSdp(offer.sdp);
773+
// LOG_CALL('[conn][joinGroupCallInternal] clientInfo', clientInfo);
774774

775775
currentGroupCall.meSignSource = toTelegramSource(source);
776776

@@ -887,7 +887,7 @@ class CallStore extends EventEmitter {
887887
description.updateFromServer(data1);
888888
const sdp1 = description.generateSdp(true);
889889

890-
LOG_CALL(`[conn][joinGroupCallInternal] setRemoteDescription signaling=${connection.signalingState} ice=${connection.iceConnectionState} gathering=${connection.iceGatheringState} connection=${connection.connectionState}`, sdp1);
890+
LOG_CALL(`[conn][joinGroupCallInternal][sdp] setRemoteDescription signaling=${connection.signalingState} ice=${connection.iceConnectionState} gathering=${connection.iceGatheringState} connection=${connection.connectionState}`, sdp1);
891891
await connection.setRemoteDescription({
892892
type: 'answer',
893893
sdp: sdp1,
@@ -1989,6 +1989,7 @@ class CallStore extends EventEmitter {
19891989

19901990
if (!isAnswer) {
19911991
const answer = await connection.createAnswer();
1992+
console.log('[sdp] local', answer.sdp);
19921993
await connection.setLocalDescription(answer);
19931994

19941995
// LOG_P2P_CALL('2 try invoke p2pAppendInputStream', inputStream, is_outgoing);

0 commit comments

Comments
 (0)