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", "redux-ts-utils": "3.2.2",
"reselect": "4.1.2", "reselect": "4.1.2",
"rimraf": "2.6.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", "rotating-file-stream": "2.1.5",
"sanitize.css": "11.0.0", "sanitize.css": "11.0.0",
"semver": "5.4.1", "semver": "5.4.1",

View file

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