Update RingRTC to v2.10.6

This commit is contained in:
Fedor Indutny 2021-06-29 07:39:53 -07:00 committed by GitHub
parent a3315bcb68
commit d11283f0f1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 42 additions and 33 deletions

View file

@ -147,7 +147,7 @@
"redux-ts-utils": "3.2.2", "redux-ts-utils": "3.2.2",
"reselect": "4.0.0", "reselect": "4.0.0",
"rimraf": "2.6.2", "rimraf": "2.6.2",
"ringrtc": "https://github.com/signalapp/signal-ringrtc-node.git#a669f0becf3ec392707e78b3d3521100fde24b97", "ringrtc": "https://github.com/signalapp/signal-ringrtc-node.git#868f7ecb699b984171b5ad02f9b043bfa55ad804",
"rotating-file-stream": "2.1.5", "rotating-file-stream": "2.1.5",
"sanitize-filename": "1.6.3", "sanitize-filename": "1.6.3",
"sanitize.css": "11.0.0", "sanitize.css": "11.0.0",

View file

@ -129,7 +129,9 @@ export const GroupCallRemoteParticipant: React.FC<PropsType> = React.memo(
// for other participants, or pixel data from a previous frame. That's why we // for other participants, or pixel data from a previous frame. That's why we
// return early and use the `frameWidth` and `frameHeight`. // return early and use the `frameWidth` and `frameHeight`.
const frameBuffer = getFrameBuffer(); const frameBuffer = getFrameBuffer();
const frameDimensions = videoFrameSource.receiveVideoFrame(frameBuffer); const frameDimensions = videoFrameSource.receiveVideoFrame(
Buffer.from(frameBuffer)
);
if (!frameDimensions) { if (!frameDimensions) {
return; return;
} }

View file

@ -50,8 +50,8 @@ import {
} from '../types/Calling'; } from '../types/Calling';
import { LocalizerType } from '../types/Util'; import { LocalizerType } from '../types/Util';
import { ConversationModel } from '../models/conversations'; import { ConversationModel } from '../models/conversations';
import * as Bytes from '../Bytes';
import { import {
base64ToArrayBuffer,
uuidToArrayBuffer, uuidToArrayBuffer,
arrayBufferToUuid, arrayBufferToUuid,
typedArrayToArrayBuffer, typedArrayToArrayBuffer,
@ -384,8 +384,8 @@ export class CallingClass {
return getMembershipList(conversationId).map( return getMembershipList(conversationId).map(
member => member =>
new GroupMemberInfo( new GroupMemberInfo(
uuidToArrayBuffer(member.uuid), Buffer.from(uuidToArrayBuffer(member.uuid)),
typedArrayToArrayBuffer(member.uuidCiphertext) Buffer.from(member.uuidCiphertext)
) )
); );
} }
@ -425,11 +425,11 @@ export class CallingClass {
if (!proof) { if (!proof) {
throw new Error('No membership proof. Cannot peek group call'); throw new Error('No membership proof. Cannot peek group call');
} }
const membershipProof = new TextEncoder().encode(proof).buffer; const membershipProof = Bytes.fromString(proof);
return RingRTC.peekGroupCall( return RingRTC.peekGroupCall(
this.sfuUrl, this.sfuUrl,
membershipProof, Buffer.from(membershipProof),
this.getGroupCallMembers(conversationId) this.getGroupCallMembers(conversationId)
); );
} }
@ -468,7 +468,7 @@ export class CallingClass {
throw new Error('Missing SFU URL; not connecting group call'); throw new Error('Missing SFU URL; not connecting group call');
} }
const groupIdBuffer = base64ToArrayBuffer(groupId); const groupIdBuffer = Buffer.from(Bytes.fromBase64(groupId));
let updateMessageState = GroupCallUpdateMessageState.SentNothing; let updateMessageState = GroupCallUpdateMessageState.SentNothing;
let isRequestingMembershipProof = false; let isRequestingMembershipProof = false;
@ -548,8 +548,7 @@ export class CallingClass {
secretParams, secretParams,
}); });
if (proof) { if (proof) {
const proofArray = new TextEncoder().encode(proof); groupCall.setMembershipProof(Buffer.from(Bytes.fromString(proof)));
groupCall.setMembershipProof(proofArray.buffer);
} }
} catch (err) { } catch (err) {
window.log.error('Failed to fetch membership proof', err); window.log.error('Failed to fetch membership proof', err);
@ -672,7 +671,7 @@ export class CallingClass {
): GroupCallPeekInfoType { ): GroupCallPeekInfoType {
return { return {
uuids: peekInfo.joinedMembers.map(uuidBuffer => { uuids: peekInfo.joinedMembers.map(uuidBuffer => {
let uuid = arrayBufferToUuid(uuidBuffer); let uuid = arrayBufferToUuid(typedArrayToArrayBuffer(uuidBuffer));
if (!uuid) { if (!uuid) {
window.log.error( window.log.error(
'Calling.formatGroupCallPeekInfoForRedux: could not convert peek UUID ArrayBuffer to string; using fallback UUID' 'Calling.formatGroupCallPeekInfoForRedux: could not convert peek UUID ArrayBuffer to string; using fallback UUID'
@ -681,7 +680,9 @@ export class CallingClass {
} }
return uuid; return uuid;
}), }),
creatorUuid: peekInfo.creator && arrayBufferToUuid(peekInfo.creator), creatorUuid:
peekInfo.creator &&
arrayBufferToUuid(typedArrayToArrayBuffer(peekInfo.creator)),
eraId: peekInfo.eraId, eraId: peekInfo.eraId,
maxDevices: peekInfo.maxDevices ?? Infinity, maxDevices: peekInfo.maxDevices ?? Infinity,
deviceCount: peekInfo.deviceCount, deviceCount: peekInfo.deviceCount,
@ -718,7 +719,9 @@ export class CallingClass {
? this.formatGroupCallPeekInfoForRedux(peekInfo) ? this.formatGroupCallPeekInfoForRedux(peekInfo)
: undefined, : undefined,
remoteParticipants: remoteDeviceStates.map(remoteDeviceState => { remoteParticipants: remoteDeviceStates.map(remoteDeviceState => {
let uuid = arrayBufferToUuid(remoteDeviceState.userId); let uuid = arrayBufferToUuid(
typedArrayToArrayBuffer(remoteDeviceState.userId)
);
if (!uuid) { if (!uuid) {
window.log.error( window.log.error(
'Calling.formatGroupCallForRedux: could not convert remote participant UUID ArrayBuffer to string; using fallback UUID' 'Calling.formatGroupCallForRedux: could not convert remote participant UUID ArrayBuffer to string; using fallback UUID'
@ -1315,13 +1318,13 @@ export class CallingClass {
RingRTC.handleCallingMessage( RingRTC.handleCallingMessage(
remoteUserId, remoteUserId,
sourceUuid, sourceUuid ? Buffer.from(sourceUuid) : null,
remoteDeviceId, remoteDeviceId,
this.localDeviceId, this.localDeviceId,
messageAgeSec, messageAgeSec,
callingMessage, callingMessage,
senderIdentityKey, Buffer.from(senderIdentityKey),
receiverIdentityKey Buffer.from(receiverIdentityKey)
); );
} }
@ -1395,17 +1398,17 @@ export class CallingClass {
} }
private async handleSendCallMessage( private async handleSendCallMessage(
recipient: ArrayBuffer, recipient: Uint8Array,
data: ArrayBuffer data: Uint8Array
): Promise<boolean> { ): Promise<boolean> {
const userId = arrayBufferToUuid(recipient); const userId = arrayBufferToUuid(typedArrayToArrayBuffer(recipient));
if (!userId) { if (!userId) {
window.log.error('handleSendCallMessage(): bad recipient UUID'); window.log.error('handleSendCallMessage(): bad recipient UUID');
return false; return false;
} }
const message = new CallingMessage(); const message = new CallingMessage();
message.opaque = new OpaqueMessage(); message.opaque = new OpaqueMessage();
message.opaque.data = data; message.opaque.data = Buffer.from(data);
return this.handleOutgoingSignaling(userId, message); return this.handleOutgoingSignaling(userId, message);
} }
@ -1585,7 +1588,7 @@ export class CallingClass {
url: string, url: string,
method: HttpMethod, method: HttpMethod,
headers: { [name: string]: string }, headers: { [name: string]: string },
body: ArrayBuffer | undefined body: Uint8Array | undefined
) { ) {
if (!window.textsecure.messaging) { if (!window.textsecure.messaging) {
RingRTC.httpRequestFailed(requestId, 'We are offline'); RingRTC.httpRequestFailed(requestId, 'We are offline');
@ -1607,14 +1610,14 @@ export class CallingClass {
url, url,
httpMethod, httpMethod,
headers, headers,
body body ? typedArrayToArrayBuffer(body) : undefined
); );
} catch (err) { } catch (err) {
if (err.code !== -1) { if (err.code !== -1) {
// WebAPI treats certain response codes as errors, but RingRTC still needs to // WebAPI treats certain response codes as errors, but RingRTC still needs to
// see them. It does not currently look at the response body, so we're giving // see them. It does not currently look at the response body, so we're giving
// it an empty one. // it an empty one.
RingRTC.receivedHttpResponse(requestId, err.code, new ArrayBuffer(0)); RingRTC.receivedHttpResponse(requestId, err.code, Buffer.alloc(0));
} else { } else {
window.log.error('handleSendHttpRequest: fetch failed with error', err); window.log.error('handleSendHttpRequest: fetch failed with error', err);
RingRTC.httpRequestFailed(requestId, String(err)); RingRTC.httpRequestFailed(requestId, String(err));
@ -1625,7 +1628,7 @@ export class CallingClass {
RingRTC.receivedHttpResponse( RingRTC.receivedHttpResponse(
requestId, requestId,
result.response.status, result.response.status,
result.data Buffer.from(result.data)
); );
} }
@ -1749,7 +1752,9 @@ export class CallingClass {
if (!peekInfo || !peekInfo.eraId || !peekInfo.creator) { if (!peekInfo || !peekInfo.eraId || !peekInfo.creator) {
return; return;
} }
const creatorUuid = arrayBufferToUuid(peekInfo.creator); const creatorUuid = arrayBufferToUuid(
typedArrayToArrayBuffer(peekInfo.creator)
);
if (!creatorUuid) { if (!creatorUuid) {
window.log.error('updateCallHistoryForGroupCall(): bad creator UUID'); window.log.error('updateCallHistoryForGroupCall(): bad creator UUID');
return; return;

View file

@ -31,15 +31,13 @@ class FakeGroupCallVideoFrameSource implements VideoFrameSource {
this.dimensions = [width, height]; this.dimensions = [width, height];
} }
receiveVideoFrame( receiveVideoFrame(destinationBuffer: Buffer): [number, number] | undefined {
destinationBuffer: ArrayBuffer
): [number, number] | undefined {
// Simulate network jitter. Also improves performance when testing. // Simulate network jitter. Also improves performance when testing.
if (Math.random() < 0.5) { if (Math.random() < 0.5) {
return undefined; return undefined;
} }
new Uint8Array(destinationBuffer).set(this.sourceArray); destinationBuffer.set(this.sourceArray);
return this.dimensions; return this.dimensions;
} }
} }

View file

@ -134,7 +134,7 @@ export type GroupCallVideoRequest = {
// Should match RingRTC's VideoFrameSource // Should match RingRTC's VideoFrameSource
export type VideoFrameSource = { export type VideoFrameSource = {
receiveVideoFrame(buffer: ArrayBuffer): [number, number] | undefined; receiveVideoFrame(buffer: Buffer): [number, number] | undefined;
}; };
// Must be kept in sync with RingRTC.AudioDevice // Must be kept in sync with RingRTC.AudioDevice

View file

@ -15754,9 +15754,13 @@ 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#a669f0becf3ec392707e78b3d3521100fde24b97": "ringrtc@https://github.com/signalapp/signal-ringrtc-node.git#0956fdc542cb7d1a0f3a06f28b8966adf359bb61":
version "2.10.5" version "2.10.6"
resolved "https://github.com/signalapp/signal-ringrtc-node.git#a669f0becf3ec392707e78b3d3521100fde24b97" resolved "https://github.com/signalapp/signal-ringrtc-node.git#0956fdc542cb7d1a0f3a06f28b8966adf359bb61"
"ringrtc@https://github.com/signalapp/signal-ringrtc-node.git#868f7ecb699b984171b5ad02f9b043bfa55ad804":
version "2.10.6"
resolved "https://github.com/signalapp/signal-ringrtc-node.git#868f7ecb699b984171b5ad02f9b043bfa55ad804"
ripemd160@^2.0.0, ripemd160@^2.0.1: ripemd160@^2.0.0, ripemd160@^2.0.1:
version "2.0.1" version "2.0.1"