@observertc/observer-js 0.42.9 → 1.0.1-23e88d8.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.
- package/.prettierrc +6 -6
- package/README.md +0 -104
- package/lib/ObservedCall.d.ts +25 -41
- package/lib/ObservedCall.d.ts.map +1 -1
- package/lib/ObservedCall.js +61 -109
- package/lib/ObservedCertificate.d.ts +19 -0
- package/lib/ObservedCertificate.d.ts.map +1 -0
- package/lib/ObservedCertificate.js +38 -0
- package/lib/ObservedClient.d.ts +33 -143
- package/lib/ObservedClient.d.ts.map +1 -1
- package/lib/ObservedClient.js +156 -757
- package/lib/ObservedCodec.d.ts +22 -0
- package/lib/ObservedCodec.d.ts.map +1 -0
- package/lib/ObservedCodec.js +45 -0
- package/lib/ObservedDataChannel.d.ts +20 -70
- package/lib/ObservedDataChannel.d.ts.map +1 -1
- package/lib/ObservedDataChannel.js +39 -109
- package/lib/ObservedIceCandidate.d.ts +29 -0
- package/lib/ObservedIceCandidate.d.ts.map +1 -0
- package/lib/ObservedIceCandidate.js +59 -0
- package/lib/ObservedIceCandidatePair.d.ts +40 -0
- package/lib/ObservedIceCandidatePair.d.ts.map +1 -0
- package/lib/ObservedIceCandidatePair.js +83 -0
- package/lib/ObservedIceTransport.d.ts +32 -0
- package/lib/ObservedIceTransport.d.ts.map +1 -0
- package/lib/ObservedIceTransport.js +65 -0
- package/lib/ObservedInboundRtp.d.ts +92 -0
- package/lib/ObservedInboundRtp.d.ts.map +1 -0
- package/lib/ObservedInboundRtp.js +193 -0
- package/lib/ObservedInboundTrack.d.ts +29 -0
- package/lib/ObservedInboundTrack.d.ts.map +1 -0
- package/lib/ObservedInboundTrack.js +57 -0
- package/lib/ObservedMediaPlayout.d.ts +22 -0
- package/lib/ObservedMediaPlayout.d.ts.map +1 -0
- package/lib/ObservedMediaPlayout.js +42 -0
- package/lib/ObservedMediaSource.d.ts +28 -0
- package/lib/ObservedMediaSource.d.ts.map +1 -0
- package/lib/ObservedMediaSource.js +55 -0
- package/lib/ObservedOutboundRtp.d.ts +62 -0
- package/lib/ObservedOutboundRtp.d.ts.map +1 -0
- package/lib/ObservedOutboundRtp.js +144 -0
- package/lib/ObservedOutboundTrack.d.ts +29 -0
- package/lib/ObservedOutboundTrack.d.ts.map +1 -0
- package/lib/ObservedOutboundTrack.js +57 -0
- package/lib/ObservedPeerConnection.d.ts +118 -78
- package/lib/ObservedPeerConnection.d.ts.map +1 -1
- package/lib/ObservedPeerConnection.js +556 -359
- package/lib/ObservedPeerConnectionTransport.d.ts +17 -0
- package/lib/ObservedPeerConnectionTransport.d.ts.map +1 -0
- package/lib/ObservedPeerConnectionTransport.js +34 -0
- package/lib/ObservedRemoteInboundRtp.d.ts +30 -0
- package/lib/ObservedRemoteInboundRtp.d.ts.map +1 -0
- package/lib/ObservedRemoteInboundRtp.js +60 -0
- package/lib/ObservedRemoteOutboundRtp.d.ts +30 -0
- package/lib/ObservedRemoteOutboundRtp.d.ts.map +1 -0
- package/lib/ObservedRemoteOutboundRtp.js +60 -0
- package/lib/Observer.d.ts +30 -53
- package/lib/Observer.d.ts.map +1 -1
- package/lib/Observer.js +52 -225
- package/lib/common/Middleware.d.ts +10 -1
- package/lib/common/Middleware.d.ts.map +1 -1
- package/lib/common/Middleware.js +55 -36
- package/lib/common/logger.d.ts +8 -4
- package/lib/common/logger.d.ts.map +1 -1
- package/lib/common/logger.js +44 -68
- package/lib/common/types.d.ts +0 -21
- package/lib/common/types.d.ts.map +1 -1
- package/lib/common/types.js +1 -0
- package/lib/common/utils.d.ts +1 -0
- package/lib/common/utils.d.ts.map +1 -1
- package/lib/common/utils.js +13 -1
- package/lib/detectors/Detector.d.ts +5 -0
- package/lib/detectors/Detector.d.ts.map +1 -0
- package/lib/detectors/Detector.js +3 -0
- package/lib/detectors/Detectors.d.ts +11 -0
- package/lib/detectors/Detectors.d.ts.map +1 -0
- package/lib/detectors/Detectors.js +34 -0
- package/lib/index.d.ts +23 -25
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +41 -41
- package/lib/monitors/TurnUsageMonitor.d.ts +0 -52
- package/lib/monitors/TurnUsageMonitor.d.ts.map +1 -1
- package/lib/monitors/TurnUsageMonitor.js +145 -120
- package/lib/schema/ClientEventTypes.d.ts +33 -0
- package/lib/schema/ClientEventTypes.d.ts.map +1 -0
- package/lib/schema/ClientEventTypes.js +38 -0
- package/lib/schema/ClientMetaTypes.d.ts +34 -0
- package/lib/schema/ClientMetaTypes.d.ts.map +1 -0
- package/lib/schema/ClientMetaTypes.js +16 -0
- package/lib/schema/ClientSample.d.ts +1333 -0
- package/lib/schema/ClientSample.d.ts.map +1 -0
- package/lib/schema/ClientSample.js +4 -0
- package/lib/scores/CalculatedScore.d.ts +6 -0
- package/lib/scores/CalculatedScore.d.ts.map +1 -0
- package/lib/scores/DefaultCallScoreCalculator.d.ts +7 -0
- package/lib/scores/DefaultCallScoreCalculator.d.ts.map +1 -0
- package/lib/scores/DefaultCallScoreCalculator.js +21 -0
- package/lib/scores/ScoreCalculator.d.ts +4 -0
- package/lib/scores/ScoreCalculator.d.ts.map +1 -0
- package/lib/scores/ScoreCalculator.js +2 -0
- package/lib/utils/CallUpdater.d.ts +5 -0
- package/lib/utils/CallUpdater.d.ts.map +1 -0
- package/lib/utils/CallUpdater.js +2 -0
- package/lib/utils/OnAllClientCallUpdater.d.ts +16 -0
- package/lib/utils/OnAllClientCallUpdater.d.ts.map +1 -0
- package/lib/utils/OnAllClientCallUpdater.js +58 -0
- package/lib/utils/RemoteTrackResolver.d.ts +7 -0
- package/lib/utils/RemoteTrackResolver.d.ts.map +1 -0
- package/lib/utils/RemoteTrackResolver.js +2 -0
- package/lib/utils/onAnyClientCallUpdater.d.ts +14 -0
- package/lib/utils/onAnyClientCallUpdater.d.ts.map +1 -0
- package/lib/utils/onAnyClientCallUpdater.js +51 -0
- package/package.json +4 -4
- package/src/ObservedCall.ts +74 -167
- package/src/ObservedCertificate.ts +43 -0
- package/src/ObservedClient.ts +173 -1085
- package/src/ObservedCodec.ts +49 -0
- package/src/ObservedDataChannel.ts +36 -178
- package/src/ObservedIceCandidate.ts +64 -0
- package/src/ObservedIceCandidatePair.ts +92 -0
- package/src/ObservedIceTransport.ts +70 -0
- package/src/ObservedInboundRtp.ts +205 -0
- package/src/ObservedInboundTrack.ts +70 -0
- package/src/ObservedMediaPlayout.ts +49 -0
- package/src/ObservedMediaSource.ts +60 -0
- package/src/ObservedOutboundRtp.ts +156 -0
- package/src/ObservedOutboundTrack.ts +69 -0
- package/src/ObservedPeerConnection.ts +743 -401
- package/src/ObservedPeerConnectionTransport.ts +38 -0
- package/src/ObservedRemoteInboundRtp.ts +64 -0
- package/src/ObservedRemoteOutboundRtp.ts +65 -0
- package/src/Observer.ts +65 -285
- package/src/common/Middleware.ts +70 -42
- package/src/common/logger.ts +60 -69
- package/src/common/types.ts +0 -42
- package/src/common/utils.ts +12 -0
- package/src/detectors/Detector.ts +6 -0
- package/src/detectors/Detectors.ts +38 -0
- package/src/index.ts +23 -90
- package/src/monitors/TurnUsageMonitor.ts +164 -164
- package/src/schema/ClientEventTypes.ts +36 -0
- package/src/schema/ClientMetaTypes.ts +41 -0
- package/src/schema/ClientSample.ts +1682 -0
- package/src/scores/CalculatedScore.ts +6 -0
- package/src/scores/DefaultCallScoreCalculator.ts +23 -0
- package/src/scores/ScoreCalculator.ts +3 -0
- package/src/utils/CallUpdater.ts +5 -0
- package/src/utils/OnAllClientCallUpdater.ts +68 -0
- package/src/utils/RemoteTrackResolver.ts +12 -0
- package/src/utils/onAnyClientCallUpdater.ts +59 -0
- package/tsconfig.json +3 -3
- package/lib/ObservedICE.d.ts +0 -64
- package/lib/ObservedICE.d.ts.map +0 -1
- package/lib/ObservedICE.js +0 -141
- package/lib/ObservedInboundAudioTrack.d.ts +0 -96
- package/lib/ObservedInboundAudioTrack.d.ts.map +0 -1
- package/lib/ObservedInboundAudioTrack.js +0 -217
- package/lib/ObservedInboundVideoTrack.d.ts +0 -101
- package/lib/ObservedInboundVideoTrack.d.ts.map +0 -1
- package/lib/ObservedInboundVideoTrack.js +0 -232
- package/lib/ObservedOutboundAudioTrack.d.ts +0 -87
- package/lib/ObservedOutboundAudioTrack.d.ts.map +0 -1
- package/lib/ObservedOutboundAudioTrack.js +0 -186
- package/lib/ObservedOutboundVideoTrack.d.ts +0 -91
- package/lib/ObservedOutboundVideoTrack.d.ts.map +0 -1
- package/lib/ObservedOutboundVideoTrack.js +0 -193
- package/lib/ObservedSfu.d.ts +0 -59
- package/lib/ObservedSfu.d.ts.map +0 -1
- package/lib/ObservedSfu.js +0 -157
- package/lib/ObservedSfuInboundRtpPad.d.ts +0 -42
- package/lib/ObservedSfuInboundRtpPad.d.ts.map +0 -1
- package/lib/ObservedSfuInboundRtpPad.js +0 -71
- package/lib/ObservedSfuOutboundRtpPad.d.ts +0 -42
- package/lib/ObservedSfuOutboundRtpPad.d.ts.map +0 -1
- package/lib/ObservedSfuOutboundRtpPad.js +0 -72
- package/lib/ObservedSfuSctpChannel.d.ts +0 -42
- package/lib/ObservedSfuSctpChannel.d.ts.map +0 -1
- package/lib/ObservedSfuSctpChannel.js +0 -57
- package/lib/ObservedSfuTransport.d.ts +0 -58
- package/lib/ObservedSfuTransport.d.ts.map +0 -1
- package/lib/ObservedSfuTransport.js +0 -120
- package/lib/RemoteTrackAssigner.d.ts +0 -14
- package/lib/RemoteTrackAssigner.d.ts.map +0 -1
- package/lib/RemoteTrackAssigner.js +0 -52
- package/lib/ReportsCollector.d.ts +0 -109
- package/lib/ReportsCollector.d.ts.map +0 -1
- package/lib/ReportsCollector.js +0 -207
- package/lib/common/CalculatedScore.d.ts +0 -80
- package/lib/common/CalculatedScore.d.ts.map +0 -1
- package/lib/common/CalculatedScore.js +0 -162
- package/lib/common/CallEventType.d.ts +0 -63
- package/lib/common/CallEventType.d.ts.map +0 -1
- package/lib/common/CallEventType.js +0 -39
- package/lib/common/CallMetaReports.d.ts +0 -42
- package/lib/common/CallMetaReports.d.ts.map +0 -1
- package/lib/common/CallMetaReports.js +0 -36
- package/lib/common/QualityScoreUtils.d.ts +0 -1
- package/lib/common/QualityScoreUtils.d.ts.map +0 -1
- package/lib/common/QualityScoreUtils.js +0 -1
- package/lib/common/TypedEventEmitter.d.ts +0 -22
- package/lib/common/TypedEventEmitter.d.ts.map +0 -1
- package/lib/common/TypedEventEmitter.js +0 -11
- package/lib/common/callEventReports.d.ts +0 -10
- package/lib/common/callEventReports.d.ts.map +0 -1
- package/lib/common/callEventReports.js +0 -112
- package/lib/monitors/CallSummary.d.ts +0 -37
- package/lib/monitors/CallSummary.d.ts.map +0 -1
- package/lib/monitors/CallSummaryMonitor.d.ts +0 -32
- package/lib/monitors/CallSummaryMonitor.d.ts.map +0 -1
- package/lib/monitors/CallSummaryMonitor.js +0 -152
- package/lib/monitors/ClientIssueMonitor.d.ts +0 -32
- package/lib/monitors/ClientIssueMonitor.d.ts.map +0 -1
- package/lib/monitors/ClientIssueMonitor.js +0 -49
- package/lib/monitors/SfuServerMonitor.d.ts +0 -79
- package/lib/monitors/SfuServerMonitor.d.ts.map +0 -1
- package/lib/monitors/SfuServerMonitor.js +0 -198
- package/src/ObservedICE.ts +0 -237
- package/src/ObservedInboundAudioTrack.ts +0 -344
- package/src/ObservedInboundVideoTrack.ts +0 -361
- package/src/ObservedOutboundAudioTrack.ts +0 -307
- package/src/ObservedOutboundVideoTrack.ts +0 -319
- package/src/ObservedSfu.ts +0 -231
- package/src/ObservedSfuInboundRtpPad.ts +0 -106
- package/src/ObservedSfuOutboundRtpPad.ts +0 -107
- package/src/ObservedSfuSctpChannel.ts +0 -103
- package/src/ObservedSfuTransport.ts +0 -185
- package/src/RemoteTrackAssigner.ts +0 -68
- package/src/ReportsCollector.ts +0 -336
- package/src/common/CalculatedScore.ts +0 -188
- package/src/common/CallEventType.ts +0 -69
- package/src/common/CallMetaReports.ts +0 -82
- package/src/common/QualityScoreUtils.ts +0 -0
- package/src/common/TypedEventEmitter.ts +0 -32
- package/src/common/callEventReports.ts +0 -178
- package/src/monitors/CallSummary.ts +0 -38
- package/src/monitors/CallSummaryMonitor.ts +0 -192
- package/src/monitors/ClientIssueMonitor.ts +0 -88
- package/src/monitors/SfuServerMonitor.ts +0 -285
- /package/lib/{monitors/CallSummary.js → scores/CalculatedScore.js} +0 -0
package/lib/Observer.js
CHANGED
|
@@ -1,255 +1,82 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
-
var t = {};
|
|
4
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
-
t[p] = s[p];
|
|
6
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
-
t[p[i]] = s[p[i]];
|
|
10
|
-
}
|
|
11
|
-
return t;
|
|
12
|
-
};
|
|
13
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
3
|
exports.Observer = void 0;
|
|
15
4
|
const logger_1 = require("./common/logger");
|
|
5
|
+
const Middleware_1 = require("./common/Middleware");
|
|
16
6
|
const ObservedCall_1 = require("./ObservedCall");
|
|
17
|
-
const ReportsCollector_1 = require("./ReportsCollector");
|
|
18
7
|
const events_1 = require("events");
|
|
19
|
-
const callEventReports_1 = require("./common/callEventReports");
|
|
20
|
-
const ObservedSfu_1 = require("./ObservedSfu");
|
|
21
|
-
const CallSummaryMonitor_1 = require("./monitors/CallSummaryMonitor");
|
|
22
|
-
const TurnUsageMonitor_1 = require("./monitors/TurnUsageMonitor");
|
|
23
|
-
const ClientIssueMonitor_1 = require("./monitors/ClientIssueMonitor");
|
|
24
|
-
const SfuServerMonitor_1 = require("./monitors/SfuServerMonitor");
|
|
25
8
|
const logger = (0, logger_1.createLogger)('Observer');
|
|
26
9
|
class Observer extends events_1.EventEmitter {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
logLevel: 'info',
|
|
37
|
-
}, providedConfig);
|
|
38
|
-
return new Observer(config);
|
|
39
|
-
}
|
|
40
|
-
constructor(config) {
|
|
10
|
+
processors = {
|
|
11
|
+
events: new Middleware_1.MiddlewareProcessor(),
|
|
12
|
+
metaData: new Middleware_1.MiddlewareProcessor(),
|
|
13
|
+
issues: new Middleware_1.MiddlewareProcessor(),
|
|
14
|
+
extensionStats: new Middleware_1.MiddlewareProcessor(),
|
|
15
|
+
};
|
|
16
|
+
observedCalls = new Map();
|
|
17
|
+
closed = false;
|
|
18
|
+
constructor() {
|
|
41
19
|
super();
|
|
42
|
-
this.config = config;
|
|
43
|
-
this.reports = new ReportsCollector_1.ReportsCollector();
|
|
44
|
-
this._observedCalls = new Map();
|
|
45
|
-
this._observedSfus = new Map();
|
|
46
|
-
this._monitors = new Map();
|
|
47
|
-
this._closed = false;
|
|
48
20
|
this.setMaxListeners(Infinity);
|
|
49
|
-
logger.debug('Observer is created with config', this.config);
|
|
50
|
-
const onReports = (context) => this.emit('reports', context);
|
|
51
|
-
const onNewReport = (collectedReports) => {
|
|
52
|
-
if (!this.config.maxReports || this._closed)
|
|
53
|
-
return;
|
|
54
|
-
if (this.config.maxReports < collectedReports) {
|
|
55
|
-
this._emitReports();
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
this._emitReports();
|
|
59
|
-
this.once('close', () => {
|
|
60
|
-
this.reports.off('newreport', onNewReport);
|
|
61
|
-
this.reports.off('reports', onReports);
|
|
62
|
-
});
|
|
63
|
-
this.reports.on('newreport', onNewReport);
|
|
64
|
-
this.reports.on('reports', onReports);
|
|
65
21
|
}
|
|
66
|
-
|
|
67
|
-
if (this.
|
|
22
|
+
getObservedCall(callId) {
|
|
23
|
+
if (this.closed || !this.observedCalls.has(callId))
|
|
24
|
+
return;
|
|
25
|
+
return this.observedCalls.get(callId);
|
|
26
|
+
}
|
|
27
|
+
createObservedCall(settings) {
|
|
28
|
+
if (this.closed) {
|
|
68
29
|
throw new Error('Attempted to create a call source on a closed observer');
|
|
69
30
|
}
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
throw new Error(`Observed Call with id ${call.callId} already exists`);
|
|
76
|
-
call.once('close', () => {
|
|
77
|
-
var _a;
|
|
78
|
-
this._observedCalls.delete(call.callId);
|
|
79
|
-
reportCallEnded && this.reports.addCallEventReport((0, callEventReports_1.createCallEndedEventReport)(call.serviceId, call.roomId, call.callId, (_a = call.observationEnded) !== null && _a !== void 0 ? _a : Date.now()));
|
|
31
|
+
const observedCall = new ObservedCall_1.ObservedCall(settings, this);
|
|
32
|
+
if (this.observedCalls.has(observedCall.callId))
|
|
33
|
+
throw new Error(`Observed Call with id ${observedCall.callId} already exists`);
|
|
34
|
+
observedCall.once('close', () => {
|
|
35
|
+
this.observedCalls.delete(observedCall.callId);
|
|
80
36
|
});
|
|
81
|
-
this.
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
return call;
|
|
37
|
+
this.observedCalls.set(observedCall.callId, observedCall);
|
|
38
|
+
this.emit('newcall', observedCall);
|
|
39
|
+
return observedCall;
|
|
85
40
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
}
|
|
90
|
-
const sfu = new ObservedSfu_1.ObservedSfu(model, this, appData);
|
|
91
|
-
if (this._closed)
|
|
92
|
-
throw new Error('Cannot create an observed sfu on a closed observer');
|
|
93
|
-
if (this._observedSfus.has(sfu.sfuId))
|
|
94
|
-
throw new Error(`Observed SFU with id ${sfu.sfuId} already exists`);
|
|
95
|
-
sfu.once('close', () => {
|
|
96
|
-
this._observedSfus.delete(sfu.sfuId);
|
|
97
|
-
});
|
|
98
|
-
this._observedSfus.set(sfu.sfuId, sfu);
|
|
99
|
-
this.emit('newsfu', sfu);
|
|
100
|
-
return sfu;
|
|
41
|
+
addClientEventMiddleware(...middlewares) {
|
|
42
|
+
this.processors.events.addMiddleware(...middlewares);
|
|
43
|
+
return this;
|
|
101
44
|
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
const existingMonitor = this._monitors.get(CallSummaryMonitor_1.CallSummaryMonitor.name);
|
|
106
|
-
if (existingMonitor)
|
|
107
|
-
return existingMonitor;
|
|
108
|
-
const monitor = new CallSummaryMonitor_1.CallSummaryMonitor(options);
|
|
109
|
-
const onNewCall = (call) => {
|
|
110
|
-
monitor.addCall(call);
|
|
111
|
-
call.once('close', () => {
|
|
112
|
-
var _a;
|
|
113
|
-
return setTimeout(() => {
|
|
114
|
-
const summary = monitor.takeSummary(call.callId);
|
|
115
|
-
summary && monitor.emit('summary', summary);
|
|
116
|
-
}, (_a = options === null || options === void 0 ? void 0 : options.timeoutAfterCallClose) !== null && _a !== void 0 ? _a : 1000);
|
|
117
|
-
});
|
|
118
|
-
};
|
|
119
|
-
monitor.once('close', () => {
|
|
120
|
-
this._monitors.delete(CallSummaryMonitor_1.CallSummaryMonitor.name);
|
|
121
|
-
this.off('newcall', onNewCall);
|
|
122
|
-
});
|
|
123
|
-
this._monitors.set(CallSummaryMonitor_1.CallSummaryMonitor.name, monitor);
|
|
124
|
-
this.on('newcall', onNewCall);
|
|
125
|
-
this.once('close', () => {
|
|
126
|
-
monitor.close();
|
|
127
|
-
});
|
|
128
|
-
return monitor;
|
|
45
|
+
removeClientEventMiddleware(...middlewares) {
|
|
46
|
+
this.processors.events.removeMiddleware(...middlewares);
|
|
47
|
+
return this;
|
|
129
48
|
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
const existingMonitor = this._monitors.get(TurnUsageMonitor_1.TurnUsageMonitor.name);
|
|
134
|
-
if (existingMonitor)
|
|
135
|
-
return existingMonitor;
|
|
136
|
-
const monitor = new TurnUsageMonitor_1.TurnUsageMonitor();
|
|
137
|
-
const onNewCall = (call) => {
|
|
138
|
-
const onNewClient = (client) => {
|
|
139
|
-
const onNewPeerConnection = (pc) => {
|
|
140
|
-
const onUsingTurnChanged = (usingTurn) => {
|
|
141
|
-
if (usingTurn)
|
|
142
|
-
monitor.addPeerConnection(pc);
|
|
143
|
-
else
|
|
144
|
-
monitor.removePeerConnection(pc);
|
|
145
|
-
};
|
|
146
|
-
pc.once('close', () => {
|
|
147
|
-
pc.ICE.off('usingturnchanged', onUsingTurnChanged);
|
|
148
|
-
monitor.removePeerConnection(pc);
|
|
149
|
-
});
|
|
150
|
-
pc.ICE.on('usingturnchanged', onUsingTurnChanged);
|
|
151
|
-
};
|
|
152
|
-
client.once('close', () => client.off('newpeerconnection', onNewPeerConnection));
|
|
153
|
-
client.on('newpeerconnection', onNewPeerConnection);
|
|
154
|
-
};
|
|
155
|
-
call.once('close', () => call.off('newclient', onNewClient));
|
|
156
|
-
call.on('newclient', onNewClient);
|
|
157
|
-
};
|
|
158
|
-
monitor.once('close', () => {
|
|
159
|
-
this._monitors.delete(TurnUsageMonitor_1.TurnUsageMonitor.name);
|
|
160
|
-
this.off('newcall', onNewCall);
|
|
161
|
-
});
|
|
162
|
-
this._monitors.set(TurnUsageMonitor_1.TurnUsageMonitor.name, monitor);
|
|
163
|
-
this.on('newcall', onNewCall);
|
|
164
|
-
this.once('close', () => {
|
|
165
|
-
monitor.close();
|
|
166
|
-
});
|
|
167
|
-
return monitor;
|
|
49
|
+
addClientMetaDataMiddleware(...middlewares) {
|
|
50
|
+
this.processors.metaData.addMiddleware(...middlewares);
|
|
51
|
+
return this;
|
|
168
52
|
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
const existingMonitor = this._monitors.get(SfuServerMonitor_1.SfuServerMonitor.name);
|
|
173
|
-
if (existingMonitor)
|
|
174
|
-
return existingMonitor;
|
|
175
|
-
const monitor = new SfuServerMonitor_1.SfuServerMonitor({
|
|
176
|
-
tooHighRttAlertSettings: {
|
|
177
|
-
minNumberOfPeerConnections: 10,
|
|
178
|
-
percentageOfPeerConnectionsHighWatermark: 0.5,
|
|
179
|
-
percentageOfPeerConnectionsLowWatermark: 0.2,
|
|
180
|
-
threshold: 'rtt-gt-300',
|
|
181
|
-
}
|
|
182
|
-
});
|
|
183
|
-
const onNewCall = (call) => {
|
|
184
|
-
const onNewClient = (client) => {
|
|
185
|
-
const onNewPeerConnection = (pc) => {
|
|
186
|
-
monitor.addPeerConnection(pc);
|
|
187
|
-
};
|
|
188
|
-
client.once('close', () => client.off('newpeerconnection', onNewPeerConnection));
|
|
189
|
-
client.on('newpeerconnection', onNewPeerConnection);
|
|
190
|
-
};
|
|
191
|
-
call.once('close', () => call.off('newclient', onNewClient));
|
|
192
|
-
call.on('newclient', onNewClient);
|
|
193
|
-
};
|
|
194
|
-
monitor.once('close', () => {
|
|
195
|
-
this._monitors.delete(SfuServerMonitor_1.SfuServerMonitor.name);
|
|
196
|
-
this.off('newcall', onNewCall);
|
|
197
|
-
});
|
|
198
|
-
this._monitors.set(SfuServerMonitor_1.SfuServerMonitor.name, monitor);
|
|
199
|
-
this.on('newcall', onNewCall);
|
|
200
|
-
this.once('close', () => {
|
|
201
|
-
monitor.close();
|
|
202
|
-
});
|
|
203
|
-
return monitor;
|
|
53
|
+
removeClientMetaDataMiddleware(...middlewares) {
|
|
54
|
+
this.processors.metaData.removeMiddleware(...middlewares);
|
|
55
|
+
return this;
|
|
204
56
|
}
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
const existingMonitor = this._monitors.get(ClientIssueMonitor_1.ClientIssueMonitor.name);
|
|
209
|
-
if (existingMonitor)
|
|
210
|
-
return existingMonitor;
|
|
211
|
-
const monitor = new ClientIssueMonitor_1.ClientIssueMonitor();
|
|
212
|
-
const onNewCall = (call) => monitor.addCall(call);
|
|
213
|
-
monitor.once('close', () => {
|
|
214
|
-
this._monitors.delete(ClientIssueMonitor_1.ClientIssueMonitor.name);
|
|
215
|
-
this.off('newcall', onNewCall);
|
|
216
|
-
});
|
|
217
|
-
this._monitors.set(ClientIssueMonitor_1.ClientIssueMonitor.name, monitor);
|
|
218
|
-
this.on('newcall', onNewCall);
|
|
219
|
-
this.once('close', () => {
|
|
220
|
-
monitor.close();
|
|
221
|
-
});
|
|
222
|
-
return monitor;
|
|
57
|
+
addClientIssueMiddleware(...middlewares) {
|
|
58
|
+
this.processors.issues.addMiddleware(...middlewares);
|
|
59
|
+
return this;
|
|
223
60
|
}
|
|
224
|
-
|
|
225
|
-
|
|
61
|
+
removeClientIssueMiddleware(...middlewares) {
|
|
62
|
+
this.processors.issues.removeMiddleware(...middlewares);
|
|
63
|
+
return this;
|
|
226
64
|
}
|
|
227
|
-
|
|
228
|
-
|
|
65
|
+
addExtensionStatMiddleware(...middlewares) {
|
|
66
|
+
this.processors.extensionStats.addMiddleware(...middlewares);
|
|
67
|
+
return this;
|
|
229
68
|
}
|
|
230
|
-
|
|
231
|
-
|
|
69
|
+
removeExtensionStatMiddleware(...middlewares) {
|
|
70
|
+
this.processors.extensionStats.removeMiddleware(...middlewares);
|
|
71
|
+
return this;
|
|
232
72
|
}
|
|
233
73
|
close() {
|
|
234
|
-
if (this.
|
|
74
|
+
if (this.closed) {
|
|
235
75
|
return logger.debug('Attempted to close twice');
|
|
236
76
|
}
|
|
237
|
-
this.
|
|
238
|
-
this.
|
|
77
|
+
this.closed = true;
|
|
78
|
+
this.observedCalls.forEach((call) => call.close());
|
|
239
79
|
this.emit('close');
|
|
240
80
|
}
|
|
241
|
-
_emitReports() {
|
|
242
|
-
if (this._reportTimer) {
|
|
243
|
-
clearTimeout(this._reportTimer);
|
|
244
|
-
this._reportTimer = undefined;
|
|
245
|
-
}
|
|
246
|
-
this.reports.emit();
|
|
247
|
-
if (this.config.maxCollectingTimeInMs) {
|
|
248
|
-
this._reportTimer = setTimeout(() => {
|
|
249
|
-
this._reportTimer = undefined;
|
|
250
|
-
this._emitReports();
|
|
251
|
-
}, this.config.maxCollectingTimeInMs);
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
81
|
}
|
|
255
82
|
exports.Observer = Observer;
|
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
export type Middleware<T> = (input: T, next: (nextInput: T) => void) => void;
|
|
2
2
|
export interface Processor<T> {
|
|
3
|
+
finalCallback?: Callback<T>;
|
|
3
4
|
process(value: T): void;
|
|
4
5
|
addMiddleware(...middlewares: Middleware<T>[]): Processor<T>;
|
|
5
6
|
removeMiddleware(...middlewares: Middleware<T>[]): Processor<T>;
|
|
6
7
|
}
|
|
7
|
-
|
|
8
|
+
type Callback<T> = (input: T) => void;
|
|
9
|
+
export declare class MiddlewareProcessor<T> implements Processor<T> {
|
|
10
|
+
private stack;
|
|
11
|
+
finalCallback?: Callback<T>;
|
|
12
|
+
addMiddleware(...middlewares: Middleware<T>[]): Processor<T>;
|
|
13
|
+
removeMiddleware(...middlewares: Middleware<T>[]): Processor<T>;
|
|
14
|
+
process(value: T): void;
|
|
15
|
+
}
|
|
16
|
+
export {};
|
|
8
17
|
//# sourceMappingURL=Middleware.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Middleware.d.ts","sourceRoot":"","sources":["../../src/common/Middleware.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI,CAC3B,KAAK,EAAE,CAAC,EACR,IAAI,EAAE,CAAC,SAAS,EAAE,CAAC,KAAK,IAAI,KACxB,IAAI,CAAC;AAEV,MAAM,WAAW,SAAS,CAAC,CAAC;IAC3B,OAAO,CAAC,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC;IACxB,aAAa,CAAC,GAAG,WAAW,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;IAC7D,gBAAgB,CAAC,GAAG,WAAW,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;CAChE;AAED,
|
|
1
|
+
{"version":3,"file":"Middleware.d.ts","sourceRoot":"","sources":["../../src/common/Middleware.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI,CAC3B,KAAK,EAAE,CAAC,EACR,IAAI,EAAE,CAAC,SAAS,EAAE,CAAC,KAAK,IAAI,KACxB,IAAI,CAAC;AAEV,MAAM,WAAW,SAAS,CAAC,CAAC;IAC3B,aAAa,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;IAC5B,OAAO,CAAC,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC;IACxB,aAAa,CAAC,GAAG,WAAW,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;IAC7D,gBAAgB,CAAC,GAAG,WAAW,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;CAChE;AAED,KAAK,QAAQ,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC;AAoCtC,qBAAa,mBAAmB,CAAC,CAAC,CAAE,YAAW,SAAS,CAAC,CAAC,CAAC;IAC1D,OAAO,CAAC,KAAK,CAAuB;IAC7B,aAAa,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;IAE5B,aAAa,CAAC,GAAG,WAAW,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,GAAG,SAAS,CAAC,CAAC,CAAC;IAQ5D,gBAAgB,CAAC,GAAG,WAAW,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,GAAG,SAAS,CAAC,CAAC,CAAC;IAc/D,OAAO,CAAC,KAAK,EAAE,CAAC,GAAG,IAAI;CAS9B"}
|
package/lib/common/Middleware.js
CHANGED
|
@@ -1,41 +1,60 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
3
|
+
exports.MiddlewareProcessor = void 0;
|
|
4
|
+
class Executor {
|
|
5
|
+
stack;
|
|
6
|
+
finalCallback;
|
|
7
|
+
done = false;
|
|
8
|
+
index = 0;
|
|
9
|
+
prevIndex = -1;
|
|
10
|
+
constructor(stack, finalCallback) {
|
|
11
|
+
this.stack = stack;
|
|
12
|
+
this.finalCallback = finalCallback;
|
|
13
|
+
}
|
|
14
|
+
// Executes the middleware stack
|
|
15
|
+
execute(input) {
|
|
16
|
+
if (this.index <= this.prevIndex) {
|
|
17
|
+
throw new Error('Middleware must call next() only once!');
|
|
18
|
+
}
|
|
19
|
+
else if (this.done) {
|
|
20
|
+
throw new Error('Middleware stack has already been executed!');
|
|
21
|
+
}
|
|
22
|
+
this.prevIndex = this.index;
|
|
23
|
+
const middleware = this.stack[this.index];
|
|
24
|
+
this.index++;
|
|
25
|
+
if (middleware) {
|
|
26
|
+
return middleware(input, (nextInput) => this.execute(nextInput));
|
|
27
|
+
}
|
|
28
|
+
this.done = true;
|
|
29
|
+
this.finalCallback?.(input);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
class MiddlewareProcessor {
|
|
33
|
+
stack = [];
|
|
34
|
+
finalCallback;
|
|
35
|
+
addMiddleware(...middlewares) {
|
|
36
|
+
if (middlewares && middlewares.length > 0) {
|
|
37
|
+
this.stack.push(...middlewares);
|
|
38
|
+
}
|
|
39
|
+
return this;
|
|
40
|
+
}
|
|
41
|
+
removeMiddleware(...middlewares) {
|
|
42
|
+
if (middlewares && middlewares.length > 0) {
|
|
43
|
+
for (const middleware of middlewares) {
|
|
44
|
+
const index = this.stack.indexOf(middleware);
|
|
45
|
+
if (index >= 0) {
|
|
46
|
+
this.stack.splice(index, 1);
|
|
19
47
|
}
|
|
20
48
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
if (!middleware)
|
|
32
|
-
return;
|
|
33
|
-
const next = (nextInput) => execute(index + 1, nextInput);
|
|
34
|
-
return middleware(input, next);
|
|
35
|
-
};
|
|
36
|
-
return execute(0, value);
|
|
37
|
-
},
|
|
38
|
-
};
|
|
39
|
-
return result;
|
|
49
|
+
}
|
|
50
|
+
return this;
|
|
51
|
+
}
|
|
52
|
+
process(value) {
|
|
53
|
+
if (this.stack.length === 0) {
|
|
54
|
+
return this.finalCallback?.(value);
|
|
55
|
+
}
|
|
56
|
+
const executor = new Executor(this.stack, this.finalCallback);
|
|
57
|
+
executor.execute(value);
|
|
58
|
+
}
|
|
40
59
|
}
|
|
41
|
-
exports.
|
|
60
|
+
exports.MiddlewareProcessor = MiddlewareProcessor;
|
package/lib/common/logger.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export type LogLevel = 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'silent';
|
|
2
1
|
export interface Logger {
|
|
3
2
|
trace(...args: any[]): void;
|
|
4
3
|
debug(...args: any[]): void;
|
|
@@ -6,8 +5,13 @@ export interface Logger {
|
|
|
6
5
|
warn(...args: any[]): void;
|
|
7
6
|
error(...args: any[]): void;
|
|
8
7
|
}
|
|
9
|
-
export
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
export interface ObserverLogger {
|
|
9
|
+
trace(module: string, ...args: any[]): void;
|
|
10
|
+
debug(module: string, ...args: any[]): void;
|
|
11
|
+
info(module: string, ...args: any[]): void;
|
|
12
|
+
warn(module: string, ...args: any[]): void;
|
|
13
|
+
error(module: string, ...args: any[]): void;
|
|
14
|
+
}
|
|
12
15
|
export declare function createLogger(moduleName: string): Logger;
|
|
16
|
+
export declare function setObserverLogger(logger: ObserverLogger): void;
|
|
13
17
|
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/common/logger.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/common/logger.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,MAAM;IAEtB,KAAK,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAE5B,KAAK,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAE5B,IAAI,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAE3B,IAAI,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAE3B,KAAK,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;CAC5B;AAED,MAAM,WAAW,cAAc;IAE9B,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAE5C,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAE5C,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAE3C,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAE3C,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;CAC5C;AA8BD,wBAAgB,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAuBvD;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,cAAc,QAEvD"}
|
package/lib/common/logger.js
CHANGED
|
@@ -1,74 +1,50 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
let
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
// eslint-disable-next-line no-console
|
|
8
|
-
|
|
9
|
-
//
|
|
10
|
-
debug
|
|
11
|
-
// eslint-disable-next-line no-console
|
|
12
|
-
info: (...args) => console.log(...args),
|
|
13
|
-
// eslint-disable-next-line no-console
|
|
14
|
-
warn: (...args) => console.warn(...args),
|
|
15
|
-
// eslint-disable-next-line no-console
|
|
16
|
-
error: (...args) => console.error(...args),
|
|
17
|
-
};
|
|
18
|
-
function setLogLevel(level) {
|
|
19
|
-
logLevel = level;
|
|
20
|
-
const moduleNames = Array.from(loggers.keys());
|
|
21
|
-
loggers.clear();
|
|
22
|
-
moduleNames.forEach((moduleName) => createLogger(moduleName));
|
|
23
|
-
}
|
|
24
|
-
exports.setLogLevel = setLogLevel;
|
|
25
|
-
const getLogLevel = () => {
|
|
26
|
-
return logLevel;
|
|
27
|
-
};
|
|
28
|
-
exports.getLogLevel = getLogLevel;
|
|
29
|
-
function forwardLogsTo(logger) {
|
|
30
|
-
target = logger;
|
|
31
|
-
}
|
|
32
|
-
exports.forwardLogsTo = forwardLogsTo;
|
|
33
|
-
const COLORS = {
|
|
34
|
-
black: '\x1b[30m',
|
|
35
|
-
red: '\x1b[31m',
|
|
36
|
-
green: '\x1b[32m',
|
|
37
|
-
yellow: '\x1b[33m',
|
|
38
|
-
blue: '\x1b[34m',
|
|
39
|
-
magenta: '\x1b[35m',
|
|
40
|
-
cyan: '\x1b[36m',
|
|
41
|
-
white: '\x1b[37m',
|
|
42
|
-
default: '\x1b[39m',
|
|
43
|
-
};
|
|
44
|
-
function createLogger(moduleName) {
|
|
45
|
-
if (loggers.has(moduleName)) {
|
|
3
|
+
exports.setObserverLogger = exports.createLogger = void 0;
|
|
4
|
+
let mainLogger = new class {
|
|
5
|
+
trace = () => void 0;
|
|
6
|
+
// trace(module: string, ...args: any[]) {
|
|
7
|
+
// // eslint-disable-next-line no-console
|
|
8
|
+
// console.log(`[TRACE] ${module}`, ...args);
|
|
9
|
+
// }
|
|
10
|
+
debug(module, ...args) {
|
|
46
11
|
// eslint-disable-next-line no-console
|
|
47
|
-
console.
|
|
12
|
+
console.log(`[DEBUG] ${module}`, ...args);
|
|
48
13
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
14
|
+
info(module, ...args) {
|
|
15
|
+
// eslint-disable-next-line no-console
|
|
16
|
+
console.info(`[INFO] ${module}`, ...args);
|
|
17
|
+
}
|
|
18
|
+
warn(module, ...args) {
|
|
19
|
+
// eslint-disable-next-line no-console
|
|
20
|
+
console.warn(`[WARN] ${module}`, ...args);
|
|
21
|
+
}
|
|
22
|
+
error(module, ...args) {
|
|
23
|
+
// eslint-disable-next-line no-console
|
|
24
|
+
console.error(`[ERROR] ${module}`, ...args);
|
|
25
|
+
}
|
|
26
|
+
}();
|
|
27
|
+
function createLogger(moduleName) {
|
|
28
|
+
return new class {
|
|
29
|
+
trace(...args) {
|
|
30
|
+
mainLogger.trace(moduleName, ...args);
|
|
31
|
+
}
|
|
32
|
+
debug(...args) {
|
|
33
|
+
mainLogger.debug(moduleName, ...args);
|
|
34
|
+
}
|
|
35
|
+
info(...args) {
|
|
36
|
+
mainLogger.info(moduleName, ...args);
|
|
37
|
+
}
|
|
38
|
+
warn(...args) {
|
|
39
|
+
mainLogger.warn(moduleName, ...args);
|
|
40
|
+
}
|
|
41
|
+
error(...args) {
|
|
42
|
+
mainLogger.error(moduleName, ...args);
|
|
43
|
+
}
|
|
44
|
+
}();
|
|
73
45
|
}
|
|
74
46
|
exports.createLogger = createLogger;
|
|
47
|
+
function setObserverLogger(logger) {
|
|
48
|
+
mainLogger = logger;
|
|
49
|
+
}
|
|
50
|
+
exports.setObserverLogger = setObserverLogger;
|
package/lib/common/types.d.ts
CHANGED
|
@@ -1,24 +1,3 @@
|
|
|
1
|
-
import { CallEventReport, CallMetaReport, ClientDataChannelReport, ClientExtensionReport, IceCandidatePairReport, InboundAudioTrackReport, InboundVideoTrackReport, ObserverEventReport, OutboundAudioTrackReport, OutboundVideoTrackReport, PeerConnectionTransportReport, SfuEventReport, SfuExtensionReport, SfuInboundRtpPadReport, SfuMetaReport, SfuOutboundRtpPadReport, SfuSctpStreamReport, SFUTransportReport } from '@observertc/report-schemas-js';
|
|
2
1
|
export type MediaKind = 'audio' | 'video';
|
|
3
2
|
export type SupportedVideoCodecType = 'vp8' | 'vp9' | 'h264' | 'h265';
|
|
4
|
-
export interface ObserverSinkContext {
|
|
5
|
-
readonly callEventReports: CallEventReport[];
|
|
6
|
-
readonly callMetaReports: CallMetaReport[];
|
|
7
|
-
readonly clientDataChannelReports: ClientDataChannelReport[];
|
|
8
|
-
readonly clientExtensionReports: ClientExtensionReport[];
|
|
9
|
-
readonly iceCandidatePairReports: IceCandidatePairReport[];
|
|
10
|
-
readonly inboundAudioTrackReports: InboundAudioTrackReport[];
|
|
11
|
-
readonly inboundVideoTrackReports: InboundVideoTrackReport[];
|
|
12
|
-
readonly peerConnectionTransportReports: PeerConnectionTransportReport[];
|
|
13
|
-
readonly observerEventReports: ObserverEventReport[];
|
|
14
|
-
readonly outboundAudioTrackReports: OutboundAudioTrackReport[];
|
|
15
|
-
readonly outboundVideoTrackReports: OutboundVideoTrackReport[];
|
|
16
|
-
readonly sfuEventReports: SfuEventReport[];
|
|
17
|
-
readonly sfuExtensionReports: SfuExtensionReport[];
|
|
18
|
-
readonly sfuInboundRtpPadReports: SfuInboundRtpPadReport[];
|
|
19
|
-
readonly sfuOutboundRtpPadReports: SfuOutboundRtpPadReport[];
|
|
20
|
-
readonly sfuSctpStreamReports: SfuSctpStreamReport[];
|
|
21
|
-
readonly sfuTransportReports: SFUTransportReport[];
|
|
22
|
-
readonly sfuMetaReports: SfuMetaReport[];
|
|
23
|
-
}
|
|
24
3
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/common/types.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/common/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,OAAO,CAAC;AAC1C,MAAM,MAAM,uBAAuB,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,CAAC"}
|
package/lib/common/types.js
CHANGED
package/lib/common/utils.d.ts
CHANGED
|
@@ -6,4 +6,5 @@ export declare function iteratorConverter<T>(generator: Generator<T, void, undef
|
|
|
6
6
|
export declare function asyncIteratorConverter<T>(generator: AsyncGenerator<T, void, undefined>): AsyncIterableIterator<T>;
|
|
7
7
|
export declare function isValidUuid(str: string): boolean;
|
|
8
8
|
export declare function getMedian(arr: number[]): number;
|
|
9
|
+
export declare function parseJsonAs<T>(json?: string): T | undefined;
|
|
9
10
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/common/utils.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AAE/E,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI,CAAC,SAAS,MAAM,GAAG;IAAE,CAAC,UAAU,CAAC,IAAI,MAAM,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAE,GAAG,CAAC,CAAC;AAE9F,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,CAAC,GAAG,gBAAgB,CAAC,CAAC,CAAC,CASlG;AAED,wBAAgB,sBAAsB,CAAC,CAAC,EAAE,SAAS,EAAE,cAAc,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,CAAC,GAAG,qBAAqB,CAAC,CAAC,CAAC,CASjH;AAED,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAIhD;AAED,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,MAAM,CAc/C"}
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/common/utils.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AAE/E,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI,CAAC,SAAS,MAAM,GAAG;IAAE,CAAC,UAAU,CAAC,IAAI,MAAM,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAE,GAAG,CAAC,CAAC;AAE9F,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,CAAC,GAAG,gBAAgB,CAAC,CAAC,CAAC,CASlG;AAED,wBAAgB,sBAAsB,CAAC,CAAC,EAAE,SAAS,EAAE,cAAc,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,CAAC,GAAG,qBAAqB,CAAC,CAAC,CAAC,CASjH;AAED,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAIhD;AAED,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,MAAM,CAc/C;AAED,wBAAgB,WAAW,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS,CAU3D"}
|