From 5bb5b259c855b7f701e006f1fa7637061adff156 Mon Sep 17 00:00:00 2001 From: automated-signal <37887102+automated-signal@users.noreply.github.com> Date: Thu, 13 Jun 2024 16:01:05 -0500 Subject: [PATCH] Update to RingRTC v2.44.0 Co-authored-by: Jim Gustafson Co-authored-by: Adel Lahlou --- ACKNOWLEDGMENTS.md | 2 +- package.json | 2 +- ts/services/calling.ts | 67 +++++++++++++++++++++++++++++------------- yarn.lock | 49 +++++------------------------- 4 files changed, 56 insertions(+), 64 deletions(-) diff --git a/ACKNOWLEDGMENTS.md b/ACKNOWLEDGMENTS.md index 0ab4a752e..97bb990c6 100644 --- a/ACKNOWLEDGMENTS.md +++ b/ACKNOWLEDGMENTS.md @@ -11545,7 +11545,7 @@ For more information on this, and how to apply and follow the GNU AGPL, see ``` -## libsignal-core 0.1.0, partial-default-derive 0.1.0, regex-aot 0.1.0, ringrtc 2.42.0 +## libsignal-core 0.1.0, mrp 2.44.0, partial-default-derive 0.1.0, regex-aot 0.1.0, ringrtc 2.44.0 ``` GNU AFFERO GENERAL PUBLIC LICENSE diff --git a/package.json b/package.json index 5e5a662db..b8e90bd0a 100644 --- a/package.json +++ b/package.json @@ -105,7 +105,7 @@ "@react-spring/web": "9.5.5", "@signalapp/better-sqlite3": "8.7.1", "@signalapp/libsignal-client": "0.50.0", - "@signalapp/ringrtc": "2.42.0", + "@signalapp/ringrtc": "2.44.0", "@signalapp/windows-dummy-keystroke": "1.0.0", "@types/fabric": "4.5.3", "backbone": "1.4.0", diff --git a/ts/services/calling.ts b/ts/services/calling.ts index 1ffa2db69..c40f05727 100644 --- a/ts/services/calling.ts +++ b/ts/services/calling.ts @@ -52,6 +52,7 @@ import { GenericServerPublicParams, } from '@signalapp/libsignal-client/zkgroup'; import { Aci } from '@signalapp/libsignal-client'; +import type { GumVideoCaptureOptions } from '@signalapp/ringrtc/dist/ringrtc/VideoSupport'; import type { ActionsType as CallingReduxActionsType, GroupCallParticipantInfoType, @@ -156,6 +157,7 @@ import type { ReadCallLinkState, } from '../types/CallLink'; import { CallLinkRestrictions } from '../types/CallLink'; +import { getConversationIdForLogging } from '../util/idForLogging'; const { processGroupCallRingCancellation, @@ -1197,6 +1199,7 @@ export class CallingClass { return; } + const logId = `joinGroupCall(${getConversationIdForLogging(conversation)})`; const haveMediaPermissions = await this.requestPermissions(hasLocalVideo); if (!haveMediaPermissions) { log.info('Permissions were denied, but allow joining group call'); @@ -1212,7 +1215,7 @@ export class CallingClass { groupCall.setOutgoingAudioMuted(!hasLocalAudio); groupCall.setOutgoingVideoMuted(!hasLocalVideo); - this.videoCapturer.enableCaptureAndSend(groupCall); + drop(this.enableCaptureAndSend(groupCall, null, logId)); if (shouldRing) { groupCall.ringAll(); @@ -1234,6 +1237,10 @@ export class CallingClass { callMode === CallMode.Group ? this.updateCallHistoryForGroupCallOnPeek : this.updateCallHistoryForAdhocCall; + const logId = + callMode === CallMode.Group + ? `groupv2(${conversationId})` + : `adhoc(${conversationId})`; return { onLocalDeviceStateChanged: groupCall => { @@ -1280,7 +1287,7 @@ export class CallingClass { if (localDeviceState.videoMuted) { this.disableLocalVideo(); } else { - this.videoCapturer.enableCaptureAndSend(groupCall); + drop(this.enableCaptureAndSend(groupCall, null, logId)); } // Call enters the Joined state, once per call. @@ -1530,7 +1537,7 @@ export class CallingClass { groupCall.setOutgoingAudioMuted(!hasLocalAudio); groupCall.setOutgoingVideoMuted(!hasLocalVideo); - this.videoCapturer.enableCaptureAndSend(groupCall); + drop(this.enableCaptureAndSend(groupCall)); groupCall.join(); } @@ -2043,13 +2050,15 @@ export class CallingClass { this.videoCapturer.disable(); if (source) { this.hadLocalVideoBeforePresenting = hasLocalVideo; - this.videoCapturer.enableCaptureAndSend(call, { - // 15fps is much nicer but takes up a lot more CPU. - maxFramerate: 5, - maxHeight: 1800, - maxWidth: 2880, - screenShareSourceId: source.id, - }); + drop( + this.enableCaptureAndSend(call, { + // 15fps is much nicer but takes up a lot more CPU. + maxFramerate: 5, + maxHeight: 1800, + maxWidth: 2880, + screenShareSourceId: source.id, + }) + ); this.setOutgoingVideo(conversationId, true); } else { this.setOutgoingVideo( @@ -2350,7 +2359,24 @@ export class CallingClass { } enableLocalCamera(): void { - this.videoCapturer.enableCapture(); + drop(this.videoCapturer.enableCapture()); + } + + async enableCaptureAndSend( + call: GroupCall | Call, + options?: GumVideoCaptureOptions | null, + logId?: string + ): Promise { + try { + await this.videoCapturer.enableCaptureAndSend(call, options ?? undefined); + } catch (err) { + log.error( + `${ + logId ?? 'enableCaptureAndSend' + }: Failed to enable camera and start sending:`, + Errors.toLogFormat(err) + ); + } } disableLocalVideo(): void { @@ -2470,17 +2496,17 @@ export class CallingClass { log.info(`${logId}: Handling in RingRTC`); - RingRTC.handleCallingMessage( + RingRTC.handleCallingMessage(protoToCallingMessage(callingMessage), { remoteUserId, - sourceServiceId ? Buffer.from(sourceServiceId) : null, + remoteUuid: sourceServiceId ? Buffer.from(sourceServiceId) : undefined, remoteDeviceId, - this.localDeviceId, - messageAgeSec, - envelope.receivedAtCounter, - protoToCallingMessage(callingMessage), - Buffer.from(senderIdentityKey), - Buffer.from(receiverIdentityKey) - ); + localDeviceId: this.localDeviceId, + ageSec: messageAgeSec, + receivedAtCounter: envelope.receivedAtCounter, + receivedAtDate: envelope.receivedAtDate, + senderIdentityKey: Buffer.from(senderIdentityKey), + receiverIdentityKey: Buffer.from(receiverIdentityKey), + }); } private async selectPreferredDevices( @@ -2854,7 +2880,6 @@ export class CallingClass { ageInSeconds: number, wasVideoCall: boolean, receivedAtCounter: number | undefined, - // TODO: DESKTOP-7145 receivedAtMS: number | undefined = undefined ) { const conversation = window.ConversationController.get(remoteUserId); diff --git a/yarn.lock b/yarn.lock index dcad0fe3f..546bd6e63 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4027,10 +4027,10 @@ ws "^8.4.2" zod "^3.20.2" -"@signalapp/ringrtc@2.42.0": - version "2.42.0" - resolved "https://registry.yarnpkg.com/@signalapp/ringrtc/-/ringrtc-2.42.0.tgz#de6e58bf780279dad63a3877b79643b7dace461f" - integrity sha512-kysZs+NyDoSLQMK5Vxbz4InbCYfDYI4W2iMbSrVoT38ZYonS0nCw9rtHHhyzf8c433lCcfrauLISqHncnJQJQw== +"@signalapp/ringrtc@2.44.0": + version "2.44.0" + resolved "https://registry.yarnpkg.com/@signalapp/ringrtc/-/ringrtc-2.44.0.tgz#772bd35164a1d512a169a8c88a023f665758f56f" + integrity sha512-czIJCR252PATe4OorY+EEwbuILczsTjwYvWgWk+9WgI/UQfoRw4/Rccp9gAIZU9sBZ17lyAjFnKo2AmnHlJ+bg== dependencies: https-proxy-agent "7.0.1" tar "^6.2.1" @@ -7617,7 +7617,7 @@ caniuse-lite@^1.0.30001349, caniuse-lite@^1.0.30001541: resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001541.tgz" integrity sha512-bLOsqxDgTqUBkzxbNlSBt8annkDpQB9NdzdTbO2ooJ+eC/IQcvDspDc058g84ejCelF7vHUx57KIOjEecOHXaw== -canvas@^2.6.1, "canvas@https://registry.yarnpkg.com/nop/-/nop-1.0.0.tgz": +canvas@^2.6.1, "canvas@https://registry.yarnpkg.com/nop/-/nop-1.0.0.tgz", dmg-license@^1.0.11, "dmg-license@https://registry.yarnpkg.com/nop/-/nop-1.0.0.tgz", jsdom@^15.2.1, "jsdom@https://registry.yarnpkg.com/nop/-/nop-1.0.0.tgz": version "1.0.0" resolved "https://registry.yarnpkg.com/nop/-/nop-1.0.0.tgz#cb46cf7e01574aa6390858149f66897afe53c9ca" @@ -9028,10 +9028,6 @@ dmg-builder@24.6.3: optionalDependencies: dmg-license "^1.0.11" -dmg-license@^1.0.11, "dmg-license@https://registry.yarnpkg.com/nop/-/nop-1.0.0.tgz": - version "1.0.0" - resolved "https://registry.yarnpkg.com/nop/-/nop-1.0.0.tgz#cb46cf7e01574aa6390858149f66897afe53c9ca" - dns-equal@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/dns-equal/-/dns-equal-1.0.0.tgz#b39e7f1da6eb0a75ba9c17324b34753c47e0654d" @@ -13541,10 +13537,6 @@ jsdoc@^4.0.0: strip-json-comments "^3.1.0" underscore "~1.13.2" -jsdom@^15.2.1, "jsdom@https://registry.yarnpkg.com/nop/-/nop-1.0.0.tgz": - version "1.0.0" - resolved "https://registry.yarnpkg.com/nop/-/nop-1.0.0.tgz#cb46cf7e01574aa6390858149f66897afe53c9ca" - jsesc@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-1.3.0.tgz#46c3fec8c1892b12b0833db9bc7622176dbab34b" @@ -18727,7 +18719,7 @@ string-length@^5.0.1: char-regex "^2.0.0" strip-ansi "^7.0.1" -"string-width-cjs@npm:string-width@^4.2.0": +"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.2.3: version "4.2.3" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== @@ -18771,15 +18763,6 @@ string-width@^4.1.0, string-width@^4.2.0: is-fullwidth-code-point "^3.0.0" strip-ansi "^6.0.0" -string-width@^4.2.3: - version "4.2.3" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" - integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== - dependencies: - emoji-regex "^8.0.0" - is-fullwidth-code-point "^3.0.0" - strip-ansi "^6.0.1" - string-width@^5.0.1, string-width@^5.1.2: version "5.1.2" resolved "https://registry.yarnpkg.com/string-width/-/string-width-5.1.2.tgz#14f8daec6d81e7221d2a357e668cab73bdbca794" @@ -18860,7 +18843,7 @@ string_decoder@~1.1.1: dependencies: safe-buffer "~5.1.0" -"strip-ansi-cjs@npm:strip-ansi@^6.0.1": +"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== @@ -18895,13 +18878,6 @@ strip-ansi@^6.0.0: dependencies: ansi-regex "^5.0.0" -strip-ansi@^6.0.1: - version "6.0.1" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" - integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== - dependencies: - ansi-regex "^5.0.1" - strip-ansi@^7.0.1: version "7.1.0" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-7.1.0.tgz#d5b6568ca689d8561370b0707685d22434faff45" @@ -20553,7 +20529,7 @@ workerpool@6.2.1: resolved "https://registry.yarnpkg.com/workerpool/-/workerpool-6.2.1.tgz#46fc150c17d826b86a008e5a4508656777e9c343" integrity sha512-ILEIE97kDZvF9Wb9f6h5aXK4swSlKGUcOEGiIYb2OOu/IrDU9iwj0fD//SsA6E5ibwJxpEvhullJY4Sl4GcpAw== -"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0": +"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== @@ -20588,15 +20564,6 @@ wrap-ansi@^6.2.0: string-width "^4.1.0" strip-ansi "^6.0.0" -wrap-ansi@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" - integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== - dependencies: - ansi-styles "^4.0.0" - string-width "^4.1.0" - strip-ansi "^6.0.0" - wrap-ansi@^8.1.0: version "8.1.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214"