@signalapp/ringrtc 2.24.0 → 2.25.1
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.
- package/dist/ringrtc/Service.d.ts +15 -16
- package/dist/ringrtc/Service.js +36 -22
- package/dist/ringrtc/VideoSupport.d.ts +11 -1
- package/dist/ringrtc/VideoSupport.js +1 -1
- package/dist/test/CallingClass.js +6 -6
- package/package.json +25 -25
|
@@ -4,8 +4,8 @@ declare class Config {
|
|
|
4
4
|
use_new_audio_device_module: boolean;
|
|
5
5
|
field_trials: Record<string, string> | undefined;
|
|
6
6
|
}
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
type GroupId = Buffer;
|
|
8
|
+
type GroupCallUserId = Buffer;
|
|
9
9
|
export declare class PeekDeviceInfo {
|
|
10
10
|
demuxId: number;
|
|
11
11
|
userId?: GroupCallUserId;
|
|
@@ -36,8 +36,8 @@ export declare class NetworkRoute {
|
|
|
36
36
|
localAdapterType: NetworkAdapterType;
|
|
37
37
|
constructor();
|
|
38
38
|
}
|
|
39
|
-
export
|
|
40
|
-
export
|
|
39
|
+
export type RawAudioLevel = number;
|
|
40
|
+
export type NormalizedAudioLevel = number;
|
|
41
41
|
export declare class ReceivedAudioLevel {
|
|
42
42
|
demuxId: number;
|
|
43
43
|
level: RawAudioLevel;
|
|
@@ -194,13 +194,13 @@ export declare class Call {
|
|
|
194
194
|
get remoteVideoEnabled(): boolean;
|
|
195
195
|
set remoteVideoEnabled(enabled: boolean);
|
|
196
196
|
sendVideoFrame(width: number, height: number, format: VideoPixelFormatEnum, buffer: Buffer): void;
|
|
197
|
-
receiveVideoFrame(buffer: Buffer): [number, number] | undefined;
|
|
197
|
+
receiveVideoFrame(buffer: Buffer, maxWidth: number, maxHeight: number): [number, number] | undefined;
|
|
198
198
|
private enableOrDisableCapturer;
|
|
199
199
|
private setOutgoingVideoEnabled;
|
|
200
200
|
updateBandwidthMode(bandwidthMode: BandwidthMode): void;
|
|
201
201
|
private enableOrDisableRenderer;
|
|
202
202
|
}
|
|
203
|
-
export
|
|
203
|
+
export type GroupCallClientId = number;
|
|
204
204
|
export declare enum ConnectionState {
|
|
205
205
|
NotConnected = 0,
|
|
206
206
|
Connecting = 1,
|
|
@@ -340,14 +340,14 @@ declare class GroupCallVideoFrameSource {
|
|
|
340
340
|
private readonly _groupCall;
|
|
341
341
|
private readonly _remoteDemuxId;
|
|
342
342
|
constructor(callManager: CallManager, groupCall: GroupCall, remoteDemuxId: number);
|
|
343
|
-
receiveVideoFrame(buffer: Buffer): [number, number] | undefined;
|
|
343
|
+
receiveVideoFrame(buffer: Buffer, maxWidth: number, maxHeight: number): [number, number] | undefined;
|
|
344
344
|
}
|
|
345
|
-
|
|
345
|
+
type ProtobufBuffer = Buffer | {
|
|
346
346
|
toArrayBuffer: () => ArrayBuffer;
|
|
347
347
|
};
|
|
348
|
-
export
|
|
349
|
-
export
|
|
350
|
-
export
|
|
348
|
+
export type UserId = string;
|
|
349
|
+
export type DeviceId = number;
|
|
350
|
+
export type CallId = any;
|
|
351
351
|
export declare class CallingMessage {
|
|
352
352
|
offer?: OfferMessage;
|
|
353
353
|
answer?: AnswerMessage;
|
|
@@ -400,9 +400,8 @@ export declare enum HangupType {
|
|
|
400
400
|
NeedPermission = 4
|
|
401
401
|
}
|
|
402
402
|
export declare enum BandwidthMode {
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
Normal = 2
|
|
403
|
+
Low = 0,
|
|
404
|
+
Normal = 1
|
|
406
405
|
}
|
|
407
406
|
export declare enum RingCancelReason {
|
|
408
407
|
DeclinedByUser = 0,
|
|
@@ -424,7 +423,7 @@ export interface CallManager {
|
|
|
424
423
|
setOutgoingVideoIsScreenShare(enabled: boolean): void;
|
|
425
424
|
updateBandwidthMode(bandwidthMode: BandwidthMode): void;
|
|
426
425
|
sendVideoFrame(width: number, height: number, format: VideoPixelFormatEnum, buffer: Buffer): void;
|
|
427
|
-
receiveVideoFrame(buffer: Buffer): [number, number] | undefined;
|
|
426
|
+
receiveVideoFrame(buffer: Buffer, maxWidth: number, maxHeight: number): [number, number] | undefined;
|
|
428
427
|
receivedOffer(remoteUserId: UserId, remoteDeviceId: DeviceId, messageAgeSec: number, callId: CallId, offerType: OfferType, localDeviceId: DeviceId, opaque: Buffer, senderIdentityKey: Buffer, receiverIdentityKey: Buffer): void;
|
|
429
428
|
receivedAnswer(remoteUserId: UserId, remoteDeviceId: DeviceId, callId: CallId, opaque: Buffer, senderIdentityKey: Buffer, receiverIdentityKey: Buffer): void;
|
|
430
429
|
receivedIceCandidates(remoteUserId: UserId, remoteDeviceId: DeviceId, callId: CallId, candidates: Array<Buffer>): void;
|
|
@@ -449,7 +448,7 @@ export interface CallManager {
|
|
|
449
448
|
requestVideo(clientId: GroupCallClientId, resolutions: Array<VideoRequest>, activeSpeakerHeight: number): void;
|
|
450
449
|
setGroupMembers(clientId: GroupCallClientId, members: Array<GroupMemberInfo>): void;
|
|
451
450
|
setMembershipProof(clientId: GroupCallClientId, proof: Buffer): void;
|
|
452
|
-
receiveGroupCallVideoFrame(clientId: GroupCallClientId, remoteDemuxId: number, buffer: Buffer): [number, number] | undefined;
|
|
451
|
+
receiveGroupCallVideoFrame(clientId: GroupCallClientId, remoteDemuxId: number, buffer: Buffer, maxWidth: number, maxHeight: number): [number, number] | undefined;
|
|
453
452
|
peekGroupCall(requestId: number, sfu_url: string, membership_proof: Buffer, group_members: Array<GroupMemberInfo>): Promise<PeekInfo>;
|
|
454
453
|
getAudioInputs(): AudioDevice[];
|
|
455
454
|
setAudioInput(index: number): void;
|
package/dist/ringrtc/Service.js
CHANGED
|
@@ -5,7 +5,11 @@
|
|
|
5
5
|
//
|
|
6
6
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
7
|
if (k2 === undefined) k2 = k;
|
|
8
|
-
Object.
|
|
8
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
9
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
10
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
11
|
+
}
|
|
12
|
+
Object.defineProperty(o, k2, desc);
|
|
9
13
|
}) : (function(o, m, k, k2) {
|
|
10
14
|
if (k2 === undefined) k2 = k;
|
|
11
15
|
o[k2] = m[k];
|
|
@@ -60,10 +64,21 @@ class NativeCallManager {
|
|
|
60
64
|
const fieldTrialsString = Object.entries(config.field_trials || {})
|
|
61
65
|
.map(([k, v]) => `${k}/${v}`)
|
|
62
66
|
.join('/') + '/';
|
|
63
|
-
const callEndpoint = Native.createCallEndpoint(this, config.use_new_audio_device_module, fieldTrialsString);
|
|
64
67
|
Object.defineProperty(this, Native.callEndpointPropertyKey, {
|
|
65
|
-
|
|
66
|
-
|
|
68
|
+
configurable: true,
|
|
69
|
+
get() {
|
|
70
|
+
const callEndpoint = Native.createCallEndpoint(this, config.use_new_audio_device_module, fieldTrialsString);
|
|
71
|
+
if (process.platform === 'darwin') {
|
|
72
|
+
// Preload devices to work around
|
|
73
|
+
// https://bugs.chromium.org/p/chromium/issues/detail?id=1287628
|
|
74
|
+
window.navigator.mediaDevices.enumerateDevices();
|
|
75
|
+
}
|
|
76
|
+
Object.defineProperty(this, Native.callEndpointPropertyKey, {
|
|
77
|
+
configurable: true,
|
|
78
|
+
value: callEndpoint,
|
|
79
|
+
});
|
|
80
|
+
return callEndpoint;
|
|
81
|
+
},
|
|
67
82
|
});
|
|
68
83
|
}
|
|
69
84
|
}
|
|
@@ -225,6 +240,10 @@ class CallInfo {
|
|
|
225
240
|
}
|
|
226
241
|
}
|
|
227
242
|
class RingRTCType {
|
|
243
|
+
getCallInfoKey(callId) {
|
|
244
|
+
// CallId is u64 so use a string key instead.
|
|
245
|
+
return callId.high.toString() + callId.low.toString();
|
|
246
|
+
}
|
|
228
247
|
constructor() {
|
|
229
248
|
// Set by UX
|
|
230
249
|
this.handleOutgoingSignaling = null;
|
|
@@ -242,10 +261,6 @@ class RingRTCType {
|
|
|
242
261
|
this._peekRequests = new Requests();
|
|
243
262
|
this._callInfoByCallId = new Map();
|
|
244
263
|
}
|
|
245
|
-
getCallInfoKey(callId) {
|
|
246
|
-
// CallId is u64 so use a string key instead.
|
|
247
|
-
return callId.high.toString() + callId.low.toString();
|
|
248
|
-
}
|
|
249
264
|
setConfig(config) {
|
|
250
265
|
this.callManager.setConfig(config);
|
|
251
266
|
}
|
|
@@ -1021,13 +1036,13 @@ class Call {
|
|
|
1021
1036
|
}
|
|
1022
1037
|
// With this method, a Call is a VideoFrameSender
|
|
1023
1038
|
sendVideoFrame(width, height, format, buffer) {
|
|
1024
|
-
// This assumes we only have one active
|
|
1039
|
+
// This assumes we only have one active call.
|
|
1025
1040
|
this._callManager.sendVideoFrame(width, height, format, buffer);
|
|
1026
1041
|
}
|
|
1027
1042
|
// With this method, a Call is a VideoFrameSource
|
|
1028
|
-
receiveVideoFrame(buffer) {
|
|
1029
|
-
// This assumes we only have one active
|
|
1030
|
-
return this._callManager.receiveVideoFrame(buffer);
|
|
1043
|
+
receiveVideoFrame(buffer, maxWidth, maxHeight) {
|
|
1044
|
+
// This assumes we only have one active call.
|
|
1045
|
+
return this._callManager.receiveVideoFrame(buffer, maxWidth, maxHeight);
|
|
1031
1046
|
}
|
|
1032
1047
|
enableOrDisableCapturer() {
|
|
1033
1048
|
if (!this._videoCapturer) {
|
|
@@ -1221,6 +1236,9 @@ class VideoRequest {
|
|
|
1221
1236
|
}
|
|
1222
1237
|
exports.VideoRequest = VideoRequest;
|
|
1223
1238
|
class GroupCall {
|
|
1239
|
+
get clientId() {
|
|
1240
|
+
return this._clientId;
|
|
1241
|
+
}
|
|
1224
1242
|
// Called by UI via RingRTC object
|
|
1225
1243
|
constructor(callManager, groupId, sfuUrl, hkdfExtraInfo, audioLevelsIntervalMillis, observer) {
|
|
1226
1244
|
this._callManager = callManager;
|
|
@@ -1228,9 +1246,6 @@ class GroupCall {
|
|
|
1228
1246
|
this._localDeviceState = new LocalDeviceState();
|
|
1229
1247
|
this._clientId = this._callManager.createGroupCallClient(groupId, sfuUrl, hkdfExtraInfo, audioLevelsIntervalMillis || 0);
|
|
1230
1248
|
}
|
|
1231
|
-
get clientId() {
|
|
1232
|
-
return this._clientId;
|
|
1233
|
-
}
|
|
1234
1249
|
// Called by UI
|
|
1235
1250
|
connect() {
|
|
1236
1251
|
this._callManager.connect(this._clientId);
|
|
@@ -1371,7 +1386,7 @@ class GroupCall {
|
|
|
1371
1386
|
}
|
|
1372
1387
|
// With this, a GroupCall is a VideoFrameSender
|
|
1373
1388
|
sendVideoFrame(width, height, format, buffer) {
|
|
1374
|
-
// This assumes we only have one active
|
|
1389
|
+
// This assumes we only have one active call.
|
|
1375
1390
|
this._callManager.sendVideoFrame(width, height, format, buffer);
|
|
1376
1391
|
}
|
|
1377
1392
|
// With this, a GroupCall can provide a VideoFrameSource for each remote device.
|
|
@@ -1397,9 +1412,9 @@ class GroupCallVideoFrameSource {
|
|
|
1397
1412
|
this._groupCall = groupCall;
|
|
1398
1413
|
this._remoteDemuxId = remoteDemuxId;
|
|
1399
1414
|
}
|
|
1400
|
-
receiveVideoFrame(buffer) {
|
|
1401
|
-
// This assumes we only have one active
|
|
1402
|
-
const frame = this._callManager.receiveGroupCallVideoFrame(this._groupCall.clientId, this._remoteDemuxId, buffer);
|
|
1415
|
+
receiveVideoFrame(buffer, maxWidth, maxHeight) {
|
|
1416
|
+
// This assumes we only have one active call.
|
|
1417
|
+
const frame = this._callManager.receiveGroupCallVideoFrame(this._groupCall.clientId, this._remoteDemuxId, buffer, maxWidth, maxHeight);
|
|
1403
1418
|
if (!!frame) {
|
|
1404
1419
|
const [width, height] = frame;
|
|
1405
1420
|
this._groupCall.setRemoteAspectRatio(this._remoteDemuxId, width / height);
|
|
@@ -1452,9 +1467,8 @@ var HangupType;
|
|
|
1452
1467
|
})(HangupType = exports.HangupType || (exports.HangupType = {}));
|
|
1453
1468
|
var BandwidthMode;
|
|
1454
1469
|
(function (BandwidthMode) {
|
|
1455
|
-
BandwidthMode[BandwidthMode["
|
|
1456
|
-
BandwidthMode[BandwidthMode["
|
|
1457
|
-
BandwidthMode[BandwidthMode["Normal"] = 2] = "Normal";
|
|
1470
|
+
BandwidthMode[BandwidthMode["Low"] = 0] = "Low";
|
|
1471
|
+
BandwidthMode[BandwidthMode["Normal"] = 1] = "Normal";
|
|
1458
1472
|
})(BandwidthMode = exports.BandwidthMode || (exports.BandwidthMode = {}));
|
|
1459
1473
|
/// Describes why a ring was cancelled.
|
|
1460
1474
|
var RingCancelReason;
|
|
@@ -8,7 +8,17 @@ export declare enum VideoPixelFormatEnum {
|
|
|
8
8
|
Rgba = 2
|
|
9
9
|
}
|
|
10
10
|
export interface VideoFrameSource {
|
|
11
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Copies the latest frame into `buffer`.
|
|
13
|
+
*
|
|
14
|
+
* Note that `maxWidth` and `maxHeight` specify maximum dimensions,
|
|
15
|
+
* but allow for rotation, i.e. a maximum of 1920x1080 will also allow
|
|
16
|
+
* portrait-mode 1080x1920.
|
|
17
|
+
*
|
|
18
|
+
* Returns a `[width, height]` pair for the resulting frame,
|
|
19
|
+
* or `undefined` if there's no new frame ready to be displayed.
|
|
20
|
+
*/
|
|
21
|
+
receiveVideoFrame(buffer: Buffer, maxWidth: number, maxHeight: number): [number, number] | undefined;
|
|
12
22
|
}
|
|
13
23
|
interface VideoFrameSender {
|
|
14
24
|
sendVideoFrame(width: number, height: number, format: VideoPixelFormatEnum, buffer: Buffer): void;
|
|
@@ -376,7 +376,7 @@ class CanvasVideoRenderer {
|
|
|
376
376
|
if (!context) {
|
|
377
377
|
return;
|
|
378
378
|
}
|
|
379
|
-
const frame = this.source.receiveVideoFrame(this.buffer);
|
|
379
|
+
const frame = this.source.receiveVideoFrame(this.buffer, exports.MAX_VIDEO_CAPTURE_WIDTH, exports.MAX_VIDEO_CAPTURE_HEIGHT);
|
|
380
380
|
if (!frame) {
|
|
381
381
|
return;
|
|
382
382
|
}
|
|
@@ -23,6 +23,12 @@ const long_1 = __importDefault(require("long"));
|
|
|
23
23
|
const Utils_1 = require("./Utils");
|
|
24
24
|
// This class mimics the Desktop Client CallingClass in ts/services/calling.ts to facilitate testing
|
|
25
25
|
class CallingClass {
|
|
26
|
+
set delayIncomingCallSettingsRequest(value) {
|
|
27
|
+
this._delayIncomingCallSettingsRequest = value;
|
|
28
|
+
}
|
|
29
|
+
set delayOutgoingCallSettingsRequest(value) {
|
|
30
|
+
this._delayIncomingCallSettingsRequest = value;
|
|
31
|
+
}
|
|
26
32
|
constructor(name, id) {
|
|
27
33
|
this._name = name;
|
|
28
34
|
this._id = id;
|
|
@@ -30,12 +36,6 @@ class CallingClass {
|
|
|
30
36
|
this._delayIncomingCallSettingsRequest = 0;
|
|
31
37
|
this._delayOutgoingCallSettingsRequest = 0;
|
|
32
38
|
}
|
|
33
|
-
set delayIncomingCallSettingsRequest(value) {
|
|
34
|
-
this._delayIncomingCallSettingsRequest = value;
|
|
35
|
-
}
|
|
36
|
-
set delayOutgoingCallSettingsRequest(value) {
|
|
37
|
-
this._delayIncomingCallSettingsRequest = value;
|
|
38
|
-
}
|
|
39
39
|
setupCallCallbacks(call) {
|
|
40
40
|
// eslint-disable-next-line no-param-reassign
|
|
41
41
|
call.handleStateChanged = () => __awaiter(this, void 0, void 0, function* () {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@signalapp/ringrtc",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.25.1",
|
|
4
4
|
"description": "Signal Messenger voice and video calling library.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"scripts": {
|
|
12
12
|
"build": "tsc",
|
|
13
13
|
"clean": "rimraf dist",
|
|
14
|
-
"test": "electron-mocha --recursive dist/test --timeout 10000",
|
|
14
|
+
"test": "electron-mocha --renderer --recursive dist/test --timeout 10000",
|
|
15
15
|
"eslint": "eslint --cache .",
|
|
16
16
|
"lint": "yarn format --list-different && yarn eslint",
|
|
17
17
|
"format": "prettier --write \"*.{css,js,json,md,scss,ts,tsx}\" \"./**/*.{css,js,json,md,scss,ts,tsx}\"",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
},
|
|
21
21
|
"config": {
|
|
22
22
|
"prebuildUrl": "https://build-artifacts.signal.org/libraries/ringrtc-desktop-build-v${npm_package_version}.tar.gz",
|
|
23
|
-
"prebuildChecksum": "
|
|
23
|
+
"prebuildChecksum": "eea4b238619ac1c259b703d7c66a57b6436ea63496fff03a0dd407b410507700"
|
|
24
24
|
},
|
|
25
25
|
"author": "",
|
|
26
26
|
"license": "AGPL-3.0-only",
|
|
@@ -28,33 +28,33 @@
|
|
|
28
28
|
"tar": "^6.1.0"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@types/chai": "4.
|
|
32
|
-
"@types/chai-as-promised": "^7.1.
|
|
33
|
-
"@types/dom-mediacapture-transform": "0.1.
|
|
34
|
-
"@types/long": "
|
|
35
|
-
"@types/mocha": "
|
|
36
|
-
"@types/node": "
|
|
37
|
-
"@types/offscreencanvas": "^2019.
|
|
38
|
-
"@types/react": "
|
|
31
|
+
"@types/chai": "4.3.4",
|
|
32
|
+
"@types/chai-as-promised": "^7.1.5",
|
|
33
|
+
"@types/dom-mediacapture-transform": "0.1.4",
|
|
34
|
+
"@types/long": "5.0.0",
|
|
35
|
+
"@types/mocha": "10.0.1",
|
|
36
|
+
"@types/node": "18.14.0",
|
|
37
|
+
"@types/offscreencanvas": "^2019.7.0",
|
|
38
|
+
"@types/react": "18.0.28",
|
|
39
39
|
"@types/sinon-chai": "^3.2.9",
|
|
40
|
-
"chai": "4.3.
|
|
40
|
+
"chai": "4.3.7",
|
|
41
41
|
"chai-as-promised": "^7.1.1",
|
|
42
|
-
"electron": "
|
|
42
|
+
"electron": "22.2.0",
|
|
43
43
|
"electron-mocha": "11.0.2",
|
|
44
|
-
"eslint": "
|
|
45
|
-
"eslint-config-airbnb-typescript-prettier": "
|
|
46
|
-
"eslint-config-prettier": "6.
|
|
47
|
-
"eslint-plugin-import": "2.
|
|
48
|
-
"eslint-plugin-mocha": "
|
|
44
|
+
"eslint": "8.34.0",
|
|
45
|
+
"eslint-config-airbnb-typescript-prettier": "5.0.0",
|
|
46
|
+
"eslint-config-prettier": "8.6.0",
|
|
47
|
+
"eslint-plugin-import": "2.27.5",
|
|
48
|
+
"eslint-plugin-mocha": "10.1.0",
|
|
49
49
|
"eslint-plugin-more": "1.0.5",
|
|
50
|
-
"eslint-plugin-react": "7.
|
|
51
|
-
"long": "
|
|
52
|
-
"mocha": "
|
|
53
|
-
"prettier": "^2.
|
|
54
|
-
"rimraf": "
|
|
50
|
+
"eslint-plugin-react": "7.32.2",
|
|
51
|
+
"long": "5.2.1",
|
|
52
|
+
"mocha": "10.2.0",
|
|
53
|
+
"prettier": "^2.8.4",
|
|
54
|
+
"rimraf": "4.1.2",
|
|
55
55
|
"sinon": "^15.0.1",
|
|
56
56
|
"sinon-chai": "^3.7.0",
|
|
57
|
-
"typescript": "4.
|
|
58
|
-
"yarn-audit-fix": "^9.
|
|
57
|
+
"typescript": "4.9.3",
|
|
58
|
+
"yarn-audit-fix": "^9.3.9"
|
|
59
59
|
}
|
|
60
60
|
}
|