Update to RingRTC v2.16.0

This commit is contained in:
Jim Gustafson 2021-12-03 12:22:58 -08:00 committed by GitHub
parent b87e05b1de
commit 38cdb9b289
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 84 additions and 75 deletions

View File

@ -157,7 +157,7 @@
"redux-ts-utils": "3.2.2",
"reselect": "4.1.2",
"rimraf": "2.6.2",
"ringrtc": "https://github.com/signalapp/signal-ringrtc-node.git#7a17d31bc0d4e8fadb1920b5fef9417ff5cf4d0a",
"ringrtc": "https://github.com/signalapp/signal-ringrtc-node.git#7564aff3d10f7c9b70134a0dc8acdfe8512f75e1",
"rotating-file-stream": "2.1.5",
"sanitize.css": "11.0.0",
"semver": "5.4.1",

View File

@ -602,94 +602,103 @@ export class CallingClass {
let updateMessageState = GroupCallUpdateMessageState.SentNothing;
let isRequestingMembershipProof = false;
const outerGroupCall = RingRTC.getGroupCall(groupIdBuffer, this.sfuUrl, {
onLocalDeviceStateChanged: groupCall => {
const localDeviceState = groupCall.getLocalDeviceState();
const { eraId } = groupCall.getPeekInfo() || {};
if (localDeviceState.connectionState === ConnectionState.NotConnected) {
// NOTE: This assumes that only one call is active at a time. For example, if
// there are two calls using the camera, this will disable both of them.
// That's fine for now, but this will break if that assumption changes.
this.disableLocalVideo();
delete this.callsByConversation[conversationId];
const outerGroupCall = RingRTC.getGroupCall(
groupIdBuffer,
this.sfuUrl,
Buffer.alloc(0),
{
onLocalDeviceStateChanged: groupCall => {
const localDeviceState = groupCall.getLocalDeviceState();
const { eraId } = groupCall.getPeekInfo() || {};
if (
updateMessageState === GroupCallUpdateMessageState.SentJoin &&
eraId
localDeviceState.connectionState === ConnectionState.NotConnected
) {
updateMessageState = GroupCallUpdateMessageState.SentLeft;
this.sendGroupCallUpdateMessage(conversationId, eraId);
}
} else {
this.callsByConversation[conversationId] = groupCall;
// NOTE: This assumes only one active call at a time. See comment above.
if (localDeviceState.videoMuted) {
// NOTE: This assumes that only one call is active at a time. For example, if
// there are two calls using the camera, this will disable both of them.
// That's fine for now, but this will break if that assumption changes.
this.disableLocalVideo();
delete this.callsByConversation[conversationId];
if (
updateMessageState === GroupCallUpdateMessageState.SentJoin &&
eraId
) {
updateMessageState = GroupCallUpdateMessageState.SentLeft;
this.sendGroupCallUpdateMessage(conversationId, eraId);
}
} else {
this.videoCapturer.enableCaptureAndSend(groupCall);
this.callsByConversation[conversationId] = groupCall;
// NOTE: This assumes only one active call at a time. See comment above.
if (localDeviceState.videoMuted) {
this.disableLocalVideo();
} else {
this.videoCapturer.enableCaptureAndSend(groupCall);
}
if (
updateMessageState === GroupCallUpdateMessageState.SentNothing &&
localDeviceState.joinState === JoinState.Joined &&
eraId
) {
updateMessageState = GroupCallUpdateMessageState.SentJoin;
this.sendGroupCallUpdateMessage(conversationId, eraId);
}
}
this.syncGroupCallToRedux(conversationId, groupCall);
},
onRemoteDeviceStatesChanged: groupCall => {
this.syncGroupCallToRedux(conversationId, groupCall);
},
onPeekChanged: groupCall => {
const localDeviceState = groupCall.getLocalDeviceState();
const { eraId } = groupCall.getPeekInfo() || {};
if (
updateMessageState === GroupCallUpdateMessageState.SentNothing &&
localDeviceState.connectionState !== ConnectionState.NotConnected &&
localDeviceState.joinState === JoinState.Joined &&
eraId
) {
updateMessageState = GroupCallUpdateMessageState.SentJoin;
this.sendGroupCallUpdateMessage(conversationId, eraId);
}
}
this.syncGroupCallToRedux(conversationId, groupCall);
},
onRemoteDeviceStatesChanged: groupCall => {
this.syncGroupCallToRedux(conversationId, groupCall);
},
onPeekChanged: groupCall => {
const localDeviceState = groupCall.getLocalDeviceState();
const { eraId } = groupCall.getPeekInfo() || {};
if (
updateMessageState === GroupCallUpdateMessageState.SentNothing &&
localDeviceState.connectionState !== ConnectionState.NotConnected &&
localDeviceState.joinState === JoinState.Joined &&
eraId
) {
updateMessageState = GroupCallUpdateMessageState.SentJoin;
this.sendGroupCallUpdateMessage(conversationId, eraId);
}
this.updateCallHistoryForGroupCall(
conversationId,
groupCall.getPeekInfo()
);
this.syncGroupCallToRedux(conversationId, groupCall);
},
async requestMembershipProof(groupCall) {
if (isRequestingMembershipProof) {
return;
}
isRequestingMembershipProof = true;
try {
const proof = await fetchMembershipProof({
publicParams,
secretParams,
});
if (proof) {
groupCall.setMembershipProof(Buffer.from(Bytes.fromString(proof)));
this.updateCallHistoryForGroupCall(
conversationId,
groupCall.getPeekInfo()
);
this.syncGroupCallToRedux(conversationId, groupCall);
},
async requestMembershipProof(groupCall) {
if (isRequestingMembershipProof) {
return;
}
} catch (err) {
log.error('Failed to fetch membership proof', err);
} finally {
isRequestingMembershipProof = false;
}
},
requestGroupMembers: groupCall => {
groupCall.setGroupMembers(this.getGroupCallMembers(conversationId));
},
onEnded: noop,
});
isRequestingMembershipProof = true;
try {
const proof = await fetchMembershipProof({
publicParams,
secretParams,
});
if (proof) {
groupCall.setMembershipProof(
Buffer.from(Bytes.fromString(proof))
);
}
} catch (err) {
log.error('Failed to fetch membership proof', err);
} finally {
isRequestingMembershipProof = false;
}
},
requestGroupMembers: groupCall => {
groupCall.setGroupMembers(this.getGroupCallMembers(conversationId));
},
onEnded: noop,
}
);
if (!outerGroupCall) {
// This should be very rare, likely due to RingRTC not being able to get a lock

View File

@ -15438,9 +15438,9 @@ rimraf@^3.0.0, rimraf@^3.0.2, rimraf@~3.0.2:
dependencies:
glob "^7.1.3"
"ringrtc@https://github.com/signalapp/signal-ringrtc-node.git#7a17d31bc0d4e8fadb1920b5fef9417ff5cf4d0a":
version "2.15.0"
resolved "https://github.com/signalapp/signal-ringrtc-node.git#7a17d31bc0d4e8fadb1920b5fef9417ff5cf4d0a"
"ringrtc@https://github.com/signalapp/signal-ringrtc-node.git#7564aff3d10f7c9b70134a0dc8acdfe8512f75e1":
version "2.16.0"
resolved "https://github.com/signalapp/signal-ringrtc-node.git#7564aff3d10f7c9b70134a0dc8acdfe8512f75e1"
ripemd160@^2.0.0, ripemd160@^2.0.1:
version "2.0.1"