@signalapp/ringrtc 2.25.0 → 2.25.2
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/index.d.ts +1 -1
- package/dist/index.js +27 -27
- package/dist/ringrtc/Service.d.ts +16 -16
- package/dist/ringrtc/Service.js +90 -90
- package/dist/ringrtc/VideoSupport.d.ts +1 -1
- package/dist/ringrtc/VideoSupport.js +18 -12
- package/dist/test/CallingClass.js +35 -50
- package/dist/test/RingRTC-test.js +13 -8
- package/dist/test/Utils.d.ts +2 -2
- package/dist/test/Utils.js +3 -2
- package/package.json +24 -26
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
+
import { RingRTCType } from './ringrtc/Service';
|
|
1
2
|
export { AudioDevice, BandwidthMode, Call, CallEndedReason, CallId, CallLogLevel, CallMessageUrgency, CallSettings, CallState, CallingMessage, ConnectionState, DeviceId, GroupCall, GroupCallEndReason, GroupCallObserver, GroupMemberInfo, HangupMessage, HangupType, HttpMethod, JoinState, LocalDeviceState, OfferType, OpaqueMessage, PeekInfo, RemoteDeviceState, RingCancelReason, RingRTCType, RingUpdate, UserId, VideoCapturer, VideoRenderer, VideoRequest, } from './ringrtc/Service';
|
|
2
3
|
export { CanvasVideoRenderer, GumVideoCapturer, VideoFrameSource, MAX_VIDEO_CAPTURE_AREA, MAX_VIDEO_CAPTURE_BUFFER_SIZE, MAX_VIDEO_CAPTURE_HEIGHT, MAX_VIDEO_CAPTURE_WIDTH, } from './ringrtc/VideoSupport';
|
|
3
|
-
import { RingRTCType } from './ringrtc/Service';
|
|
4
4
|
export declare const RingRTC: RingRTCType;
|
package/dist/index.js
CHANGED
|
@@ -5,31 +5,32 @@
|
|
|
5
5
|
//
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.RingRTC = exports.MAX_VIDEO_CAPTURE_WIDTH = exports.MAX_VIDEO_CAPTURE_HEIGHT = exports.MAX_VIDEO_CAPTURE_BUFFER_SIZE = exports.MAX_VIDEO_CAPTURE_AREA = exports.GumVideoCapturer = exports.CanvasVideoRenderer = exports.VideoRequest = exports.RingUpdate = exports.RingRTCType = exports.RingCancelReason = exports.RemoteDeviceState = exports.PeekInfo = exports.OpaqueMessage = exports.OfferType = exports.LocalDeviceState = exports.JoinState = exports.HttpMethod = exports.HangupType = exports.HangupMessage = exports.GroupMemberInfo = exports.GroupCallEndReason = exports.GroupCall = exports.ConnectionState = exports.CallingMessage = exports.CallState = exports.CallMessageUrgency = exports.CallLogLevel = exports.CallEndedReason = exports.Call = exports.BandwidthMode = void 0;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
Object.defineProperty(exports, "
|
|
11
|
-
Object.defineProperty(exports, "
|
|
12
|
-
Object.defineProperty(exports, "
|
|
13
|
-
Object.defineProperty(exports, "
|
|
14
|
-
Object.defineProperty(exports, "
|
|
15
|
-
Object.defineProperty(exports, "
|
|
16
|
-
Object.defineProperty(exports, "
|
|
17
|
-
Object.defineProperty(exports, "
|
|
18
|
-
Object.defineProperty(exports, "
|
|
19
|
-
Object.defineProperty(exports, "
|
|
20
|
-
Object.defineProperty(exports, "
|
|
21
|
-
Object.defineProperty(exports, "
|
|
22
|
-
Object.defineProperty(exports, "
|
|
23
|
-
Object.defineProperty(exports, "
|
|
24
|
-
Object.defineProperty(exports, "
|
|
25
|
-
Object.defineProperty(exports, "
|
|
26
|
-
Object.defineProperty(exports, "
|
|
27
|
-
Object.defineProperty(exports, "
|
|
28
|
-
Object.defineProperty(exports, "
|
|
29
|
-
Object.defineProperty(exports, "
|
|
30
|
-
Object.defineProperty(exports, "
|
|
31
|
-
Object.defineProperty(exports, "
|
|
32
|
-
Object.defineProperty(exports, "
|
|
8
|
+
const Service_1 = require("./ringrtc/Service");
|
|
9
|
+
var Service_2 = require("./ringrtc/Service");
|
|
10
|
+
Object.defineProperty(exports, "BandwidthMode", { enumerable: true, get: function () { return Service_2.BandwidthMode; } });
|
|
11
|
+
Object.defineProperty(exports, "Call", { enumerable: true, get: function () { return Service_2.Call; } });
|
|
12
|
+
Object.defineProperty(exports, "CallEndedReason", { enumerable: true, get: function () { return Service_2.CallEndedReason; } });
|
|
13
|
+
Object.defineProperty(exports, "CallLogLevel", { enumerable: true, get: function () { return Service_2.CallLogLevel; } });
|
|
14
|
+
Object.defineProperty(exports, "CallMessageUrgency", { enumerable: true, get: function () { return Service_2.CallMessageUrgency; } });
|
|
15
|
+
Object.defineProperty(exports, "CallState", { enumerable: true, get: function () { return Service_2.CallState; } });
|
|
16
|
+
Object.defineProperty(exports, "CallingMessage", { enumerable: true, get: function () { return Service_2.CallingMessage; } });
|
|
17
|
+
Object.defineProperty(exports, "ConnectionState", { enumerable: true, get: function () { return Service_2.ConnectionState; } });
|
|
18
|
+
Object.defineProperty(exports, "GroupCall", { enumerable: true, get: function () { return Service_2.GroupCall; } });
|
|
19
|
+
Object.defineProperty(exports, "GroupCallEndReason", { enumerable: true, get: function () { return Service_2.GroupCallEndReason; } });
|
|
20
|
+
Object.defineProperty(exports, "GroupMemberInfo", { enumerable: true, get: function () { return Service_2.GroupMemberInfo; } });
|
|
21
|
+
Object.defineProperty(exports, "HangupMessage", { enumerable: true, get: function () { return Service_2.HangupMessage; } });
|
|
22
|
+
Object.defineProperty(exports, "HangupType", { enumerable: true, get: function () { return Service_2.HangupType; } });
|
|
23
|
+
Object.defineProperty(exports, "HttpMethod", { enumerable: true, get: function () { return Service_2.HttpMethod; } });
|
|
24
|
+
Object.defineProperty(exports, "JoinState", { enumerable: true, get: function () { return Service_2.JoinState; } });
|
|
25
|
+
Object.defineProperty(exports, "LocalDeviceState", { enumerable: true, get: function () { return Service_2.LocalDeviceState; } });
|
|
26
|
+
Object.defineProperty(exports, "OfferType", { enumerable: true, get: function () { return Service_2.OfferType; } });
|
|
27
|
+
Object.defineProperty(exports, "OpaqueMessage", { enumerable: true, get: function () { return Service_2.OpaqueMessage; } });
|
|
28
|
+
Object.defineProperty(exports, "PeekInfo", { enumerable: true, get: function () { return Service_2.PeekInfo; } });
|
|
29
|
+
Object.defineProperty(exports, "RemoteDeviceState", { enumerable: true, get: function () { return Service_2.RemoteDeviceState; } });
|
|
30
|
+
Object.defineProperty(exports, "RingCancelReason", { enumerable: true, get: function () { return Service_2.RingCancelReason; } });
|
|
31
|
+
Object.defineProperty(exports, "RingRTCType", { enumerable: true, get: function () { return Service_2.RingRTCType; } });
|
|
32
|
+
Object.defineProperty(exports, "RingUpdate", { enumerable: true, get: function () { return Service_2.RingUpdate; } });
|
|
33
|
+
Object.defineProperty(exports, "VideoRequest", { enumerable: true, get: function () { return Service_2.VideoRequest; } });
|
|
33
34
|
var VideoSupport_1 = require("./ringrtc/VideoSupport");
|
|
34
35
|
Object.defineProperty(exports, "CanvasVideoRenderer", { enumerable: true, get: function () { return VideoSupport_1.CanvasVideoRenderer; } });
|
|
35
36
|
Object.defineProperty(exports, "GumVideoCapturer", { enumerable: true, get: function () { return VideoSupport_1.GumVideoCapturer; } });
|
|
@@ -37,5 +38,4 @@ Object.defineProperty(exports, "MAX_VIDEO_CAPTURE_AREA", { enumerable: true, get
|
|
|
37
38
|
Object.defineProperty(exports, "MAX_VIDEO_CAPTURE_BUFFER_SIZE", { enumerable: true, get: function () { return VideoSupport_1.MAX_VIDEO_CAPTURE_BUFFER_SIZE; } });
|
|
38
39
|
Object.defineProperty(exports, "MAX_VIDEO_CAPTURE_HEIGHT", { enumerable: true, get: function () { return VideoSupport_1.MAX_VIDEO_CAPTURE_HEIGHT; } });
|
|
39
40
|
Object.defineProperty(exports, "MAX_VIDEO_CAPTURE_WIDTH", { enumerable: true, get: function () { return VideoSupport_1.MAX_VIDEO_CAPTURE_WIDTH; } });
|
|
40
|
-
|
|
41
|
-
exports.RingRTC = new Service_2.RingRTCType();
|
|
41
|
+
exports.RingRTC = new Service_1.RingRTCType();
|
|
@@ -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;
|
|
@@ -94,7 +94,7 @@ export declare class RingRTCType {
|
|
|
94
94
|
handleAudioLevels(clientId: GroupCallClientId, capturedLevel: RawAudioLevel, receivedLevels: Array<ReceivedAudioLevel>): void;
|
|
95
95
|
handleRemoteDevicesChanged(clientId: GroupCallClientId, remoteDeviceStates: Array<RemoteDeviceState>): void;
|
|
96
96
|
handlePeekChanged(clientId: GroupCallClientId, info: PeekInfo): void;
|
|
97
|
-
handlePeekResponse(
|
|
97
|
+
handlePeekResponse(requestId: number, info: PeekInfo): void;
|
|
98
98
|
handleEnded(clientId: GroupCallClientId, reason: GroupCallEndReason): void;
|
|
99
99
|
groupCallRingUpdate(groupId: GroupId, ringIdString: string, sender: GroupCallUserId, state: RingUpdate): void;
|
|
100
100
|
onLogMessage(level: number, fileName: string, line: number, message: string): void;
|
|
@@ -118,9 +118,9 @@ export declare class RingRTCType {
|
|
|
118
118
|
setOutgoingVideoIsScreenShare(callId: CallId, isScreenShare: boolean): void;
|
|
119
119
|
setVideoCapturer(callId: CallId, capturer: VideoCapturer | null): void;
|
|
120
120
|
setVideoRenderer(callId: CallId, renderer: VideoRenderer | null): void;
|
|
121
|
-
getAudioInputs(): AudioDevice
|
|
121
|
+
getAudioInputs(): Array<AudioDevice>;
|
|
122
122
|
setAudioInput(index: number): void;
|
|
123
|
-
getAudioOutputs(): AudioDevice
|
|
123
|
+
getAudioOutputs(): Array<AudioDevice>;
|
|
124
124
|
setAudioOutput(index: number): void;
|
|
125
125
|
}
|
|
126
126
|
export interface CallSettings {
|
|
@@ -200,7 +200,7 @@ export declare class Call {
|
|
|
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,
|
|
@@ -342,12 +342,12 @@ declare class GroupCallVideoFrameSource {
|
|
|
342
342
|
constructor(callManager: CallManager, groupCall: GroupCall, remoteDemuxId: number);
|
|
343
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;
|
|
@@ -449,10 +449,10 @@ export interface CallManager {
|
|
|
449
449
|
setGroupMembers(clientId: GroupCallClientId, members: Array<GroupMemberInfo>): void;
|
|
450
450
|
setMembershipProof(clientId: GroupCallClientId, proof: Buffer): void;
|
|
451
451
|
receiveGroupCallVideoFrame(clientId: GroupCallClientId, remoteDemuxId: number, buffer: Buffer, maxWidth: number, maxHeight: number): [number, number] | undefined;
|
|
452
|
-
peekGroupCall(requestId: number, sfu_url: string, membership_proof: Buffer, group_members: Array<GroupMemberInfo>):
|
|
453
|
-
getAudioInputs(): AudioDevice
|
|
452
|
+
peekGroupCall(requestId: number, sfu_url: string, membership_proof: Buffer, group_members: Array<GroupMemberInfo>): void;
|
|
453
|
+
getAudioInputs(): Array<AudioDevice>;
|
|
454
454
|
setAudioInput(index: number): void;
|
|
455
|
-
getAudioOutputs(): AudioDevice
|
|
455
|
+
getAudioOutputs(): Array<AudioDevice>;
|
|
456
456
|
setAudioOutput(index: number): void;
|
|
457
457
|
}
|
|
458
458
|
export interface CallManagerCallbacks {
|
|
@@ -478,7 +478,7 @@ export interface CallManagerCallbacks {
|
|
|
478
478
|
handleJoinStateChanged(clientId: GroupCallClientId, joinState: JoinState, demuxId: number | undefined): void;
|
|
479
479
|
handleRemoteDevicesChanged(clientId: GroupCallClientId, remoteDeviceStates: Array<RemoteDeviceState>): void;
|
|
480
480
|
handlePeekChanged(clientId: GroupCallClientId, info: PeekInfo): void;
|
|
481
|
-
handlePeekResponse(
|
|
481
|
+
handlePeekResponse(requestId: number, info: PeekInfo): void;
|
|
482
482
|
handleEnded(clientId: GroupCallClientId, reason: GroupCallEndReason): void;
|
|
483
483
|
onLogMessage(level: number, fileName: string, line: number, message: string): void;
|
|
484
484
|
}
|
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];
|
|
@@ -33,21 +37,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
33
37
|
};
|
|
34
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
39
|
exports.CallLogLevel = exports.CallEndedReason = exports.CallState = exports.RingCancelReason = exports.BandwidthMode = exports.HangupType = exports.OpaqueMessage = exports.HangupMessage = exports.BusyMessage = exports.IceCandidateMessage = exports.AnswerMessage = exports.OfferType = exports.OfferMessage = exports.CallingMessage = exports.GroupCall = exports.VideoRequest = exports.GroupMemberInfo = exports.RemoteDeviceState = exports.LocalDeviceState = exports.HttpMethod = exports.RingUpdate = exports.CallMessageUrgency = exports.GroupCallEndReason = exports.JoinState = exports.ConnectionState = exports.Call = exports.RingRTCType = exports.ReceivedAudioLevel = exports.NetworkRoute = exports.PeekInfo = exports.PeekDeviceInfo = void 0;
|
|
36
|
-
/*
|
|
40
|
+
/* eslint-disable max-classes-per-file */
|
|
37
41
|
const os = __importStar(require("os"));
|
|
38
42
|
const process = __importStar(require("process"));
|
|
39
|
-
//
|
|
40
|
-
const Native = require(
|
|
41
|
-
os.platform() +
|
|
42
|
-
'/libringrtc-' +
|
|
43
|
-
process.arch +
|
|
44
|
-
'.node');
|
|
43
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires, import/no-dynamic-require
|
|
44
|
+
const Native = require(`../../build/${os.platform()}/libringrtc-${process.arch}.node`);
|
|
45
45
|
class Config {
|
|
46
46
|
constructor() {
|
|
47
47
|
this.use_new_audio_device_module = false;
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
|
-
// tslint:disable-next-line no-unnecessary-class
|
|
51
50
|
class NativeCallManager {
|
|
52
51
|
constructor(observer) {
|
|
53
52
|
this.observer = observer;
|
|
@@ -57,17 +56,25 @@ class NativeCallManager {
|
|
|
57
56
|
this.createCallEndpoint(config);
|
|
58
57
|
}
|
|
59
58
|
createCallEndpoint(config) {
|
|
59
|
+
/* eslint-disable prefer-template */
|
|
60
60
|
const fieldTrialsString = Object.entries(config.field_trials || {})
|
|
61
61
|
.map(([k, v]) => `${k}/${v}`)
|
|
62
62
|
.join('/') + '/';
|
|
63
|
+
/* eslint-enable prefer-template */
|
|
63
64
|
Object.defineProperty(this, Native.callEndpointPropertyKey, {
|
|
64
65
|
configurable: true,
|
|
65
66
|
get() {
|
|
66
67
|
const callEndpoint = Native.createCallEndpoint(this, config.use_new_audio_device_module, fieldTrialsString);
|
|
68
|
+
if (process.platform === 'darwin') {
|
|
69
|
+
// Preload devices to work around
|
|
70
|
+
// https://bugs.chromium.org/p/chromium/issues/detail?id=1287628
|
|
71
|
+
void window.navigator.mediaDevices.enumerateDevices();
|
|
72
|
+
}
|
|
67
73
|
Object.defineProperty(this, Native.callEndpointPropertyKey, {
|
|
68
74
|
configurable: true,
|
|
69
75
|
value: callEndpoint,
|
|
70
76
|
});
|
|
77
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
71
78
|
return callEndpoint;
|
|
72
79
|
},
|
|
73
80
|
});
|
|
@@ -231,6 +238,10 @@ class CallInfo {
|
|
|
231
238
|
}
|
|
232
239
|
}
|
|
233
240
|
class RingRTCType {
|
|
241
|
+
getCallInfoKey(callId) {
|
|
242
|
+
// CallId is u64 so use a string key instead.
|
|
243
|
+
return `${callId.high}${callId.low}`;
|
|
244
|
+
}
|
|
234
245
|
constructor() {
|
|
235
246
|
// Set by UX
|
|
236
247
|
this.handleOutgoingSignaling = null;
|
|
@@ -248,10 +259,6 @@ class RingRTCType {
|
|
|
248
259
|
this._peekRequests = new Requests();
|
|
249
260
|
this._callInfoByCallId = new Map();
|
|
250
261
|
}
|
|
251
|
-
getCallInfoKey(callId) {
|
|
252
|
-
// CallId is u64 so use a string key instead.
|
|
253
|
-
return callId.high.toString() + callId.low.toString();
|
|
254
|
-
}
|
|
255
262
|
setConfig(config) {
|
|
256
263
|
this.callManager.setConfig(config);
|
|
257
264
|
}
|
|
@@ -272,7 +279,7 @@ class RingRTCType {
|
|
|
272
279
|
}
|
|
273
280
|
// Called by UX
|
|
274
281
|
cancelGroupRing(groupId, ringId, reason) {
|
|
275
|
-
|
|
282
|
+
sillyDeadlockProtection(() => {
|
|
276
283
|
this.callManager.cancelGroupRing(groupId, ringId.toString(), reason);
|
|
277
284
|
});
|
|
278
285
|
}
|
|
@@ -296,7 +303,7 @@ class RingRTCType {
|
|
|
296
303
|
}
|
|
297
304
|
})
|
|
298
305
|
.catch(e => {
|
|
299
|
-
this.logError(
|
|
306
|
+
this.logError(`RingRTC.handleStartCall exception: ${e}`);
|
|
300
307
|
call.ignore();
|
|
301
308
|
});
|
|
302
309
|
}
|
|
@@ -322,8 +329,7 @@ class RingRTCType {
|
|
|
322
329
|
}
|
|
323
330
|
const isIncoming = true;
|
|
324
331
|
const call = new Call(this.callManager, remoteUserId, callId, isIncoming, isVideoCall, CallState.Prering);
|
|
325
|
-
const handleIncomingCall = this
|
|
326
|
-
const handleStartCall = this.handleStartCall;
|
|
332
|
+
const { handleIncomingCall, handleStartCall } = this;
|
|
327
333
|
if (!handleIncomingCall || !handleStartCall) {
|
|
328
334
|
call.ignore();
|
|
329
335
|
return;
|
|
@@ -337,25 +343,25 @@ class RingRTCType {
|
|
|
337
343
|
}
|
|
338
344
|
else {
|
|
339
345
|
handleStartCall(call)
|
|
340
|
-
.then(
|
|
341
|
-
if (!
|
|
346
|
+
.then(innerSuccess => {
|
|
347
|
+
if (!innerSuccess) {
|
|
342
348
|
this.logWarn('RingRTC.handleStartCall failed for incoming call. Call ignored.');
|
|
343
349
|
call.ignore();
|
|
344
350
|
}
|
|
345
351
|
})
|
|
346
352
|
.catch(e => {
|
|
347
|
-
this.logError(
|
|
353
|
+
this.logError(`RingRTC.handleStartCall exception: ${e}`);
|
|
348
354
|
call.ignore();
|
|
349
355
|
});
|
|
350
356
|
}
|
|
351
357
|
})
|
|
352
358
|
.catch(e => {
|
|
353
|
-
this.logError(
|
|
359
|
+
this.logError(`RingRTC.handleIncomingCall exception: ${e}`);
|
|
354
360
|
call.ignore();
|
|
355
361
|
});
|
|
356
362
|
}
|
|
357
363
|
proceed(callId, settings) {
|
|
358
|
-
|
|
364
|
+
sillyDeadlockProtection(() => {
|
|
359
365
|
this.callManager.proceed(callId, settings.iceServer.username || '', settings.iceServer.password || '', settings.iceServer.urls, settings.hideIp, settings.bandwidthMode, settings.audioLevelsIntervalMillis || 0);
|
|
360
366
|
});
|
|
361
367
|
}
|
|
@@ -369,7 +375,7 @@ class RingRTCType {
|
|
|
369
375
|
}
|
|
370
376
|
// Called by Rust
|
|
371
377
|
onCallEnded(remoteUserId, callId, reason, ageSec) {
|
|
372
|
-
|
|
378
|
+
const callInfo = this._callInfoByCallId.get(this.getCallInfoKey(callId));
|
|
373
379
|
const { isVideoCall, receivedAtCounter } = callInfo || {
|
|
374
380
|
isVideoCall: false,
|
|
375
381
|
receivedAtCounter: undefined,
|
|
@@ -463,7 +469,7 @@ class RingRTCType {
|
|
|
463
469
|
if (!call) {
|
|
464
470
|
return;
|
|
465
471
|
}
|
|
466
|
-
if (
|
|
472
|
+
if ((_a = this._call) === null || _a === void 0 ? void 0 : _a.renderVideoFrame) {
|
|
467
473
|
(_b = this._call) === null || _b === void 0 ? void 0 : _b.renderVideoFrame(width, height, buffer);
|
|
468
474
|
}
|
|
469
475
|
}
|
|
@@ -513,10 +519,12 @@ class RingRTCType {
|
|
|
513
519
|
this.sendSignaling(remoteUserId, remoteDeviceId, callId, broadcast, message);
|
|
514
520
|
}
|
|
515
521
|
sendSignaling(remoteUserId, remoteDeviceId, callId, broadcast, message) {
|
|
522
|
+
/* eslint-disable no-param-reassign */
|
|
516
523
|
message.supportsMultiRing = true;
|
|
517
524
|
if (!broadcast) {
|
|
518
525
|
message.destinationDeviceId = remoteDeviceId;
|
|
519
526
|
}
|
|
527
|
+
/* eslint-enable no-param-reassign */
|
|
520
528
|
(() => __awaiter(this, void 0, void 0, function* () {
|
|
521
529
|
if (this.handleOutgoingSignaling) {
|
|
522
530
|
const signalingResult = yield this.handleOutgoingSignaling(remoteUserId, message);
|
|
@@ -530,10 +538,10 @@ class RingRTCType {
|
|
|
530
538
|
else {
|
|
531
539
|
this.callManager.signalingMessageSendFailed(callId);
|
|
532
540
|
}
|
|
533
|
-
}))();
|
|
541
|
+
}))().catch(e => this.logError(e.toString()));
|
|
534
542
|
}
|
|
535
543
|
receivedHttpResponse(requestId, status, body) {
|
|
536
|
-
|
|
544
|
+
sillyDeadlockProtection(() => {
|
|
537
545
|
try {
|
|
538
546
|
this.callManager.receivedHttpResponse(requestId, status, body);
|
|
539
547
|
}
|
|
@@ -544,7 +552,7 @@ class RingRTCType {
|
|
|
544
552
|
});
|
|
545
553
|
}
|
|
546
554
|
httpRequestFailed(requestId, debugInfo) {
|
|
547
|
-
|
|
555
|
+
sillyDeadlockProtection(() => {
|
|
548
556
|
try {
|
|
549
557
|
this.callManager.httpRequestFailed(requestId, debugInfo);
|
|
550
558
|
}
|
|
@@ -564,19 +572,18 @@ class RingRTCType {
|
|
|
564
572
|
// Called by UX
|
|
565
573
|
// Returns a list of user IDs
|
|
566
574
|
peekGroupCall(sfuUrl, membershipProof, groupMembers) {
|
|
567
|
-
|
|
575
|
+
const [requestId, promise] = this._peekRequests.add();
|
|
568
576
|
// Response comes back via handlePeekResponse
|
|
569
|
-
|
|
577
|
+
sillyDeadlockProtection(() => {
|
|
570
578
|
this.callManager.peekGroupCall(requestId, sfuUrl, membershipProof, groupMembers);
|
|
571
579
|
});
|
|
572
580
|
return promise;
|
|
573
581
|
}
|
|
574
582
|
// Called by Rust
|
|
575
583
|
requestMembershipProof(clientId) {
|
|
576
|
-
|
|
577
|
-
|
|
584
|
+
sillyDeadlockProtection(() => {
|
|
585
|
+
const groupCall = this._groupCallByClientId.get(clientId);
|
|
578
586
|
if (!groupCall) {
|
|
579
|
-
let error = new Error();
|
|
580
587
|
this.logError('requestMembershipProof(): GroupCall not found in map!');
|
|
581
588
|
return;
|
|
582
589
|
}
|
|
@@ -585,10 +592,9 @@ class RingRTCType {
|
|
|
585
592
|
}
|
|
586
593
|
// Called by Rust
|
|
587
594
|
requestGroupMembers(clientId) {
|
|
588
|
-
|
|
589
|
-
|
|
595
|
+
sillyDeadlockProtection(() => {
|
|
596
|
+
const groupCall = this._groupCallByClientId.get(clientId);
|
|
590
597
|
if (!groupCall) {
|
|
591
|
-
let error = new Error();
|
|
592
598
|
this.logError('requestGroupMembers(): GroupCall not found in map!');
|
|
593
599
|
return;
|
|
594
600
|
}
|
|
@@ -597,10 +603,9 @@ class RingRTCType {
|
|
|
597
603
|
}
|
|
598
604
|
// Called by Rust
|
|
599
605
|
handleConnectionStateChanged(clientId, connectionState) {
|
|
600
|
-
|
|
601
|
-
|
|
606
|
+
sillyDeadlockProtection(() => {
|
|
607
|
+
const groupCall = this._groupCallByClientId.get(clientId);
|
|
602
608
|
if (!groupCall) {
|
|
603
|
-
let error = new Error();
|
|
604
609
|
this.logError('handleConnectionStateChanged(): GroupCall not found in map!');
|
|
605
610
|
return;
|
|
606
611
|
}
|
|
@@ -609,10 +614,9 @@ class RingRTCType {
|
|
|
609
614
|
}
|
|
610
615
|
// Called by Rust
|
|
611
616
|
handleJoinStateChanged(clientId, joinState, demuxId) {
|
|
612
|
-
|
|
613
|
-
|
|
617
|
+
sillyDeadlockProtection(() => {
|
|
618
|
+
const groupCall = this._groupCallByClientId.get(clientId);
|
|
614
619
|
if (!groupCall) {
|
|
615
|
-
let error = new Error();
|
|
616
620
|
this.logError('handleJoinStateChanged(): GroupCall not found in map!');
|
|
617
621
|
return;
|
|
618
622
|
}
|
|
@@ -621,8 +625,8 @@ class RingRTCType {
|
|
|
621
625
|
}
|
|
622
626
|
// Called by Rust
|
|
623
627
|
handleNetworkRouteChanged(clientId, localNetworkAdapterType) {
|
|
624
|
-
|
|
625
|
-
|
|
628
|
+
sillyDeadlockProtection(() => {
|
|
629
|
+
const groupCall = this._groupCallByClientId.get(clientId);
|
|
626
630
|
if (!groupCall) {
|
|
627
631
|
this.logError('handleNetworkRouteChanged(): GroupCall not found in map!');
|
|
628
632
|
return;
|
|
@@ -632,19 +636,18 @@ class RingRTCType {
|
|
|
632
636
|
}
|
|
633
637
|
// Called by Rust
|
|
634
638
|
handleAudioLevels(clientId, capturedLevel, receivedLevels) {
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
if (
|
|
639
|
+
sillyDeadlockProtection(() => {
|
|
640
|
+
const groupCall = this._groupCallByClientId.get(clientId);
|
|
641
|
+
if (groupCall) {
|
|
638
642
|
groupCall.handleAudioLevels(capturedLevel, receivedLevels);
|
|
639
643
|
}
|
|
640
644
|
});
|
|
641
645
|
}
|
|
642
646
|
// Called by Rust
|
|
643
647
|
handleRemoteDevicesChanged(clientId, remoteDeviceStates) {
|
|
644
|
-
|
|
645
|
-
|
|
648
|
+
sillyDeadlockProtection(() => {
|
|
649
|
+
const groupCall = this._groupCallByClientId.get(clientId);
|
|
646
650
|
if (!groupCall) {
|
|
647
|
-
let error = new Error();
|
|
648
651
|
this.logError('handleRemoteDevicesChanged(): GroupCall not found in map!');
|
|
649
652
|
return;
|
|
650
653
|
}
|
|
@@ -653,10 +656,9 @@ class RingRTCType {
|
|
|
653
656
|
}
|
|
654
657
|
// Called by Rust
|
|
655
658
|
handlePeekChanged(clientId, info) {
|
|
656
|
-
|
|
657
|
-
|
|
659
|
+
sillyDeadlockProtection(() => {
|
|
660
|
+
const groupCall = this._groupCallByClientId.get(clientId);
|
|
658
661
|
if (!groupCall) {
|
|
659
|
-
let error = new Error();
|
|
660
662
|
this.logError('handlePeekChanged(): GroupCall not found in map!');
|
|
661
663
|
return;
|
|
662
664
|
}
|
|
@@ -664,19 +666,18 @@ class RingRTCType {
|
|
|
664
666
|
});
|
|
665
667
|
}
|
|
666
668
|
// Called by Rust
|
|
667
|
-
handlePeekResponse(
|
|
668
|
-
|
|
669
|
-
if (!this._peekRequests.resolve(
|
|
670
|
-
this.logWarn(`Invalid request ID for handlePeekResponse: ${
|
|
669
|
+
handlePeekResponse(requestId, info) {
|
|
670
|
+
sillyDeadlockProtection(() => {
|
|
671
|
+
if (!this._peekRequests.resolve(requestId, info)) {
|
|
672
|
+
this.logWarn(`Invalid request ID for handlePeekResponse: ${requestId}`);
|
|
671
673
|
}
|
|
672
674
|
});
|
|
673
675
|
}
|
|
674
676
|
// Called by Rust
|
|
675
677
|
handleEnded(clientId, reason) {
|
|
676
|
-
|
|
677
|
-
|
|
678
|
+
sillyDeadlockProtection(() => {
|
|
679
|
+
const groupCall = this._groupCallByClientId.get(clientId);
|
|
678
680
|
if (!groupCall) {
|
|
679
|
-
let error = new Error();
|
|
680
681
|
this.logError('handleEnded(): GroupCall not found in map!');
|
|
681
682
|
return;
|
|
682
683
|
}
|
|
@@ -686,7 +687,7 @@ class RingRTCType {
|
|
|
686
687
|
}
|
|
687
688
|
// Called by Rust
|
|
688
689
|
groupCallRingUpdate(groupId, ringIdString, sender, state) {
|
|
689
|
-
|
|
690
|
+
sillyDeadlockProtection(() => {
|
|
690
691
|
if (this.handleGroupCallRingUpdate) {
|
|
691
692
|
const ringId = BigInt(ringIdString);
|
|
692
693
|
this.handleGroupCallRingUpdate(groupId, ringId, sender, state);
|
|
@@ -715,16 +716,16 @@ class RingRTCType {
|
|
|
715
716
|
this.onLogMessage(CallLogLevel.Info, 'Service.ts', 0, message);
|
|
716
717
|
}
|
|
717
718
|
// Called by MessageReceiver
|
|
718
|
-
// tslint:disable-next-line cyclomatic-complexity
|
|
719
719
|
handleCallingMessage(remoteUserId, remoteUuid, remoteDeviceId, localDeviceId, messageAgeSec, messageReceivedAtCounter, message, senderIdentityKey, receiverIdentityKey) {
|
|
720
|
+
var _a, _b, _c, _d, _e;
|
|
720
721
|
if (message.destinationDeviceId &&
|
|
721
722
|
message.destinationDeviceId !== localDeviceId) {
|
|
722
723
|
// Drop the message as it isn't for this device, handleIgnoredCall() is not needed.
|
|
723
724
|
return;
|
|
724
725
|
}
|
|
725
|
-
if (message.offer
|
|
726
|
+
if ((_a = message.offer) === null || _a === void 0 ? void 0 : _a.callId) {
|
|
726
727
|
const callId = message.offer.callId;
|
|
727
|
-
const opaque =
|
|
728
|
+
const opaque = toBuffer(message.offer.opaque);
|
|
728
729
|
// opaque is required. sdp is obsolete, but it might still come with opaque.
|
|
729
730
|
if (!opaque) {
|
|
730
731
|
// TODO: Remove once the proto is updated to only support opaque and require it.
|
|
@@ -733,13 +734,13 @@ class RingRTCType {
|
|
|
733
734
|
}
|
|
734
735
|
const offerType = message.offer.type || OfferType.AudioCall;
|
|
735
736
|
// Save the call details for later when the call is ended.
|
|
736
|
-
|
|
737
|
+
const callInfo = new CallInfo(offerType === OfferType.VideoCall, messageReceivedAtCounter);
|
|
737
738
|
this._callInfoByCallId.set(this.getCallInfoKey(callId), callInfo);
|
|
738
739
|
this.callManager.receivedOffer(remoteUserId, remoteDeviceId, localDeviceId, messageAgeSec, callId, offerType, opaque, senderIdentityKey, receiverIdentityKey);
|
|
739
740
|
}
|
|
740
|
-
if (message.answer
|
|
741
|
+
if ((_b = message.answer) === null || _b === void 0 ? void 0 : _b.callId) {
|
|
741
742
|
const callId = message.answer.callId;
|
|
742
|
-
const opaque =
|
|
743
|
+
const opaque = toBuffer(message.answer.opaque);
|
|
743
744
|
// opaque is required. sdp is obsolete, but it might still come with opaque.
|
|
744
745
|
if (!opaque) {
|
|
745
746
|
// TODO: Remove once the proto is updated to only support opaque and require it.
|
|
@@ -750,11 +751,11 @@ class RingRTCType {
|
|
|
750
751
|
}
|
|
751
752
|
if (message.iceCandidates && message.iceCandidates.length > 0) {
|
|
752
753
|
// We assume they all have the same .callId
|
|
753
|
-
|
|
754
|
+
const callId = message.iceCandidates[0].callId;
|
|
754
755
|
// We have to copy them to do the .toArrayBuffer() thing.
|
|
755
756
|
const candidates = [];
|
|
756
757
|
for (const candidate of message.iceCandidates) {
|
|
757
|
-
const copy =
|
|
758
|
+
const copy = toBuffer(candidate.opaque);
|
|
758
759
|
if (copy) {
|
|
759
760
|
candidates.push(copy);
|
|
760
761
|
}
|
|
@@ -770,19 +771,19 @@ class RingRTCType {
|
|
|
770
771
|
}
|
|
771
772
|
this.callManager.receivedIceCandidates(remoteUserId, remoteDeviceId, callId, candidates);
|
|
772
773
|
}
|
|
773
|
-
if (message.hangup
|
|
774
|
+
if ((_c = message.hangup) === null || _c === void 0 ? void 0 : _c.callId) {
|
|
774
775
|
const callId = message.hangup.callId;
|
|
775
776
|
const hangupType = message.hangup.type || HangupType.Normal;
|
|
776
777
|
const hangupDeviceId = message.hangup.deviceId || null;
|
|
777
778
|
this.callManager.receivedHangup(remoteUserId, remoteDeviceId, callId, hangupType, hangupDeviceId);
|
|
778
779
|
}
|
|
779
|
-
if (message.legacyHangup
|
|
780
|
+
if ((_d = message.legacyHangup) === null || _d === void 0 ? void 0 : _d.callId) {
|
|
780
781
|
const callId = message.legacyHangup.callId;
|
|
781
782
|
const hangupType = message.legacyHangup.type || HangupType.Normal;
|
|
782
783
|
const hangupDeviceId = message.legacyHangup.deviceId || null;
|
|
783
784
|
this.callManager.receivedHangup(remoteUserId, remoteDeviceId, callId, hangupType, hangupDeviceId);
|
|
784
785
|
}
|
|
785
|
-
if (message.busy
|
|
786
|
+
if ((_e = message.busy) === null || _e === void 0 ? void 0 : _e.callId) {
|
|
786
787
|
const callId = message.busy.callId;
|
|
787
788
|
this.callManager.receivedBusy(remoteUserId, remoteDeviceId, callId);
|
|
788
789
|
}
|
|
@@ -791,7 +792,7 @@ class RingRTCType {
|
|
|
791
792
|
this.logError('handleCallingMessage(): opaque message received without UUID!');
|
|
792
793
|
return;
|
|
793
794
|
}
|
|
794
|
-
const data =
|
|
795
|
+
const data = toBuffer(message.opaque.data);
|
|
795
796
|
if (data == undefined) {
|
|
796
797
|
this.logError('handleCallingMessage(): opaque message received without data!');
|
|
797
798
|
return;
|
|
@@ -831,10 +832,10 @@ class RingRTCType {
|
|
|
831
832
|
return this._call;
|
|
832
833
|
}
|
|
833
834
|
getCall(callId) {
|
|
834
|
-
const
|
|
835
|
+
const call = this.call;
|
|
835
836
|
if (call &&
|
|
836
837
|
call.callId.high === callId.high &&
|
|
837
|
-
call.callId.low ===
|
|
838
|
+
call.callId.low === callId.low) {
|
|
838
839
|
return call;
|
|
839
840
|
}
|
|
840
841
|
return null;
|
|
@@ -956,7 +957,7 @@ class Call {
|
|
|
956
957
|
this._state = state;
|
|
957
958
|
this.enableOrDisableCapturer();
|
|
958
959
|
this.enableOrDisableRenderer();
|
|
959
|
-
if (
|
|
960
|
+
if (this.handleStateChanged) {
|
|
960
961
|
this.handleStateChanged();
|
|
961
962
|
}
|
|
962
963
|
}
|
|
@@ -990,7 +991,7 @@ class Call {
|
|
|
990
991
|
this._videoRenderer.disable();
|
|
991
992
|
}
|
|
992
993
|
// This assumes we only have one active call.
|
|
993
|
-
|
|
994
|
+
sillyDeadlockProtection(() => {
|
|
994
995
|
this._callManager.hangup();
|
|
995
996
|
});
|
|
996
997
|
}
|
|
@@ -1000,7 +1001,7 @@ class Call {
|
|
|
1000
1001
|
set outgoingAudioEnabled(enabled) {
|
|
1001
1002
|
this._outgoingAudioEnabled = enabled;
|
|
1002
1003
|
// This assumes we only have one active call.
|
|
1003
|
-
|
|
1004
|
+
sillyDeadlockProtection(() => {
|
|
1004
1005
|
this._callManager.setOutgoingAudioEnabled(enabled);
|
|
1005
1006
|
});
|
|
1006
1007
|
}
|
|
@@ -1014,7 +1015,7 @@ class Call {
|
|
|
1014
1015
|
set outgoingVideoIsScreenShare(isScreenShare) {
|
|
1015
1016
|
// This assumes we only have one active call.
|
|
1016
1017
|
this._outgoingVideoIsScreenShare = isScreenShare;
|
|
1017
|
-
|
|
1018
|
+
sillyDeadlockProtection(() => {
|
|
1018
1019
|
this._callManager.setOutgoingVideoIsScreenShare(isScreenShare);
|
|
1019
1020
|
});
|
|
1020
1021
|
}
|
|
@@ -1070,7 +1071,7 @@ class Call {
|
|
|
1070
1071
|
}
|
|
1071
1072
|
}
|
|
1072
1073
|
setOutgoingVideoEnabled(enabled) {
|
|
1073
|
-
|
|
1074
|
+
sillyDeadlockProtection(() => {
|
|
1074
1075
|
try {
|
|
1075
1076
|
this._callManager.setOutgoingVideoEnabled(enabled);
|
|
1076
1077
|
}
|
|
@@ -1081,7 +1082,7 @@ class Call {
|
|
|
1081
1082
|
});
|
|
1082
1083
|
}
|
|
1083
1084
|
updateBandwidthMode(bandwidthMode) {
|
|
1084
|
-
|
|
1085
|
+
sillyDeadlockProtection(() => {
|
|
1085
1086
|
try {
|
|
1086
1087
|
this._callManager.updateBandwidthMode(bandwidthMode);
|
|
1087
1088
|
}
|
|
@@ -1227,6 +1228,9 @@ class VideoRequest {
|
|
|
1227
1228
|
}
|
|
1228
1229
|
exports.VideoRequest = VideoRequest;
|
|
1229
1230
|
class GroupCall {
|
|
1231
|
+
get clientId() {
|
|
1232
|
+
return this._clientId;
|
|
1233
|
+
}
|
|
1230
1234
|
// Called by UI via RingRTC object
|
|
1231
1235
|
constructor(callManager, groupId, sfuUrl, hkdfExtraInfo, audioLevelsIntervalMillis, observer) {
|
|
1232
1236
|
this._callManager = callManager;
|
|
@@ -1234,9 +1238,6 @@ class GroupCall {
|
|
|
1234
1238
|
this._localDeviceState = new LocalDeviceState();
|
|
1235
1239
|
this._clientId = this._callManager.createGroupCallClient(groupId, sfuUrl, hkdfExtraInfo, audioLevelsIntervalMillis || 0);
|
|
1236
1240
|
}
|
|
1237
|
-
get clientId() {
|
|
1238
|
-
return this._clientId;
|
|
1239
|
-
}
|
|
1240
1241
|
// Called by UI
|
|
1241
1242
|
connect() {
|
|
1242
1243
|
this._callManager.connect(this._clientId);
|
|
@@ -1345,7 +1346,7 @@ class GroupCall {
|
|
|
1345
1346
|
this._localDeviceState.audioLevel = normalizeAudioLevel(capturedLevel);
|
|
1346
1347
|
if (this._remoteDeviceStates != undefined) {
|
|
1347
1348
|
for (const received of receivedLevels) {
|
|
1348
|
-
for (
|
|
1349
|
+
for (const remoteDeviceState of this._remoteDeviceStates) {
|
|
1349
1350
|
if (remoteDeviceState.demuxId == received.demuxId) {
|
|
1350
1351
|
remoteDeviceState.audioLevel = normalizeAudioLevel(received.level);
|
|
1351
1352
|
}
|
|
@@ -1406,14 +1407,14 @@ class GroupCallVideoFrameSource {
|
|
|
1406
1407
|
receiveVideoFrame(buffer, maxWidth, maxHeight) {
|
|
1407
1408
|
// This assumes we only have one active call.
|
|
1408
1409
|
const frame = this._callManager.receiveGroupCallVideoFrame(this._groupCall.clientId, this._remoteDemuxId, buffer, maxWidth, maxHeight);
|
|
1409
|
-
if (
|
|
1410
|
+
if (frame) {
|
|
1410
1411
|
const [width, height] = frame;
|
|
1411
1412
|
this._groupCall.setRemoteAspectRatio(this._remoteDemuxId, width / height);
|
|
1412
1413
|
}
|
|
1413
1414
|
return frame;
|
|
1414
1415
|
}
|
|
1415
1416
|
}
|
|
1416
|
-
function
|
|
1417
|
+
function toBuffer(pbab) {
|
|
1417
1418
|
if (!pbab) {
|
|
1418
1419
|
return pbab;
|
|
1419
1420
|
}
|
|
@@ -1507,11 +1508,10 @@ var CallLogLevel;
|
|
|
1507
1508
|
CallLogLevel[CallLogLevel["Debug"] = 4] = "Debug";
|
|
1508
1509
|
CallLogLevel[CallLogLevel["Trace"] = 5] = "Trace";
|
|
1509
1510
|
})(CallLogLevel = exports.CallLogLevel || (exports.CallLogLevel = {}));
|
|
1510
|
-
function
|
|
1511
|
-
|
|
1512
|
-
(() => __awaiter(this, void 0, void 0, function* () {
|
|
1511
|
+
function sillyDeadlockProtection(f) {
|
|
1512
|
+
void (() => __awaiter(this, void 0, void 0, function* () {
|
|
1513
1513
|
// This is a silly way of preventing a deadlock.
|
|
1514
|
-
//
|
|
1514
|
+
// eslint-disable-next-line @typescript-eslint/await-thenable
|
|
1515
1515
|
yield 0;
|
|
1516
1516
|
f();
|
|
1517
1517
|
}))();
|
|
@@ -46,7 +46,7 @@ export declare class GumVideoCapturer {
|
|
|
46
46
|
enableCaptureAndSend(sender: VideoFrameSender, options?: GumVideoCaptureOptions): void;
|
|
47
47
|
disable(): void;
|
|
48
48
|
setPreferredDevice(deviceId: string): Promise<void>;
|
|
49
|
-
enumerateDevices(): Promise<MediaDeviceInfo
|
|
49
|
+
enumerateDevices(): Promise<Array<MediaDeviceInfo>>;
|
|
50
50
|
private getUserMedia;
|
|
51
51
|
private startCapturing;
|
|
52
52
|
private stopCapturing;
|
|
@@ -22,6 +22,7 @@ var VideoPixelFormatEnum;
|
|
|
22
22
|
VideoPixelFormatEnum[VideoPixelFormatEnum["Nv12"] = 1] = "Nv12";
|
|
23
23
|
VideoPixelFormatEnum[VideoPixelFormatEnum["Rgba"] = 2] = "Rgba";
|
|
24
24
|
})(VideoPixelFormatEnum = exports.VideoPixelFormatEnum || (exports.VideoPixelFormatEnum = {}));
|
|
25
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
25
26
|
function videoPixelFormatFromEnum(format) {
|
|
26
27
|
switch (format) {
|
|
27
28
|
case VideoPixelFormatEnum.I420: {
|
|
@@ -82,11 +83,11 @@ class GumVideoCapturer {
|
|
|
82
83
|
this.updateLocalPreviewIntervalId = setInterval(this.updateLocalPreviewSourceObject.bind(this), 1000);
|
|
83
84
|
}
|
|
84
85
|
enableCapture() {
|
|
85
|
-
//
|
|
86
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
86
87
|
this.startCapturing(this.defaultCaptureOptions);
|
|
87
88
|
}
|
|
88
89
|
enableCaptureAndSend(sender, options) {
|
|
89
|
-
//
|
|
90
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
90
91
|
this.startCapturing(options !== null && options !== void 0 ? options : this.defaultCaptureOptions);
|
|
91
92
|
this.startSending(sender);
|
|
92
93
|
}
|
|
@@ -98,13 +99,14 @@ class GumVideoCapturer {
|
|
|
98
99
|
}
|
|
99
100
|
this.updateLocalPreviewIntervalId = undefined;
|
|
100
101
|
}
|
|
102
|
+
// eslint-disable-next-line @typescript-eslint/require-await
|
|
101
103
|
setPreferredDevice(deviceId) {
|
|
102
104
|
return __awaiter(this, void 0, void 0, function* () {
|
|
103
105
|
this.preferredDeviceId = deviceId;
|
|
104
106
|
if (this.captureOptions) {
|
|
105
|
-
const captureOptions = this
|
|
106
|
-
const sender = this.sender;
|
|
107
|
+
const { captureOptions, sender } = this;
|
|
107
108
|
this.disable();
|
|
109
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
108
110
|
this.startCapturing(captureOptions);
|
|
109
111
|
if (sender) {
|
|
110
112
|
this.startSending(sender);
|
|
@@ -122,7 +124,7 @@ class GumVideoCapturer {
|
|
|
122
124
|
getUserMedia(options) {
|
|
123
125
|
var _a;
|
|
124
126
|
// TODO: Figure out a better way to make typescript accept "mandatory".
|
|
125
|
-
|
|
127
|
+
const constraints = {
|
|
126
128
|
audio: false,
|
|
127
129
|
video: {
|
|
128
130
|
deviceId: (_a = options.preferredDeviceId) !== null && _a !== void 0 ? _a : this.preferredDeviceId,
|
|
@@ -203,7 +205,7 @@ class GumVideoCapturer {
|
|
|
203
205
|
}
|
|
204
206
|
index_1.RingRTC.logInfo('stopCapturing()');
|
|
205
207
|
this.captureOptions = undefined;
|
|
206
|
-
if (
|
|
208
|
+
if (this.mediaStream) {
|
|
207
209
|
for (const track of this.mediaStream.getVideoTracks()) {
|
|
208
210
|
// Make the light turn off faster
|
|
209
211
|
track.stop();
|
|
@@ -216,7 +218,7 @@ class GumVideoCapturer {
|
|
|
216
218
|
if (this.sender === sender) {
|
|
217
219
|
return;
|
|
218
220
|
}
|
|
219
|
-
if (
|
|
221
|
+
if (this.sender) {
|
|
220
222
|
// If we're replacing an existing sender, make sure we stop the
|
|
221
223
|
// current setInterval loop before starting another one.
|
|
222
224
|
this.stopSending();
|
|
@@ -233,7 +235,7 @@ class GumVideoCapturer {
|
|
|
233
235
|
}
|
|
234
236
|
if (track.readyState === 'ended') {
|
|
235
237
|
this.stopCapturing();
|
|
236
|
-
index_1.RingRTC.logError(
|
|
238
|
+
index_1.RingRTC.logError('spawnSender(): Video track ended before spawning sender');
|
|
237
239
|
return;
|
|
238
240
|
}
|
|
239
241
|
const reader = new MediaStreamTrackProcessor({
|
|
@@ -241,10 +243,11 @@ class GumVideoCapturer {
|
|
|
241
243
|
}).readable.getReader();
|
|
242
244
|
const buffer = Buffer.alloc(exports.MAX_VIDEO_CAPTURE_BUFFER_SIZE);
|
|
243
245
|
this.spawnedSenderRunning = true;
|
|
246
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
244
247
|
(() => __awaiter(this, void 0, void 0, function* () {
|
|
245
248
|
var _a;
|
|
246
249
|
try {
|
|
247
|
-
while (
|
|
250
|
+
while (mediaStream == this.mediaStream) {
|
|
248
251
|
const { done, value: frame } = yield reader.read();
|
|
249
252
|
if (done) {
|
|
250
253
|
break;
|
|
@@ -258,7 +261,10 @@ class GumVideoCapturer {
|
|
|
258
261
|
index_1.RingRTC.logWarn(`Unsupported video frame format: ${frame.format}`);
|
|
259
262
|
break;
|
|
260
263
|
}
|
|
261
|
-
frame.copyTo(buffer);
|
|
264
|
+
yield frame.copyTo(buffer);
|
|
265
|
+
if (sender !== this.sender) {
|
|
266
|
+
break;
|
|
267
|
+
}
|
|
262
268
|
sender.sendVideoFrame(frame.codedWidth, frame.codedHeight, format, buffer);
|
|
263
269
|
}
|
|
264
270
|
catch (e) {
|
|
@@ -295,7 +301,7 @@ class GumVideoCapturer {
|
|
|
295
301
|
if (localPreview.srcObject === mediaStream) {
|
|
296
302
|
return;
|
|
297
303
|
}
|
|
298
|
-
if (mediaStream) {
|
|
304
|
+
if (mediaStream && this.captureOptions) {
|
|
299
305
|
localPreview.srcObject = mediaStream;
|
|
300
306
|
if (localPreview.width === 0) {
|
|
301
307
|
localPreview.width = this.captureOptions.maxWidth;
|
|
@@ -327,7 +333,7 @@ class CanvasVideoRenderer {
|
|
|
327
333
|
if (this.source === source) {
|
|
328
334
|
return;
|
|
329
335
|
}
|
|
330
|
-
if (
|
|
336
|
+
if (this.source) {
|
|
331
337
|
// If we're replacing an existing source, make sure we stop the
|
|
332
338
|
// current rAF loop before starting another one.
|
|
333
339
|
if (this.rafId) {
|
|
@@ -17,12 +17,19 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
17
17
|
};
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
19
|
exports.CallingClass = void 0;
|
|
20
|
+
/* eslint-disable no-console, @typescript-eslint/require-await, @typescript-eslint/no-unused-vars */
|
|
20
21
|
const Service_1 = require("../ringrtc/Service");
|
|
21
22
|
const index_1 = require("../index");
|
|
22
23
|
const long_1 = __importDefault(require("long"));
|
|
23
24
|
const Utils_1 = require("./Utils");
|
|
24
25
|
// This class mimics the Desktop Client CallingClass in ts/services/calling.ts to facilitate testing
|
|
25
26
|
class CallingClass {
|
|
27
|
+
set delayIncomingCallSettingsRequest(value) {
|
|
28
|
+
this._delayIncomingCallSettingsRequest = value;
|
|
29
|
+
}
|
|
30
|
+
set delayOutgoingCallSettingsRequest(value) {
|
|
31
|
+
this._delayIncomingCallSettingsRequest = value;
|
|
32
|
+
}
|
|
26
33
|
constructor(name, id) {
|
|
27
34
|
this._name = name;
|
|
28
35
|
this._id = id;
|
|
@@ -30,22 +37,16 @@ class CallingClass {
|
|
|
30
37
|
this._delayIncomingCallSettingsRequest = 0;
|
|
31
38
|
this._delayOutgoingCallSettingsRequest = 0;
|
|
32
39
|
}
|
|
33
|
-
set delayIncomingCallSettingsRequest(value) {
|
|
34
|
-
this._delayIncomingCallSettingsRequest = value;
|
|
35
|
-
}
|
|
36
|
-
set delayOutgoingCallSettingsRequest(value) {
|
|
37
|
-
this._delayIncomingCallSettingsRequest = value;
|
|
38
|
-
}
|
|
39
40
|
setupCallCallbacks(call) {
|
|
40
41
|
// eslint-disable-next-line no-param-reassign
|
|
41
|
-
call.handleStateChanged = () =>
|
|
42
|
+
call.handleStateChanged = () => {
|
|
42
43
|
(0, Utils_1.log)('handleCallStateChanged');
|
|
43
44
|
(0, Utils_1.log)(`call.state === ${call.state}`);
|
|
44
45
|
if (call.state === Service_1.CallState.Ended) {
|
|
45
46
|
(0, Utils_1.log)(`call.endedReason === ${call.endedReason}`);
|
|
46
47
|
this._call = undefined;
|
|
47
48
|
}
|
|
48
|
-
}
|
|
49
|
+
};
|
|
49
50
|
// eslint-disable-next-line no-param-reassign
|
|
50
51
|
call.handleRemoteVideoEnabled = () => {
|
|
51
52
|
(0, Utils_1.log)('handleRemoteVideoEnabled');
|
|
@@ -59,7 +60,7 @@ class CallingClass {
|
|
|
59
60
|
// Callbacks
|
|
60
61
|
handleOutgoingSignaling(remoteUserId, message, urgency) {
|
|
61
62
|
return __awaiter(this, void 0, void 0, function* () {
|
|
62
|
-
(0, Utils_1.log)(
|
|
63
|
+
(0, Utils_1.log)(`handleOutgoingSignaling remoteUserId: ${remoteUserId}`);
|
|
63
64
|
return true;
|
|
64
65
|
});
|
|
65
66
|
}
|
|
@@ -79,65 +80,49 @@ class CallingClass {
|
|
|
79
80
|
});
|
|
80
81
|
}
|
|
81
82
|
handleAutoEndedIncomingCallRequest(callId, remoteUserId, reason, ageInSeconds, wasVideoCall, receivedAtCounter) {
|
|
82
|
-
|
|
83
|
-
(0, Utils_1.log)('handleAutoEndedIncomingCallRequest');
|
|
84
|
-
});
|
|
83
|
+
(0, Utils_1.log)('handleAutoEndedIncomingCallRequest');
|
|
85
84
|
}
|
|
86
85
|
handleLogMessage(level, fileName, line, message) {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
}
|
|
104
|
-
});
|
|
86
|
+
switch (level) {
|
|
87
|
+
case Service_1.CallLogLevel.Info:
|
|
88
|
+
// FgGray
|
|
89
|
+
console.log(`\x1b[90m${fileName}:${line} ${message}\x1b[0m`);
|
|
90
|
+
break;
|
|
91
|
+
case Service_1.CallLogLevel.Warn:
|
|
92
|
+
// FgYellow
|
|
93
|
+
console.warn(`\x1b[33m${fileName}:${line} ${message}\x1b[0m`);
|
|
94
|
+
break;
|
|
95
|
+
case Service_1.CallLogLevel.Error:
|
|
96
|
+
// FgRed
|
|
97
|
+
console.error(`\x1b[31m${fileName}:${line} ${message}\x1b[0m`);
|
|
98
|
+
break;
|
|
99
|
+
default:
|
|
100
|
+
break;
|
|
101
|
+
}
|
|
105
102
|
}
|
|
106
103
|
handleSendHttpRequest(requestId, url, method, headers, body) {
|
|
107
|
-
|
|
108
|
-
(0, Utils_1.log)('handleSendHttpRequest');
|
|
109
|
-
});
|
|
104
|
+
(0, Utils_1.log)('handleSendHttpRequest');
|
|
110
105
|
}
|
|
111
106
|
handleSendCallMessage(recipient, data, urgency) {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
return true;
|
|
115
|
-
});
|
|
107
|
+
(0, Utils_1.log)('handleSendCallMessage');
|
|
108
|
+
return true;
|
|
116
109
|
}
|
|
117
110
|
handleSendCallMessageToGroup(groupIdBytes, data, urgency) {
|
|
118
|
-
|
|
119
|
-
(0, Utils_1.log)('handleSendCallMessageToGroup');
|
|
120
|
-
});
|
|
111
|
+
(0, Utils_1.log)('handleSendCallMessageToGroup');
|
|
121
112
|
}
|
|
122
113
|
handleGroupCallRingUpdate(groupIdBytes, ringId, ringerBytes, update) {
|
|
123
|
-
|
|
124
|
-
(0, Utils_1.log)('handleGroupCallRingUpdate');
|
|
125
|
-
});
|
|
114
|
+
(0, Utils_1.log)('handleGroupCallRingUpdate');
|
|
126
115
|
}
|
|
127
116
|
////////////////////////////////////////////////////////////////////////////////
|
|
128
117
|
// Support
|
|
129
118
|
getCallSettings(isIncoming) {
|
|
130
119
|
return __awaiter(this, void 0, void 0, function* () {
|
|
131
120
|
if (isIncoming) {
|
|
132
|
-
(0, Utils_1.log)(
|
|
133
|
-
this._delayIncomingCallSettingsRequest.toString() +
|
|
134
|
-
'ms');
|
|
121
|
+
(0, Utils_1.log)(`getCallSettings delayed by ${this._delayIncomingCallSettingsRequest}ms`);
|
|
135
122
|
yield (0, Utils_1.sleep)(this._delayIncomingCallSettingsRequest);
|
|
136
123
|
}
|
|
137
124
|
else {
|
|
138
|
-
(0, Utils_1.log)(
|
|
139
|
-
this._delayOutgoingCallSettingsRequest.toString() +
|
|
140
|
-
'ms');
|
|
125
|
+
(0, Utils_1.log)(`getCallSettings delayed by ${this._delayOutgoingCallSettingsRequest}ms`);
|
|
141
126
|
yield (0, Utils_1.sleep)(this._delayOutgoingCallSettingsRequest);
|
|
142
127
|
}
|
|
143
128
|
return {
|
|
@@ -179,7 +164,7 @@ class CallingClass {
|
|
|
179
164
|
return;
|
|
180
165
|
}
|
|
181
166
|
const call = index_1.RingRTC.startOutgoingCall(remoteUserId, false, this._localDeviceId);
|
|
182
|
-
(0, Utils_1.log)(
|
|
167
|
+
(0, Utils_1.log)(`Outgoing callId ${long_1.default.fromValue(call.callId)}`);
|
|
183
168
|
index_1.RingRTC.setOutgoingAudio(call.callId, true);
|
|
184
169
|
this._call = call;
|
|
185
170
|
this.setupCallCallbacks(call);
|
|
@@ -16,6 +16,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
16
16
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
17
17
|
};
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
19
20
|
const chai_1 = require("chai");
|
|
20
21
|
const chai_as_promised_1 = __importDefault(require("chai-as-promised"));
|
|
21
22
|
const crypto_1 = require("crypto");
|
|
@@ -64,9 +65,11 @@ describe('RingRTC', () => {
|
|
|
64
65
|
const age = 60 * 60;
|
|
65
66
|
try {
|
|
66
67
|
const { reason, ageSec: reportedAge } = yield new Promise((resolve, _reject) => {
|
|
68
|
+
/* eslint-disable @typescript-eslint/no-shadow */
|
|
67
69
|
index_1.RingRTC.handleAutoEndedIncomingCallRequest = (_callId, _remoteUserId, reason, ageSec) => {
|
|
68
70
|
resolve({ reason, ageSec });
|
|
69
71
|
};
|
|
72
|
+
/* eslint-enable @typescript-eslint/no-shadow */
|
|
70
73
|
index_1.RingRTC.handleCallingMessage('remote', null, 4, 2, age, 1, offer, Buffer.from([]), Buffer.from([]));
|
|
71
74
|
});
|
|
72
75
|
chai_1.assert.equal(reason, index_1.CallEndedReason.ReceivedOfferExpired);
|
|
@@ -87,9 +90,11 @@ describe('RingRTC', () => {
|
|
|
87
90
|
};
|
|
88
91
|
try {
|
|
89
92
|
const { reason, ageSec: reportedAge } = yield new Promise((resolve, _reject) => {
|
|
93
|
+
/* eslint-disable @typescript-eslint/no-shadow */
|
|
90
94
|
index_1.RingRTC.handleAutoEndedIncomingCallRequest = (_callId, _remoteUserId, reason, ageSec) => {
|
|
91
95
|
resolve({ reason, ageSec });
|
|
92
96
|
};
|
|
97
|
+
/* eslint-enable @typescript-eslint/no-shadow */
|
|
93
98
|
index_1.RingRTC.handleCallingMessage('remote', null, 4, 2, 10, 2, offer, Buffer.from([]), Buffer.from([]));
|
|
94
99
|
});
|
|
95
100
|
chai_1.assert.equal(reason, index_1.CallEndedReason.Declined); // because we didn't set handleIncomingCall.
|
|
@@ -108,7 +113,7 @@ describe('RingRTC', () => {
|
|
|
108
113
|
chai_1.assert.isNotNull(index_1.RingRTC, "RingRTC didn't initialize!");
|
|
109
114
|
});
|
|
110
115
|
it('can establish outgoing call', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
111
|
-
|
|
116
|
+
const calling = new CallingClass_1.CallingClass(user1_name, user1_id);
|
|
112
117
|
calling.initialize();
|
|
113
118
|
initializeSpies();
|
|
114
119
|
yield calling.startOutgoingDirectCall(user2_id);
|
|
@@ -125,7 +130,7 @@ describe('RingRTC', () => {
|
|
|
125
130
|
yield (0, Utils_1.sleep)(100);
|
|
126
131
|
}));
|
|
127
132
|
it('can establish incoming call', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
128
|
-
|
|
133
|
+
const calling = new CallingClass_1.CallingClass(user1_name, user1_id);
|
|
129
134
|
calling.initialize();
|
|
130
135
|
initializeSpies();
|
|
131
136
|
// Generate incoming calling message
|
|
@@ -146,25 +151,25 @@ describe('RingRTC', () => {
|
|
|
146
151
|
chai_1.assert.equal(index_1.CallState.Ended, index_1.RingRTC.call.state);
|
|
147
152
|
}));
|
|
148
153
|
it('outgoing call wins glare when incoming call id is lower', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
149
|
-
|
|
154
|
+
const calling = new CallingClass_1.CallingClass(user1_name, user1_id);
|
|
150
155
|
calling.initialize();
|
|
151
156
|
initializeSpies();
|
|
152
157
|
yield runGlareScenario(calling, true, 0, 0);
|
|
153
158
|
}));
|
|
154
159
|
it('outgoing call wins glare when incoming call id is lower even when outgoing call settings are delayed', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
155
|
-
|
|
160
|
+
const calling = new CallingClass_1.CallingClass(user1_name, user1_id);
|
|
156
161
|
calling.initialize();
|
|
157
162
|
initializeSpies();
|
|
158
163
|
yield runGlareScenario(calling, true, 0, 1000);
|
|
159
164
|
}));
|
|
160
165
|
it('outgoing call loses glare when incoming call id is higher even when outgoing call settings are delayed', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
161
|
-
|
|
166
|
+
const calling = new CallingClass_1.CallingClass(user1_name, user1_id);
|
|
162
167
|
calling.initialize();
|
|
163
168
|
initializeSpies();
|
|
164
169
|
yield runGlareScenario(calling, false, 0, 1000);
|
|
165
170
|
}));
|
|
166
171
|
it('outgoing call loses glare when incoming call id is higher', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
167
|
-
|
|
172
|
+
const calling = new CallingClass_1.CallingClass(user1_name, user1_id);
|
|
168
173
|
calling.initialize();
|
|
169
174
|
initializeSpies();
|
|
170
175
|
yield runGlareScenario(calling, false, 0, 0);
|
|
@@ -176,12 +181,12 @@ describe('RingRTC', () => {
|
|
|
176
181
|
const outgoingCallLatch = (0, Utils_1.countDownLatch)(1);
|
|
177
182
|
calling
|
|
178
183
|
.startOutgoingDirectCall(user2_id)
|
|
179
|
-
.then(
|
|
184
|
+
.then(_result => {
|
|
180
185
|
(0, Utils_1.log)('Outgoing call succeeded as expected');
|
|
181
186
|
outgoingCallLatch.countDown();
|
|
182
187
|
})
|
|
183
188
|
.catch(e => {
|
|
184
|
-
chai_1.assert.fail(
|
|
189
|
+
chai_1.assert.fail(`Outgoing call should not have failed: ${e}`);
|
|
185
190
|
});
|
|
186
191
|
yield outgoingCallLatch.finished;
|
|
187
192
|
const outgoingCallId = long_1.default.fromValue(index_1.RingRTC.call.callId);
|
package/dist/test/Utils.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare function countDownLatch(count: number): {
|
|
2
2
|
countDown: () => void;
|
|
3
|
-
finished: Promise<
|
|
3
|
+
finished: Promise<void>;
|
|
4
4
|
};
|
|
5
5
|
export declare function log(line: string): void;
|
|
6
|
-
export declare
|
|
6
|
+
export declare function sleep(timeout: number): Promise<void>;
|
|
7
7
|
export declare function uuidToBytes(uuid: string): Uint8Array;
|
package/dist/test/Utils.js
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
//
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.uuidToBytes = exports.sleep = exports.log = exports.countDownLatch = void 0;
|
|
8
|
+
/* eslint-disable no-console */
|
|
8
9
|
const lodash_1 = require("lodash");
|
|
9
10
|
const chai_1 = require("chai");
|
|
10
11
|
function countDownLatch(count) {
|
|
@@ -32,7 +33,7 @@ function log(line) {
|
|
|
32
33
|
console.log(`\x1b[43m${line}\x1b[0m`);
|
|
33
34
|
}
|
|
34
35
|
exports.log = log;
|
|
35
|
-
|
|
36
|
+
function sleep(timeout) {
|
|
36
37
|
return new Promise(resolve => {
|
|
37
38
|
setTimeout(() => {
|
|
38
39
|
// BgBlue
|
|
@@ -40,7 +41,7 @@ let sleep = (timeout) => {
|
|
|
40
41
|
resolve();
|
|
41
42
|
}, timeout);
|
|
42
43
|
});
|
|
43
|
-
}
|
|
44
|
+
}
|
|
44
45
|
exports.sleep = sleep;
|
|
45
46
|
function uuidToBytes(uuid) {
|
|
46
47
|
if (uuid.length !== 36) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@signalapp/ringrtc",
|
|
3
|
-
"version": "2.25.
|
|
3
|
+
"version": "2.25.2",
|
|
4
4
|
"description": "Signal Messenger voice and video calling library.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -11,16 +11,16 @@
|
|
|
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
|
-
"format": "prettier --write
|
|
17
|
+
"format": "prettier --write .",
|
|
18
18
|
"install": "node scripts/fetch-prebuild.js",
|
|
19
19
|
"prepublishOnly": "node scripts/prepublish.js"
|
|
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": "b953fd21380c7025b5004bd0db99274737be1aeec1c76133f08568adcfd5adaf"
|
|
24
24
|
},
|
|
25
25
|
"author": "",
|
|
26
26
|
"license": "AGPL-3.0-only",
|
|
@@ -28,33 +28,31 @@
|
|
|
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": "16.8.5",
|
|
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",
|
|
39
38
|
"@types/sinon-chai": "^3.2.9",
|
|
40
|
-
"chai": "4.3.
|
|
39
|
+
"chai": "4.3.7",
|
|
41
40
|
"chai-as-promised": "^7.1.1",
|
|
42
|
-
"electron": "
|
|
41
|
+
"electron": "22.2.0",
|
|
43
42
|
"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": "
|
|
43
|
+
"eslint": "8.34.0",
|
|
44
|
+
"eslint-config-airbnb-typescript-prettier": "5.0.0",
|
|
45
|
+
"eslint-config-prettier": "8.6.0",
|
|
46
|
+
"eslint-plugin-import": "2.27.5",
|
|
47
|
+
"eslint-plugin-mocha": "10.1.0",
|
|
49
48
|
"eslint-plugin-more": "1.0.5",
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"rimraf": "3.0.2",
|
|
49
|
+
"long": "5.2.1",
|
|
50
|
+
"mocha": "10.2.0",
|
|
51
|
+
"prettier": "^2.8.4",
|
|
52
|
+
"rimraf": "4.1.2",
|
|
55
53
|
"sinon": "^15.0.1",
|
|
56
54
|
"sinon-chai": "^3.7.0",
|
|
57
|
-
"typescript": "4.
|
|
58
|
-
"yarn-audit-fix": "^9.
|
|
55
|
+
"typescript": "4.9.3",
|
|
56
|
+
"yarn-audit-fix": "^9.3.9"
|
|
59
57
|
}
|
|
60
58
|
}
|