@signalapp/ringrtc 2.40.0 → 2.42.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -669,7 +669,7 @@ For more information on this, and how to apply and follow the GNU AGPL, see
669
669
 
670
670
  ```
671
671
 
672
- ## libsignal-core 0.1.0, partial-default-derive 0.1.0, regex-aot 0.1.0, ringrtc 2.40.0
672
+ ## libsignal-core 0.1.0, partial-default-derive 0.1.0, regex-aot 0.1.0, ringrtc 2.42.0
673
673
 
674
674
  ```
675
675
  GNU AFFERO GENERAL PUBLIC LICENSE
@@ -16,6 +16,20 @@ export interface Reaction {
16
16
  demuxId: number;
17
17
  value: string;
18
18
  }
19
+ /** type returned by Rust */
20
+ export interface RawPeekInfo {
21
+ devices: Array<PeekDeviceInfo>;
22
+ creator?: GroupCallUserId;
23
+ eraId?: string;
24
+ maxDevices?: number;
25
+ /** @deprecated Use {@link #deviceCountIncludingPendingDevices} and {@link #deviceCountExcludingPendingDevices} as appropriate */
26
+ deviceCount: number;
27
+ deviceCountIncludingPendingDevices: number;
28
+ deviceCountExcludingPendingDevices: number;
29
+ pendingUsers: Array<GroupCallUserId>;
30
+ callLinkState?: RawCallLinkState;
31
+ }
32
+ /** type derived from RawPeekInfo */
19
33
  export interface PeekInfo {
20
34
  devices: Array<PeekDeviceInfo>;
21
35
  creator?: GroupCallUserId;
@@ -26,6 +40,7 @@ export interface PeekInfo {
26
40
  deviceCountIncludingPendingDevices: number;
27
41
  deviceCountExcludingPendingDevices: number;
28
42
  pendingUsers: Array<GroupCallUserId>;
43
+ callLinkState?: CallLinkState;
29
44
  }
30
45
  export declare enum PeekStatusCodes {
31
46
  EXPIRED_CALL_LINK = 703,
@@ -55,6 +70,12 @@ export declare class ReceivedAudioLevel {
55
70
  level: RawAudioLevel;
56
71
  constructor(demuxId: number, level: RawAudioLevel);
57
72
  }
73
+ interface RawCallLinkState {
74
+ name: string;
75
+ rawRestrictions: number;
76
+ revoked: boolean;
77
+ expiration: Date;
78
+ }
58
79
  export type EmptyObj = Record<PropertyKey, never>;
59
80
  export type HttpResult<T> = {
60
81
  success: true;
@@ -83,6 +104,7 @@ export declare class RingRTCType {
83
104
  handleSendCallMessage: ((recipientUuid: Buffer, message: Buffer, urgency: CallMessageUrgency) => void) | null;
84
105
  handleSendCallMessageToGroup: ((groupId: Buffer, message: Buffer, urgency: CallMessageUrgency, overrideRecipients: Array<Buffer>) => void) | null;
85
106
  handleGroupCallRingUpdate: ((groupId: Buffer, ringId: bigint, sender: Buffer, update: RingUpdate) => void) | null;
107
+ handleRtcStatsReport: ((reportJson: string) => void) | null;
86
108
  constructor();
87
109
  setConfig(config: Config): void;
88
110
  setSelfUuid(uuid: Buffer): void;
@@ -216,17 +238,13 @@ export declare class RingRTCType {
216
238
  handleReactions(clientId: GroupCallClientId, reactions: Array<Reaction>): void;
217
239
  handleRaisedHands(clientId: GroupCallClientId, raisedHands: Array<number>): void;
218
240
  handleRemoteDevicesChanged(clientId: GroupCallClientId, remoteDeviceStates: Array<RemoteDeviceState>): void;
219
- handlePeekChanged(clientId: GroupCallClientId, info: PeekInfo): void;
220
- handlePeekResponse(requestId: number, statusCode: number, info: PeekInfo | undefined): void;
221
- handleCallLinkResponse(requestId: number, statusCode: number, state: {
222
- name: string;
223
- rawRestrictions: number;
224
- revoked: boolean;
225
- expiration: Date;
226
- } | undefined): void;
241
+ handlePeekChanged(clientId: GroupCallClientId, rawInfo: RawPeekInfo): void;
242
+ handlePeekResponse(requestId: number, statusCode: number, rawInfo: RawPeekInfo | undefined): void;
243
+ handleCallLinkResponse(requestId: number, statusCode: number, state: RawCallLinkState | undefined): void;
227
244
  handleEmptyResponse(requestId: number, statusCode: number, state: EmptyObj | undefined): void;
228
245
  handleEnded(clientId: GroupCallClientId, reason: GroupCallEndReason): void;
229
246
  groupCallRingUpdate(groupId: GroupId, ringId: bigint, sender: GroupCallUserId, state: RingUpdate): void;
247
+ handleRtcStatsReportComplete(reportJson: string): void;
230
248
  onLogMessage(level: number, fileName: string, line: number, message: string): void;
231
249
  logError(message: string): void;
232
250
  logWarn(message: string): void;
@@ -497,6 +515,7 @@ export declare class GroupCall {
497
515
  sendVideoFrame(width: number, height: number, format: VideoPixelFormatEnum, buffer: Buffer): void;
498
516
  getVideoSource(remoteDemuxId: number): GroupCallVideoFrameSource;
499
517
  setRemoteAspectRatio(remoteDemuxId: number, aspectRatio: number): void;
518
+ setRtcStatsInterval(intervalMillis: number): void;
500
519
  }
501
520
  declare class GroupCallVideoFrameSource {
502
521
  private readonly _callManager;
@@ -621,6 +640,7 @@ export interface CallManager {
621
640
  setGroupMembers(clientId: GroupCallClientId, members: Array<GroupMemberInfo>): void;
622
641
  setMembershipProof(clientId: GroupCallClientId, proof: Buffer): void;
623
642
  receiveGroupCallVideoFrame(clientId: GroupCallClientId, remoteDemuxId: number, buffer: Buffer, maxWidth: number, maxHeight: number): [number, number] | undefined;
643
+ setRtcStatsInterval(clientId: GroupCallClientId, intervalMillis: number): void;
624
644
  readCallLink(requestId: number, sfuUrl: string, authCredentialPresentation: Buffer, linkRootKey: Buffer): void;
625
645
  createCallLink(requestId: number, sfuUrl: string, createCredentialPresentation: Buffer, linkRootKey: Buffer, adminPasskey: Buffer, callLinkPublicParams: Buffer): void;
626
646
  updateCallLink(requestId: number, sfuUrl: string, authCredentialPresentation: Buffer, linkRootKey: Buffer, adminPasskey: Buffer, newName: string | undefined, newRestrictions: number | undefined, newRevoked: boolean | undefined): void;
@@ -654,8 +674,8 @@ export interface CallManagerCallbacks {
654
674
  handleConnectionStateChanged(clientId: GroupCallClientId, connectionState: ConnectionState): void;
655
675
  handleJoinStateChanged(clientId: GroupCallClientId, joinState: JoinState, demuxId: number | undefined): void;
656
676
  handleRemoteDevicesChanged(clientId: GroupCallClientId, remoteDeviceStates: Array<RemoteDeviceState>): void;
657
- handlePeekChanged(clientId: GroupCallClientId, info: PeekInfo): void;
658
- handlePeekResponse(requestId: number, statusCode: number, info: PeekInfo | undefined): void;
677
+ handlePeekChanged(clientId: GroupCallClientId, rawInfo: RawPeekInfo): void;
678
+ handlePeekResponse(requestId: number, statusCode: number, rawInfo: RawPeekInfo | undefined): void;
659
679
  handleEnded(clientId: GroupCallClientId, reason: GroupCallEndReason): void;
660
680
  onLogMessage(level: number, fileName: string, line: number, message: string): void;
661
681
  }
@@ -139,6 +139,8 @@ NativeCallManager.prototype.getAudioOutputs =
139
139
  Native_1.default.cm_getAudioOutputs;
140
140
  NativeCallManager.prototype.setAudioOutput = Native_1.default.cm_setAudioOutput;
141
141
  NativeCallManager.prototype.processEvents = Native_1.default.cm_processEvents;
142
+ NativeCallManager.prototype.setRtcStatsInterval =
143
+ Native_1.default.cm_setRtcStatsInterval;
142
144
  var PeekStatusCodes;
143
145
  (function (PeekStatusCodes) {
144
146
  PeekStatusCodes[PeekStatusCodes["EXPIRED_CALL_LINK"] = 703] = "EXPIRED_CALL_LINK";
@@ -187,6 +189,32 @@ exports.ReceivedAudioLevel = ReceivedAudioLevel;
187
189
  function normalizeAudioLevel(raw) {
188
190
  return raw / 32767;
189
191
  }
192
+ function rawCallLinkStateToCallLinkState(raw) {
193
+ if (raw) {
194
+ let restrictions;
195
+ switch (raw.rawRestrictions) {
196
+ case 0:
197
+ restrictions = CallLinks_1.CallLinkRestrictions.None;
198
+ break;
199
+ case 1:
200
+ restrictions = CallLinks_1.CallLinkRestrictions.AdminApproval;
201
+ break;
202
+ default:
203
+ restrictions = CallLinks_1.CallLinkRestrictions.Unknown;
204
+ break;
205
+ }
206
+ return new CallLinks_1.CallLinkState(raw.name, restrictions, raw.revoked, raw.expiration);
207
+ }
208
+ else {
209
+ return undefined;
210
+ }
211
+ }
212
+ function rawPeekInfoToPeekInfo(raw) {
213
+ return {
214
+ ...raw,
215
+ callLinkState: rawCallLinkStateToCallLinkState(raw.callLinkState),
216
+ };
217
+ }
190
218
  class Requests {
191
219
  constructor() {
192
220
  this._resolveById = new Map();
@@ -234,6 +262,7 @@ class RingRTCType {
234
262
  this.handleSendCallMessage = null;
235
263
  this.handleSendCallMessageToGroup = null;
236
264
  this.handleGroupCallRingUpdate = null;
265
+ this.handleRtcStatsReport = null;
237
266
  this.callManager = new NativeCallManager(this);
238
267
  this._call = null;
239
268
  this._groupCallByClientId = new Map();
@@ -821,21 +850,23 @@ class RingRTCType {
821
850
  });
822
851
  }
823
852
  // Called by Rust
824
- handlePeekChanged(clientId, info) {
853
+ handlePeekChanged(clientId, rawInfo) {
825
854
  sillyDeadlockProtection(() => {
826
855
  const groupCall = this._groupCallByClientId.get(clientId);
827
856
  if (!groupCall) {
828
857
  this.logError('handlePeekChanged(): GroupCall not found in map!');
829
858
  return;
830
859
  }
860
+ const info = rawPeekInfoToPeekInfo(rawInfo);
831
861
  groupCall.handlePeekChanged(info);
832
862
  });
833
863
  }
834
864
  // Called by Rust
835
- handlePeekResponse(requestId, statusCode, info) {
865
+ handlePeekResponse(requestId, statusCode, rawInfo) {
836
866
  sillyDeadlockProtection(() => {
837
867
  let result;
838
- if (info) {
868
+ if (rawInfo) {
869
+ const info = rawPeekInfoToPeekInfo(rawInfo);
839
870
  result = { success: true, value: info };
840
871
  }
841
872
  else {
@@ -851,22 +882,11 @@ class RingRTCType {
851
882
  sillyDeadlockProtection(() => {
852
883
  // Recreate the state so that we have the correct prototype, in case we add more methods to CallLinkState.
853
884
  let result;
854
- if (state) {
855
- let restrictions;
856
- switch (state.rawRestrictions) {
857
- case 0:
858
- restrictions = CallLinks_1.CallLinkRestrictions.None;
859
- break;
860
- case 1:
861
- restrictions = CallLinks_1.CallLinkRestrictions.AdminApproval;
862
- break;
863
- default:
864
- restrictions = CallLinks_1.CallLinkRestrictions.Unknown;
865
- break;
866
- }
885
+ const s = rawCallLinkStateToCallLinkState(state);
886
+ if (s) {
867
887
  result = {
868
888
  success: true,
869
- value: new CallLinks_1.CallLinkState(state.name, restrictions, state.revoked, state.expiration),
889
+ value: s,
870
890
  };
871
891
  }
872
892
  else {
@@ -916,6 +936,12 @@ class RingRTCType {
916
936
  });
917
937
  }
918
938
  // Called by Rust
939
+ handleRtcStatsReportComplete(reportJson) {
940
+ if (this.handleRtcStatsReport) {
941
+ this.handleRtcStatsReport(reportJson);
942
+ }
943
+ }
944
+ // Called by Rust
919
945
  onLogMessage(level, fileName, line, message) {
920
946
  if (this.handleLogMessage) {
921
947
  this.handleLogMessage(level, fileName, line, message);
@@ -1654,6 +1680,9 @@ class GroupCall {
1654
1680
  this._observer.onRemoteDeviceStatesChanged(this);
1655
1681
  }
1656
1682
  }
1683
+ setRtcStatsInterval(intervalMillis) {
1684
+ this._callManager.setRtcStatsInterval(this._clientId, intervalMillis);
1685
+ }
1657
1686
  }
1658
1687
  exports.GroupCall = GroupCall;
1659
1688
  // Implements VideoSource for use in CanvasVideoRenderer
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@signalapp/ringrtc",
3
- "version": "2.40.0",
3
+ "version": "2.42.0",
4
4
  "description": "Signal Messenger voice and video calling library.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -25,13 +25,13 @@
25
25
  },
26
26
  "config": {
27
27
  "prebuildUrl": "https://build-artifacts.signal.org/libraries/ringrtc-desktop-build-v${npm_package_version}.tar.gz",
28
- "prebuildChecksum": "fbdbd8ac3923dde1e82addb15b4a08ef7660c6e8b9f412139eaff19d8b67d0d4"
28
+ "prebuildChecksum": "c7ce95993ed4cc77b6b912e052deb4c8671d63e44605c12b576a5872293f687e"
29
29
  },
30
30
  "author": "",
31
31
  "license": "AGPL-3.0-only",
32
32
  "dependencies": {
33
33
  "https-proxy-agent": "7.0.1",
34
- "tar": "^6.1.0"
34
+ "tar": "^6.2.1"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@types/chai": "4.3.11",