@signalapp/ringrtc 2.31.2 → 2.32.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.
@@ -51,5 +51,5 @@ var CallLinkRestrictions;
51
51
  CallLinkRestrictions[CallLinkRestrictions["None"] = 0] = "None";
52
52
  CallLinkRestrictions[CallLinkRestrictions["AdminApproval"] = 1] = "AdminApproval";
53
53
  CallLinkRestrictions[CallLinkRestrictions["Unknown"] = 2] = "Unknown";
54
- })(CallLinkRestrictions = exports.CallLinkRestrictions || (exports.CallLinkRestrictions = {}));
54
+ })(CallLinkRestrictions || (exports.CallLinkRestrictions = CallLinkRestrictions = {}));
55
55
  //# sourceMappingURL=CallLinks.js.map
@@ -92,6 +92,7 @@ export declare class RingRTCType {
92
92
  onRemoteSharingScreen(remoteUserId: UserId, enabled: boolean): void;
93
93
  onNetworkRouteChanged(remoteUserId: UserId, localNetworkAdapterType: NetworkAdapterType): void;
94
94
  onAudioLevels(remoteUserId: UserId, capturedLevel: RawAudioLevel, receivedLevel: RawAudioLevel): void;
95
+ onLowBandwidthForVideo(remoteUserId: UserId, recovered: boolean): void;
95
96
  renderVideoFrame(width: number, height: number, buffer: Buffer): void;
96
97
  onSendOffer(remoteUserId: UserId, remoteDeviceId: DeviceId, callId: CallId, broadcast: boolean, offerType: OfferType, opaque: Buffer): void;
97
98
  onSendAnswer(remoteUserId: UserId, remoteDeviceId: DeviceId, callId: CallId, broadcast: boolean, opaque: Buffer): void;
@@ -207,6 +208,7 @@ export declare class RingRTCType {
207
208
  handleJoinStateChanged(clientId: GroupCallClientId, joinState: JoinState, demuxId: number | undefined): void;
208
209
  handleNetworkRouteChanged(clientId: GroupCallClientId, localNetworkAdapterType: NetworkAdapterType): void;
209
210
  handleAudioLevels(clientId: GroupCallClientId, capturedLevel: RawAudioLevel, receivedLevels: Array<ReceivedAudioLevel>): void;
211
+ handleLowBandwidthForVideo(clientId: GroupCallClientId, recovered: boolean): void;
210
212
  handleRemoteDevicesChanged(clientId: GroupCallClientId, remoteDeviceStates: Array<RemoteDeviceState>): void;
211
213
  handlePeekChanged(clientId: GroupCallClientId, info: PeekInfo): void;
212
214
  handlePeekResponse(requestId: number, statusCode: number, info: PeekInfo | undefined): void;
@@ -293,6 +295,16 @@ export declare class Call {
293
295
  handleRemoteSharingScreen?: () => void;
294
296
  handleNetworkRouteChanged?: () => void;
295
297
  handleAudioLevels?: () => void;
298
+ /**
299
+ * Notification of low upload bandwidth for sending video.
300
+ *
301
+ * When this is first called, recovered will be false. The second call (if
302
+ * any) will have recovered set to true and will be called when the upload
303
+ * bandwidth is high enough to send video.
304
+ *
305
+ * @param recovered - whether there is enough bandwidth to send video reliably
306
+ */
307
+ handleLowBandwidthForVideo?: (recovered: boolean) => void;
296
308
  renderVideoFrame?: (width: number, height: number, buffer: Buffer) => void;
297
309
  constructor(callManager: CallManager, remoteUserId: UserId, callId: CallId, isIncoming: boolean, isVideoCall: boolean, state: CallState);
298
310
  get remoteUserId(): UserId;
@@ -421,6 +433,7 @@ export interface GroupCallObserver {
421
433
  onLocalDeviceStateChanged(groupCall: GroupCall): void;
422
434
  onRemoteDeviceStatesChanged(groupCall: GroupCall): void;
423
435
  onAudioLevels(groupCall: GroupCall): void;
436
+ onLowBandwidthForVideo(groupCall: GroupCall, recovered: boolean): void;
424
437
  onPeekChanged(groupCall: GroupCall): void;
425
438
  onEnded(groupCall: GroupCall, reason: GroupCallEndReason): void;
426
439
  }
@@ -462,6 +475,7 @@ export declare class GroupCall {
462
475
  handleJoinStateChanged(joinState: JoinState, demuxId: number | undefined): void;
463
476
  handleNetworkRouteChanged(localNetworkAdapterType: NetworkAdapterType): void;
464
477
  handleAudioLevels(capturedLevel: RawAudioLevel, receivedLevels: Array<ReceivedAudioLevel>): void;
478
+ handleLowBandwidthForVideo(recovered: boolean): void;
465
479
  handleRemoteDevicesChanged(remoteDeviceStates: Array<RemoteDeviceState>): void;
466
480
  handlePeekChanged(info: PeekInfo): void;
467
481
  handleEnded(reason: GroupCallEndReason): void;
@@ -180,7 +180,7 @@ var PeekStatusCodes;
180
180
  (function (PeekStatusCodes) {
181
181
  PeekStatusCodes[PeekStatusCodes["EXPIRED_CALL_LINK"] = 703] = "EXPIRED_CALL_LINK";
182
182
  PeekStatusCodes[PeekStatusCodes["INVALID_CALL_LINK"] = 704] = "INVALID_CALL_LINK";
183
- })(PeekStatusCodes = exports.PeekStatusCodes || (exports.PeekStatusCodes = {}));
183
+ })(PeekStatusCodes || (exports.PeekStatusCodes = PeekStatusCodes = {}));
184
184
  // In sync with WebRTC's PeerConnection.AdapterType.
185
185
  // Despite how it looks, this is not an option set.
186
186
  // A network adapter type can only be one of the listed values.
@@ -482,6 +482,15 @@ class RingRTCType {
482
482
  call.handleAudioLevels();
483
483
  }
484
484
  }
485
+ onLowBandwidthForVideo(remoteUserId, recovered) {
486
+ const call = this._call;
487
+ if (!call || call.remoteUserId !== remoteUserId) {
488
+ return;
489
+ }
490
+ if (call.handleLowBandwidthForVideo) {
491
+ call.handleLowBandwidthForVideo(recovered);
492
+ }
493
+ }
485
494
  renderVideoFrame(width, height, buffer) {
486
495
  var _a, _b;
487
496
  const call = this._call;
@@ -815,6 +824,15 @@ class RingRTCType {
815
824
  });
816
825
  }
817
826
  // Called by Rust
827
+ handleLowBandwidthForVideo(clientId, recovered) {
828
+ sillyDeadlockProtection(() => {
829
+ const groupCall = this._groupCallByClientId.get(clientId);
830
+ if (groupCall) {
831
+ groupCall.handleLowBandwidthForVideo(recovered);
832
+ }
833
+ });
834
+ }
835
+ // Called by Rust
818
836
  handleRemoteDevicesChanged(clientId, remoteDeviceStates) {
819
837
  sillyDeadlockProtection(() => {
820
838
  const groupCall = this._groupCallByClientId.get(clientId);
@@ -1337,7 +1355,7 @@ var ConnectionState;
1337
1355
  ConnectionState[ConnectionState["Connecting"] = 1] = "Connecting";
1338
1356
  ConnectionState[ConnectionState["Connected"] = 2] = "Connected";
1339
1357
  ConnectionState[ConnectionState["Reconnecting"] = 3] = "Reconnecting";
1340
- })(ConnectionState = exports.ConnectionState || (exports.ConnectionState = {}));
1358
+ })(ConnectionState || (exports.ConnectionState = ConnectionState = {}));
1341
1359
  // Represents whether or not a user is joined to a group call and can exchange media.
1342
1360
  var JoinState;
1343
1361
  (function (JoinState) {
@@ -1345,7 +1363,7 @@ var JoinState;
1345
1363
  JoinState[JoinState["Joining"] = 1] = "Joining";
1346
1364
  JoinState[JoinState["Pending"] = 2] = "Pending";
1347
1365
  JoinState[JoinState["Joined"] = 3] = "Joined";
1348
- })(JoinState = exports.JoinState || (exports.JoinState = {}));
1366
+ })(JoinState || (exports.JoinState = JoinState = {}));
1349
1367
  // If not ended purposely by the user, gives the reason why a group call ended.
1350
1368
  var GroupCallEndReason;
1351
1369
  (function (GroupCallEndReason) {
@@ -1367,12 +1385,12 @@ var GroupCallEndReason;
1367
1385
  GroupCallEndReason[GroupCallEndReason["IceFailedAfterConnected"] = 13] = "IceFailedAfterConnected";
1368
1386
  GroupCallEndReason[GroupCallEndReason["ServerChangedDemuxId"] = 14] = "ServerChangedDemuxId";
1369
1387
  GroupCallEndReason[GroupCallEndReason["HasMaxDevices"] = 15] = "HasMaxDevices";
1370
- })(GroupCallEndReason = exports.GroupCallEndReason || (exports.GroupCallEndReason = {}));
1388
+ })(GroupCallEndReason || (exports.GroupCallEndReason = GroupCallEndReason = {}));
1371
1389
  var CallMessageUrgency;
1372
1390
  (function (CallMessageUrgency) {
1373
1391
  CallMessageUrgency[CallMessageUrgency["Droppable"] = 0] = "Droppable";
1374
1392
  CallMessageUrgency[CallMessageUrgency["HandleImmediately"] = 1] = "HandleImmediately";
1375
- })(CallMessageUrgency = exports.CallMessageUrgency || (exports.CallMessageUrgency = {}));
1393
+ })(CallMessageUrgency || (exports.CallMessageUrgency = CallMessageUrgency = {}));
1376
1394
  var RingUpdate;
1377
1395
  (function (RingUpdate) {
1378
1396
  /// The sender is trying to ring this user.
@@ -1389,7 +1407,7 @@ var RingUpdate;
1389
1407
  RingUpdate[RingUpdate["BusyOnAnotherDevice"] = 5] = "BusyOnAnotherDevice";
1390
1408
  /// The sender cancelled the ring request.
1391
1409
  RingUpdate[RingUpdate["CancelledByRinger"] = 6] = "CancelledByRinger";
1392
- })(RingUpdate = exports.RingUpdate || (exports.RingUpdate = {}));
1410
+ })(RingUpdate || (exports.RingUpdate = RingUpdate = {}));
1393
1411
  // HTTP request methods.
1394
1412
  var HttpMethod;
1395
1413
  (function (HttpMethod) {
@@ -1397,7 +1415,7 @@ var HttpMethod;
1397
1415
  HttpMethod[HttpMethod["Put"] = 1] = "Put";
1398
1416
  HttpMethod[HttpMethod["Post"] = 2] = "Post";
1399
1417
  HttpMethod[HttpMethod["Delete"] = 3] = "Delete";
1400
- })(HttpMethod = exports.HttpMethod || (exports.HttpMethod = {}));
1418
+ })(HttpMethod || (exports.HttpMethod = HttpMethod = {}));
1401
1419
  // The local device state for a group call.
1402
1420
  class LocalDeviceState {
1403
1421
  constructor() {
@@ -1447,7 +1465,7 @@ var GroupCallKind;
1447
1465
  (function (GroupCallKind) {
1448
1466
  GroupCallKind[GroupCallKind["SignalGroup"] = 0] = "SignalGroup";
1449
1467
  GroupCallKind[GroupCallKind["CallLink"] = 1] = "CallLink";
1450
- })(GroupCallKind = exports.GroupCallKind || (exports.GroupCallKind = {}));
1468
+ })(GroupCallKind || (exports.GroupCallKind = GroupCallKind = {}));
1451
1469
  class GroupCall {
1452
1470
  get clientId() {
1453
1471
  return this._clientId;
@@ -1596,6 +1614,9 @@ class GroupCall {
1596
1614
  }
1597
1615
  this._observer.onAudioLevels(this);
1598
1616
  }
1617
+ handleLowBandwidthForVideo(recovered) {
1618
+ this._observer.onLowBandwidthForVideo(this, recovered);
1619
+ }
1599
1620
  // Called by Rust via RingRTC object
1600
1621
  handleRemoteDevicesChanged(remoteDeviceStates) {
1601
1622
  var _a;
@@ -1679,7 +1700,7 @@ var OfferType;
1679
1700
  (function (OfferType) {
1680
1701
  OfferType[OfferType["AudioCall"] = 0] = "AudioCall";
1681
1702
  OfferType[OfferType["VideoCall"] = 1] = "VideoCall";
1682
- })(OfferType = exports.OfferType || (exports.OfferType = {}));
1703
+ })(OfferType || (exports.OfferType = OfferType = {}));
1683
1704
  class AnswerMessage {
1684
1705
  constructor(callId, opaque) {
1685
1706
  this.callId = callId;
@@ -1718,12 +1739,12 @@ var HangupType;
1718
1739
  HangupType[HangupType["Declined"] = 2] = "Declined";
1719
1740
  HangupType[HangupType["Busy"] = 3] = "Busy";
1720
1741
  HangupType[HangupType["NeedPermission"] = 4] = "NeedPermission";
1721
- })(HangupType = exports.HangupType || (exports.HangupType = {}));
1742
+ })(HangupType || (exports.HangupType = HangupType = {}));
1722
1743
  var DataMode;
1723
1744
  (function (DataMode) {
1724
1745
  DataMode[DataMode["Low"] = 0] = "Low";
1725
1746
  DataMode[DataMode["Normal"] = 1] = "Normal";
1726
- })(DataMode = exports.DataMode || (exports.DataMode = {}));
1747
+ })(DataMode || (exports.DataMode = DataMode = {}));
1727
1748
  /// Describes why a ring was cancelled.
1728
1749
  var RingCancelReason;
1729
1750
  (function (RingCancelReason) {
@@ -1731,7 +1752,7 @@ var RingCancelReason;
1731
1752
  RingCancelReason[RingCancelReason["DeclinedByUser"] = 0] = "DeclinedByUser";
1732
1753
  /// The device is busy with another call.
1733
1754
  RingCancelReason[RingCancelReason["Busy"] = 1] = "Busy";
1734
- })(RingCancelReason = exports.RingCancelReason || (exports.RingCancelReason = {}));
1755
+ })(RingCancelReason || (exports.RingCancelReason = RingCancelReason = {}));
1735
1756
  var CallState;
1736
1757
  (function (CallState) {
1737
1758
  CallState["Prering"] = "idle";
@@ -1739,7 +1760,7 @@ var CallState;
1739
1760
  CallState["Accepted"] = "connected";
1740
1761
  CallState["Reconnecting"] = "connecting";
1741
1762
  CallState["Ended"] = "ended";
1742
- })(CallState = exports.CallState || (exports.CallState = {}));
1763
+ })(CallState || (exports.CallState = CallState = {}));
1743
1764
  var CallEndedReason;
1744
1765
  (function (CallEndedReason) {
1745
1766
  CallEndedReason["LocalHangup"] = "LocalHangup";
@@ -1760,7 +1781,7 @@ var CallEndedReason;
1760
1781
  CallEndedReason["AcceptedOnAnotherDevice"] = "AcceptedOnAnotherDevice";
1761
1782
  CallEndedReason["DeclinedOnAnotherDevice"] = "DeclinedOnAnotherDevice";
1762
1783
  CallEndedReason["BusyOnAnotherDevice"] = "BusyOnAnotherDevice";
1763
- })(CallEndedReason = exports.CallEndedReason || (exports.CallEndedReason = {}));
1784
+ })(CallEndedReason || (exports.CallEndedReason = CallEndedReason = {}));
1764
1785
  var CallLogLevel;
1765
1786
  (function (CallLogLevel) {
1766
1787
  CallLogLevel[CallLogLevel["Off"] = 0] = "Off";
@@ -1769,7 +1790,7 @@ var CallLogLevel;
1769
1790
  CallLogLevel[CallLogLevel["Info"] = 3] = "Info";
1770
1791
  CallLogLevel[CallLogLevel["Debug"] = 4] = "Debug";
1771
1792
  CallLogLevel[CallLogLevel["Trace"] = 5] = "Trace";
1772
- })(CallLogLevel = exports.CallLogLevel || (exports.CallLogLevel = {}));
1793
+ })(CallLogLevel || (exports.CallLogLevel = CallLogLevel = {}));
1773
1794
  function sillyDeadlockProtection(f) {
1774
1795
  void (() => __awaiter(this, void 0, void 0, function* () {
1775
1796
  // This is a silly way of preventing a deadlock.
@@ -21,7 +21,7 @@ var VideoPixelFormatEnum;
21
21
  VideoPixelFormatEnum[VideoPixelFormatEnum["I420"] = 0] = "I420";
22
22
  VideoPixelFormatEnum[VideoPixelFormatEnum["Nv12"] = 1] = "Nv12";
23
23
  VideoPixelFormatEnum[VideoPixelFormatEnum["Rgba"] = 2] = "Rgba";
24
- })(VideoPixelFormatEnum = exports.VideoPixelFormatEnum || (exports.VideoPixelFormatEnum = {}));
24
+ })(VideoPixelFormatEnum || (exports.VideoPixelFormatEnum = VideoPixelFormatEnum = {}));
25
25
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
26
26
  function videoPixelFormatFromEnum(format) {
27
27
  switch (format) {
@@ -335,8 +335,8 @@ class GumVideoCapturer {
335
335
  exports.GumVideoCapturer = GumVideoCapturer;
336
336
  // We add 10% in each dimension to allow for things that are slightly wider or taller than 1080p.
337
337
  const MAX_VIDEO_CAPTURE_MULTIPLIER = 1.0;
338
- exports.MAX_VIDEO_CAPTURE_WIDTH = 1920 * MAX_VIDEO_CAPTURE_MULTIPLIER;
339
- exports.MAX_VIDEO_CAPTURE_HEIGHT = 1080 * MAX_VIDEO_CAPTURE_MULTIPLIER;
338
+ exports.MAX_VIDEO_CAPTURE_WIDTH = 2880 * MAX_VIDEO_CAPTURE_MULTIPLIER;
339
+ exports.MAX_VIDEO_CAPTURE_HEIGHT = 1800 * MAX_VIDEO_CAPTURE_MULTIPLIER;
340
340
  exports.MAX_VIDEO_CAPTURE_AREA = exports.MAX_VIDEO_CAPTURE_WIDTH * exports.MAX_VIDEO_CAPTURE_HEIGHT;
341
341
  exports.MAX_VIDEO_CAPTURE_BUFFER_SIZE = exports.MAX_VIDEO_CAPTURE_AREA * 4;
342
342
  class CanvasVideoRenderer {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@signalapp/ringrtc",
3
- "version": "2.31.2",
3
+ "version": "2.32.0",
4
4
  "description": "Signal Messenger voice and video calling library.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -9,13 +9,14 @@
9
9
  "dist/*.d.ts",
10
10
  "dist/ringrtc/*.js",
11
11
  "dist/ringrtc/*.d.ts",
12
+ "dist/acknowledgments.md",
12
13
  "scripts/fetch-prebuild.js"
13
14
  ],
14
15
  "scripts": {
15
16
  "build": "tsc",
16
17
  "clean": "rimraf dist",
17
18
  "test": "electron-mocha --renderer --recursive dist/test --timeout 10000 --require source-map-support/register",
18
- "eslint": "eslint --cache .",
19
+ "eslint": "eslint .",
19
20
  "lint": "yarn format --list-different && yarn eslint",
20
21
  "format": "prettier --write .",
21
22
  "install": "node scripts/fetch-prebuild.js",
@@ -23,40 +24,39 @@
23
24
  },
24
25
  "config": {
25
26
  "prebuildUrl": "https://build-artifacts.signal.org/libraries/ringrtc-desktop-build-v${npm_package_version}.tar.gz",
26
- "prebuildChecksum": "7af45efbec336ddd9a83a7b1820f8b4b9784ff427fb0791650292ad88d08c5b1"
27
+ "prebuildChecksum": "7800857e52b476b5ac886e79372a62148976f44e1f1f80fcf7f758da05b156fb"
27
28
  },
28
29
  "author": "",
29
30
  "license": "AGPL-3.0-only",
30
31
  "dependencies": {
31
- "tar": "^6.1.0"
32
+ "tar": "^6.2.0"
32
33
  },
33
34
  "devDependencies": {
34
- "@types/chai": "4.3.4",
35
+ "@types/chai": "4.3.6",
35
36
  "@types/chai-as-promised": "^7.1.5",
36
- "@types/dom-mediacapture-transform": "0.1.4",
37
- "@types/long": "5.0.0",
37
+ "@types/dom-mediacapture-transform": "0.1.6",
38
38
  "@types/mocha": "10.0.1",
39
- "@types/node": "18.14.0",
40
- "@types/offscreencanvas": "^2019.7.0",
39
+ "@types/node": "^18.15.0",
40
+ "@types/offscreencanvas": "^2019.7.1",
41
41
  "@types/sinon-chai": "^3.2.9",
42
42
  "chai": "4.3.7",
43
43
  "chai-as-promised": "^7.1.1",
44
- "electron": "22.2.0",
45
- "electron-mocha": "11.0.2",
46
- "eslint": "8.34.0",
44
+ "electron": "25.8.1",
45
+ "electron-mocha": "12.0.1",
46
+ "eslint": "8.49.0",
47
47
  "eslint-config-airbnb-typescript-prettier": "5.0.0",
48
- "eslint-config-prettier": "8.6.0",
49
- "eslint-plugin-import": "2.27.5",
48
+ "eslint-config-prettier": "8.8.0",
49
+ "eslint-plugin-import": "2.28.1",
50
50
  "eslint-plugin-mocha": "10.1.0",
51
51
  "eslint-plugin-more": "1.0.5",
52
- "long": "5.2.1",
52
+ "long": "5.2.3",
53
53
  "mocha": "10.2.0",
54
- "prettier": "^2.8.4",
55
- "rimraf": "4.1.2",
56
- "sinon": "^15.0.1",
54
+ "prettier": "^2.8.8",
55
+ "rimraf": "4.3.1",
56
+ "sinon": "^16.0.0",
57
57
  "sinon-chai": "^3.7.0",
58
- "source-map-support": "^0.5.19",
59
- "typescript": "4.9.3",
60
- "yarn-audit-fix": "^9.3.9"
58
+ "source-map-support": "^0.5.21",
59
+ "typescript": "5.2.2",
60
+ "yarn-audit-fix": "^10.0.1"
61
61
  }
62
62
  }