@signalapp/ringrtc 2.41.0 → 2.43.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.41.0
672
+ ## libsignal-core 0.1.0, mrp 2.43.0, partial-default-derive 0.1.0, regex-aot 0.1.0, ringrtc 2.43.0
673
673
 
674
674
  ```
675
675
  GNU AFFERO GENERAL PUBLIC LICENSE
@@ -96,7 +96,7 @@ export declare class RingRTCType {
96
96
  handleOutgoingSignaling: ((remoteUserId: UserId, message: CallingMessage) => Promise<boolean>) | null;
97
97
  handleIncomingCall: ((call: Call) => Promise<boolean>) | null;
98
98
  handleStartCall: ((call: Call) => Promise<boolean>) | null;
99
- handleAutoEndedIncomingCallRequest: ((callId: CallId, remoteUserId: UserId, reason: CallEndedReason, ageSec: number, wasVideoCall: boolean, receivedAtCounter: number | undefined) => void) | null;
99
+ handleAutoEndedIncomingCallRequest: ((callId: CallId, remoteUserId: UserId, reason: CallEndedReason, ageSec: number, wasVideoCall: boolean, receivedAtCounter: number | undefined, receivedAtDate: number | undefined) => void) | null;
100
100
  handleLogMessage: ((level: CallLogLevel, fileName: string, line: number, message: string) => void) | null;
101
101
  handleSendHttpRequest: ((requestId: number, url: string, method: HttpMethod, headers: {
102
102
  [name: string]: string;
@@ -104,6 +104,7 @@ export declare class RingRTCType {
104
104
  handleSendCallMessage: ((recipientUuid: Buffer, message: Buffer, urgency: CallMessageUrgency) => void) | null;
105
105
  handleSendCallMessageToGroup: ((groupId: Buffer, message: Buffer, urgency: CallMessageUrgency, overrideRecipients: Array<Buffer>) => void) | null;
106
106
  handleGroupCallRingUpdate: ((groupId: Buffer, ringId: bigint, sender: Buffer, update: RingUpdate) => void) | null;
107
+ handleRtcStatsReport: ((reportJson: string) => void) | null;
107
108
  constructor();
108
109
  setConfig(config: Config): void;
109
110
  setSelfUuid(uuid: Buffer): void;
@@ -243,11 +244,22 @@ export declare class RingRTCType {
243
244
  handleEmptyResponse(requestId: number, statusCode: number, state: EmptyObj | undefined): void;
244
245
  handleEnded(clientId: GroupCallClientId, reason: GroupCallEndReason): void;
245
246
  groupCallRingUpdate(groupId: GroupId, ringId: bigint, sender: GroupCallUserId, state: RingUpdate): void;
247
+ handleRtcStatsReportComplete(reportJson: string): void;
246
248
  onLogMessage(level: number, fileName: string, line: number, message: string): void;
247
249
  logError(message: string): void;
248
250
  logWarn(message: string): void;
249
251
  logInfo(message: string): void;
250
- handleCallingMessage(remoteUserId: UserId, remoteUuid: Buffer | null, remoteDeviceId: DeviceId, localDeviceId: DeviceId, messageAgeSec: number, messageReceivedAtCounter: number, message: CallingMessage, senderIdentityKey: Buffer, receiverIdentityKey: Buffer): void;
252
+ handleCallingMessage(message: CallingMessage, options: {
253
+ remoteUserId: UserId;
254
+ remoteUuid?: Buffer;
255
+ remoteDeviceId: DeviceId;
256
+ localDeviceId: DeviceId;
257
+ ageSec: number;
258
+ receivedAtCounter: number;
259
+ receivedAtDate: number;
260
+ senderIdentityKey: Buffer;
261
+ receiverIdentityKey: Buffer;
262
+ }): void;
251
263
  sendHttpRequest(requestId: number, url: string, method: HttpMethod, headers: {
252
264
  [name: string]: string;
253
265
  }, body: Buffer | undefined): void;
@@ -513,6 +525,7 @@ export declare class GroupCall {
513
525
  sendVideoFrame(width: number, height: number, format: VideoPixelFormatEnum, buffer: Buffer): void;
514
526
  getVideoSource(remoteDemuxId: number): GroupCallVideoFrameSource;
515
527
  setRemoteAspectRatio(remoteDemuxId: number, aspectRatio: number): void;
528
+ setRtcStatsInterval(intervalMillis: number): void;
516
529
  }
517
530
  declare class GroupCallVideoFrameSource {
518
531
  private readonly _callManager;
@@ -637,6 +650,7 @@ export interface CallManager {
637
650
  setGroupMembers(clientId: GroupCallClientId, members: Array<GroupMemberInfo>): void;
638
651
  setMembershipProof(clientId: GroupCallClientId, proof: Buffer): void;
639
652
  receiveGroupCallVideoFrame(clientId: GroupCallClientId, remoteDemuxId: number, buffer: Buffer, maxWidth: number, maxHeight: number): [number, number] | undefined;
653
+ setRtcStatsInterval(clientId: GroupCallClientId, intervalMillis: number): void;
640
654
  readCallLink(requestId: number, sfuUrl: string, authCredentialPresentation: Buffer, linkRootKey: Buffer): void;
641
655
  createCallLink(requestId: number, sfuUrl: string, createCredentialPresentation: Buffer, linkRootKey: Buffer, adminPasskey: Buffer, callLinkPublicParams: Buffer): void;
642
656
  updateCallLink(requestId: number, sfuUrl: string, authCredentialPresentation: Buffer, linkRootKey: Buffer, adminPasskey: Buffer, newName: string | undefined, newRestrictions: number | undefined, newRevoked: boolean | undefined): void;
@@ -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";
@@ -236,9 +238,10 @@ class Requests {
236
238
  }
237
239
  }
238
240
  class CallInfo {
239
- constructor(isVideoCall, receivedAtCounter) {
241
+ constructor(isVideoCall, receivedAtCounter, receivedAtDate) {
240
242
  this.isVideoCall = isVideoCall;
241
243
  this.receivedAtCounter = receivedAtCounter;
244
+ this.receivedAtDate = receivedAtDate;
242
245
  }
243
246
  }
244
247
  class RingRTCType {
@@ -260,6 +263,7 @@ class RingRTCType {
260
263
  this.handleSendCallMessage = null;
261
264
  this.handleSendCallMessageToGroup = null;
262
265
  this.handleGroupCallRingUpdate = null;
266
+ this.handleRtcStatsReport = null;
263
267
  this.callManager = new NativeCallManager(this);
264
268
  this._call = null;
265
269
  this._groupCallByClientId = new Map();
@@ -385,9 +389,10 @@ class RingRTCType {
385
389
  // Called by Rust
386
390
  onCallEnded(remoteUserId, callId, reason, ageSec) {
387
391
  const callInfo = this._callInfoByCallId.get(this.getCallInfoKey(callId));
388
- const { isVideoCall, receivedAtCounter } = callInfo || {
392
+ const { isVideoCall, receivedAtCounter, receivedAtDate } = callInfo || {
389
393
  isVideoCall: false,
390
394
  receivedAtCounter: undefined,
395
+ receivedAtDate: undefined,
391
396
  };
392
397
  this._callInfoByCallId.delete(this.getCallInfoKey(callId));
393
398
  const call = this._call;
@@ -416,7 +421,7 @@ class RingRTCType {
416
421
  reason === CallEndedReason.ReceivedOfferExpired ||
417
422
  (call.state === CallState.Prering && call.isIncoming)) {
418
423
  if (this.handleAutoEndedIncomingCallRequest) {
419
- this.handleAutoEndedIncomingCallRequest(callId, remoteUserId, reason, ageSec, isVideoCall, receivedAtCounter);
424
+ this.handleAutoEndedIncomingCallRequest(callId, remoteUserId, reason, ageSec, isVideoCall, receivedAtCounter, receivedAtDate);
420
425
  }
421
426
  if (call && call.state === CallState.Prering && call.isIncoming) {
422
427
  // Set the state to Ended without triggering a state update since we
@@ -933,6 +938,12 @@ class RingRTCType {
933
938
  });
934
939
  }
935
940
  // Called by Rust
941
+ handleRtcStatsReportComplete(reportJson) {
942
+ if (this.handleRtcStatsReport) {
943
+ this.handleRtcStatsReport(reportJson);
944
+ }
945
+ }
946
+ // Called by Rust
936
947
  onLogMessage(level, fileName, line, message) {
937
948
  if (this.handleLogMessage) {
938
949
  this.handleLogMessage(level, fileName, line, message);
@@ -951,9 +962,9 @@ class RingRTCType {
951
962
  this.onLogMessage(CallLogLevel.Info, 'Service.ts', 0, message);
952
963
  }
953
964
  // Called by MessageReceiver
954
- handleCallingMessage(remoteUserId, remoteUuid, remoteDeviceId, localDeviceId, messageAgeSec, messageReceivedAtCounter, message, senderIdentityKey, receiverIdentityKey) {
965
+ handleCallingMessage(message, options) {
955
966
  if (message.destinationDeviceId &&
956
- message.destinationDeviceId !== localDeviceId) {
967
+ message.destinationDeviceId !== options.localDeviceId) {
957
968
  // Drop the message as it isn't for this device, handleIgnoredCall() is not needed.
958
969
  return;
959
970
  }
@@ -968,9 +979,9 @@ class RingRTCType {
968
979
  }
969
980
  const offerType = message.offer.type || OfferType.AudioCall;
970
981
  // Save the call details for later when the call is ended.
971
- const callInfo = new CallInfo(offerType === OfferType.VideoCall, messageReceivedAtCounter);
982
+ const callInfo = new CallInfo(offerType === OfferType.VideoCall, options.receivedAtCounter, options.receivedAtDate);
972
983
  this._callInfoByCallId.set(this.getCallInfoKey(callId), callInfo);
973
- this.callManager.receivedOffer(remoteUserId, remoteDeviceId, localDeviceId, messageAgeSec, callId, offerType, opaque, senderIdentityKey, receiverIdentityKey);
984
+ this.callManager.receivedOffer(options.remoteUserId, options.remoteDeviceId, options.localDeviceId, options.ageSec, callId, offerType, opaque, options.senderIdentityKey, options.receiverIdentityKey);
974
985
  }
975
986
  if (message.answer?.callId) {
976
987
  const callId = message.answer.callId;
@@ -981,7 +992,7 @@ class RingRTCType {
981
992
  this.logError('handleCallingMessage(): opaque not received for answer, remote should update');
982
993
  return;
983
994
  }
984
- this.callManager.receivedAnswer(remoteUserId, remoteDeviceId, callId, opaque, senderIdentityKey, receiverIdentityKey);
995
+ this.callManager.receivedAnswer(options.remoteUserId, options.remoteDeviceId, callId, opaque, options.senderIdentityKey, options.receiverIdentityKey);
985
996
  }
986
997
  if (message.iceCandidates && message.iceCandidates.length > 0) {
987
998
  // We assume they all have the same .callId
@@ -1007,20 +1018,20 @@ class RingRTCType {
1007
1018
  this.logWarn('handleCallingMessage(): No call ID in ice message');
1008
1019
  return;
1009
1020
  }
1010
- this.callManager.receivedIceCandidates(remoteUserId, remoteDeviceId, callId, candidates);
1021
+ this.callManager.receivedIceCandidates(options.remoteUserId, options.remoteDeviceId, callId, candidates);
1011
1022
  }
1012
1023
  if (message.hangup?.callId) {
1013
1024
  const callId = message.hangup.callId;
1014
1025
  const hangupType = message.hangup.type || HangupType.Normal;
1015
1026
  const hangupDeviceId = message.hangup.deviceId || null;
1016
- this.callManager.receivedHangup(remoteUserId, remoteDeviceId, callId, hangupType, hangupDeviceId);
1027
+ this.callManager.receivedHangup(options.remoteUserId, options.remoteDeviceId, callId, hangupType, hangupDeviceId);
1017
1028
  }
1018
1029
  if (message.busy?.callId) {
1019
1030
  const callId = message.busy.callId;
1020
- this.callManager.receivedBusy(remoteUserId, remoteDeviceId, callId);
1031
+ this.callManager.receivedBusy(options.remoteUserId, options.remoteDeviceId, callId);
1021
1032
  }
1022
1033
  if (message.opaque) {
1023
- if (remoteUuid == null) {
1034
+ if (options.remoteUuid === undefined) {
1024
1035
  this.logError('handleCallingMessage(): opaque message received without UUID!');
1025
1036
  return;
1026
1037
  }
@@ -1029,7 +1040,7 @@ class RingRTCType {
1029
1040
  this.logError('handleCallingMessage(): opaque message received without data!');
1030
1041
  return;
1031
1042
  }
1032
- this.callManager.receivedCallMessage(remoteUuid, remoteDeviceId, localDeviceId, data, messageAgeSec);
1043
+ this.callManager.receivedCallMessage(options.remoteUuid, options.remoteDeviceId, options.localDeviceId, data, options.ageSec);
1033
1044
  }
1034
1045
  }
1035
1046
  // Called by Rust
@@ -1671,6 +1682,9 @@ class GroupCall {
1671
1682
  this._observer.onRemoteDeviceStatesChanged(this);
1672
1683
  }
1673
1684
  }
1685
+ setRtcStatsInterval(intervalMillis) {
1686
+ this._callManager.setRtcStatsInterval(this._clientId, intervalMillis);
1687
+ }
1674
1688
  }
1675
1689
  exports.GroupCall = GroupCall;
1676
1690
  // Implements VideoSource for use in CanvasVideoRenderer
@@ -42,8 +42,8 @@ export declare class GumVideoCapturer {
42
42
  constructor(defaultCaptureOptions: GumVideoCaptureOptions);
43
43
  capturing(): boolean;
44
44
  setLocalPreview(localPreview: Ref<HTMLVideoElement> | undefined): void;
45
- enableCapture(): void;
46
- enableCaptureAndSend(sender: VideoFrameSender, options?: GumVideoCaptureOptions): void;
45
+ enableCapture(): Promise<void>;
46
+ enableCaptureAndSend(sender?: VideoFrameSender, options?: GumVideoCaptureOptions): Promise<void>;
47
47
  disable(): void;
48
48
  setPreferredDevice(deviceId: string): Promise<void>;
49
49
  enumerateDevices(): Promise<Array<MediaDeviceInfo>>;
@@ -72,14 +72,16 @@ class GumVideoCapturer {
72
72
  }
73
73
  this.updateLocalPreviewIntervalId = setInterval(this.updateLocalPreviewSourceObject.bind(this), 1000);
74
74
  }
75
- enableCapture() {
76
- // eslint-disable-next-line @typescript-eslint/no-floating-promises
77
- this.startCapturing(this.defaultCaptureOptions);
75
+ async enableCapture() {
76
+ return this.startCapturing(this.defaultCaptureOptions);
78
77
  }
79
- enableCaptureAndSend(sender, options) {
80
- // eslint-disable-next-line @typescript-eslint/no-floating-promises
81
- this.startCapturing(options ?? this.defaultCaptureOptions);
82
- this.startSending(sender);
78
+ async enableCaptureAndSend(sender, options) {
79
+ const startCapturingPromise = this.startCapturing(options ?? this.defaultCaptureOptions);
80
+ if (sender) {
81
+ this.startSending(sender);
82
+ }
83
+ // Bubble up the error.
84
+ return startCapturingPromise;
83
85
  }
84
86
  disable() {
85
87
  this.stopCapturing();
@@ -95,11 +97,8 @@ class GumVideoCapturer {
95
97
  if (this.captureOptions) {
96
98
  const { captureOptions, sender } = this;
97
99
  this.disable();
98
- // eslint-disable-next-line @typescript-eslint/no-floating-promises
99
- this.startCapturing(captureOptions);
100
- if (sender) {
101
- this.startSending(sender);
102
- }
100
+ // Bubble up the error if starting video failed.
101
+ return this.enableCaptureAndSend(sender, captureOptions);
103
102
  }
104
103
  }
105
104
  async enumerateDevices() {
@@ -191,6 +190,8 @@ class GumVideoCapturer {
191
190
  // We couldn't open the camera. Oh well.
192
191
  this.captureOptions = undefined;
193
192
  }
193
+ // Re-raise so that callers can surface this condition to the user.
194
+ throw e;
194
195
  }
195
196
  }
196
197
  stopCapturing() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@signalapp/ringrtc",
3
- "version": "2.41.0",
3
+ "version": "2.43.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,7 +25,7 @@
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": "50e54adb31b0c40911e82c0192732323abe850b4990f4794ccc99a0a21bf85b4"
28
+ "prebuildChecksum": "391a681a172c7ebef3ee8fdf994273030cb5673b556bd5c6fb0f8f78416dbce6"
29
29
  },
30
30
  "author": "",
31
31
  "license": "AGPL-3.0-only",