@observertc/observer-js 0.41.7 → 0.42.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/ObservedCall.d.ts +10 -3
- package/lib/ObservedCall.d.ts.map +1 -1
- package/lib/ObservedCall.js +28 -0
- package/lib/ObservedClient.d.ts +5 -0
- package/lib/ObservedClient.d.ts.map +1 -1
- package/lib/ObservedClient.js +83 -32
- package/lib/ObservedInboundAudioTrack.d.ts +94 -0
- package/lib/ObservedInboundAudioTrack.d.ts.map +1 -0
- package/lib/ObservedInboundAudioTrack.js +215 -0
- package/lib/ObservedInboundVideoTrack.d.ts +98 -0
- package/lib/ObservedInboundVideoTrack.d.ts.map +1 -0
- package/lib/{ObservedInboundTrack.js → ObservedInboundVideoTrack.js} +53 -44
- package/lib/ObservedOutboundAudioTrack.d.ts +85 -0
- package/lib/ObservedOutboundAudioTrack.d.ts.map +1 -0
- package/lib/{ObservedOutboundTrack.js → ObservedOutboundAudioTrack.js} +35 -58
- package/lib/ObservedOutboundVideoTrack.d.ts +88 -0
- package/lib/ObservedOutboundVideoTrack.d.ts.map +1 -0
- package/lib/ObservedOutboundVideoTrack.js +204 -0
- package/lib/ObservedPeerConnection.d.ts +26 -16
- package/lib/ObservedPeerConnection.d.ts.map +1 -1
- package/lib/ObservedPeerConnection.js +157 -86
- package/lib/Observer.d.ts +1 -0
- package/lib/Observer.d.ts.map +1 -1
- package/lib/Observer.js +2 -2
- package/lib/RemoteTrackAssigner.d.ts +14 -0
- package/lib/RemoteTrackAssigner.d.ts.map +1 -0
- package/lib/RemoteTrackAssigner.js +52 -0
- package/lib/common/CalculatedScore.d.ts +79 -0
- package/lib/common/CalculatedScore.d.ts.map +1 -0
- package/lib/common/CalculatedScore.js +155 -0
- package/lib/common/QualityScoreUtils.d.ts +1 -0
- package/lib/common/QualityScoreUtils.d.ts.map +1 -0
- package/lib/common/QualityScoreUtils.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 +14 -1
- package/lib/index.d.ts +4 -2
- package/lib/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/ObservedCall.ts +40 -4
- package/src/ObservedClient.ts +79 -17
- package/src/ObservedInboundAudioTrack.ts +336 -0
- package/src/{ObservedInboundTrack.ts → ObservedInboundVideoTrack.ts} +85 -66
- package/src/{ObservedOutboundTrack.ts → ObservedOutboundAudioTrack.ts} +59 -74
- package/src/ObservedOutboundVideoTrack.ts +326 -0
- package/src/ObservedPeerConnection.ts +205 -131
- package/src/Observer.ts +3 -2
- package/src/RemoteTrackAssigner.ts +68 -0
- package/src/common/CalculatedScore.ts +180 -0
- package/src/common/QualityScoreUtils.ts +0 -0
- package/src/common/utils.ts +17 -1
- package/src/index.ts +4 -2
- package/src/monitors/CallSummaryMonitor.ts +3 -3
- package/lib/ObservedInboundTrack.d.ts +0 -96
- package/lib/ObservedInboundTrack.d.ts.map +0 -1
- package/lib/ObservedOutboundTrack.d.ts +0 -84
- package/lib/ObservedOutboundTrack.d.ts.map +0 -1
package/lib/ObservedCall.d.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { EventEmitter } from 'events';
|
|
3
3
|
import { ObservedClient, ObservedClientModel } from './ObservedClient';
|
|
4
|
-
import { ObservedOutboundTrack } from './ObservedOutboundTrack';
|
|
5
4
|
import { Observer } from './Observer';
|
|
6
5
|
import { PartialBy } from './common/utils';
|
|
7
6
|
import { CallEventReport } from '@observertc/report-schemas-js';
|
|
8
7
|
import { ClientSample } from '@observertc/sample-schemas-js';
|
|
9
8
|
import { ClientIssue } from './monitors/CallSummary';
|
|
9
|
+
import { ObservedOutboundAudioTrack } from './ObservedOutboundAudioTrack';
|
|
10
|
+
import { ObservedOutboundVideoTrack } from './ObservedOutboundVideoTrack';
|
|
11
|
+
import { CalculatedScore } from './common/CalculatedScore';
|
|
10
12
|
type ClientIssueDetectionConfig = Pick<ClientIssue, 'severity'>;
|
|
11
13
|
export type ObservedCallModel = {
|
|
12
14
|
serviceId: string;
|
|
@@ -32,8 +34,12 @@ export declare class ObservedCall<AppData extends Record<string, unknown> = Reco
|
|
|
32
34
|
readonly created: number;
|
|
33
35
|
readonly processor: import("./common/Middleware").Processor<ClientSample>;
|
|
34
36
|
private readonly _clients;
|
|
35
|
-
|
|
36
|
-
|
|
37
|
+
_scoreData?: {
|
|
38
|
+
score: CalculatedScore;
|
|
39
|
+
calculated: number;
|
|
40
|
+
};
|
|
41
|
+
readonly sfuStreamIdToOutboundAudioTrack: Map<string | number, ObservedOutboundAudioTrack>;
|
|
42
|
+
readonly sfuStreamIdToOutboundVideoTrack: Map<string | number, ObservedOutboundVideoTrack>;
|
|
37
43
|
private _closed;
|
|
38
44
|
private _updated;
|
|
39
45
|
private _ended?;
|
|
@@ -45,6 +51,7 @@ export declare class ObservedCall<AppData extends Record<string, unknown> = Reco
|
|
|
45
51
|
get updated(): number;
|
|
46
52
|
get ended(): number | undefined;
|
|
47
53
|
get clients(): ReadonlyMap<string, ObservedClient>;
|
|
54
|
+
get score(): CalculatedScore | undefined;
|
|
48
55
|
get closed(): boolean;
|
|
49
56
|
close(timestamp?: number): void;
|
|
50
57
|
addEventReport(params: PartialBy<Omit<CallEventReport, 'serviceId' | 'roomId' | 'callId'>, 'timestamp'>): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ObservedCall.d.ts","sourceRoot":"","sources":["../src/ObservedCall.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,cAAc,EAAwB,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC7F,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"ObservedCall.d.ts","sourceRoot":"","sources":["../src/ObservedCall.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAC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CAAC,MAAM,EAAE,cAAc,CAAC,CAExD;IAED,IAAW,KAAK,IAAI,eAAe,GAAG,SAAS,CA2B9C;IAED,IAAW,MAAM,YAEhB;IAEM,KAAK,CAAC,SAAS,CAAC,EAAE,MAAM;IAUxB,cAAc,CAAC,MAAM,EAAE,SAAS,CAAC,IAAI,CAAC,eAAe,EAAE,WAAW,GAAG,QAAQ,GAAG,QAAQ,CAAE,EAAE,WAAW,CAAC;IAUxG,YAAY,CAAC,aAAa,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,mBAAmB,GAAG;QAC1H,OAAO,EAAE,aAAa,CAAC;QACvB,0BAA0B,CAAC,EAAE,OAAO,CAAC;QACrC,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,YAAY,CAAC,EAAE;YACd,MAAM,EAAE,WAAW,CAAC,UAAU,CAAC,GAAG,0BAA0B,CAAC;SAC7D,CAAC;KACF;CAiED"}
|
package/lib/ObservedCall.js
CHANGED
|
@@ -15,6 +15,7 @@ exports.ObservedCall = void 0;
|
|
|
15
15
|
const events_1 = require("events");
|
|
16
16
|
const ObservedClient_1 = require("./ObservedClient");
|
|
17
17
|
const callEventReports_1 = require("./common/callEventReports");
|
|
18
|
+
const utils_1 = require("./common/utils");
|
|
18
19
|
const Middleware_1 = require("./common/Middleware");
|
|
19
20
|
class ObservedCall extends events_1.EventEmitter {
|
|
20
21
|
constructor(_model, observer, appData) {
|
|
@@ -55,6 +56,33 @@ class ObservedCall extends events_1.EventEmitter {
|
|
|
55
56
|
get clients() {
|
|
56
57
|
return this._clients;
|
|
57
58
|
}
|
|
59
|
+
get score() {
|
|
60
|
+
var _a, _b, _c;
|
|
61
|
+
const now = Date.now();
|
|
62
|
+
if (now - 15000 < ((_b = (_a = this._scoreData) === null || _a === void 0 ? void 0 : _a.calculated) !== null && _b !== void 0 ? _b : 0)) {
|
|
63
|
+
return (_c = this._scoreData) === null || _c === void 0 ? void 0 : _c.score;
|
|
64
|
+
}
|
|
65
|
+
else if (this.clients.size < 1) {
|
|
66
|
+
return {
|
|
67
|
+
remarks: [{
|
|
68
|
+
severity: 'none',
|
|
69
|
+
text: 'No clients',
|
|
70
|
+
}],
|
|
71
|
+
score: 5.0,
|
|
72
|
+
timestamp: now,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
const scores = [...this.clients.values()].map((client) => { var _a, _b; return (_b = (_a = client.score) === null || _a === void 0 ? void 0 : _a.score) !== null && _b !== void 0 ? _b : 5.0; });
|
|
76
|
+
this._scoreData = {
|
|
77
|
+
score: {
|
|
78
|
+
remarks: [],
|
|
79
|
+
score: (0, utils_1.getMedian)(scores),
|
|
80
|
+
timestamp: now,
|
|
81
|
+
},
|
|
82
|
+
calculated: now,
|
|
83
|
+
};
|
|
84
|
+
return this._scoreData.score;
|
|
85
|
+
}
|
|
58
86
|
get closed() {
|
|
59
87
|
return this._closed;
|
|
60
88
|
}
|
package/lib/ObservedClient.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ import { PartialBy } from './common/utils';
|
|
|
7
7
|
import { ObservedSfu } from './ObservedSfu';
|
|
8
8
|
import { ClientIssue } from './monitors/CallSummary';
|
|
9
9
|
import { CallEventReport } from '@observertc/report-schemas-js';
|
|
10
|
+
import { CalculatedScore } from './common/CalculatedScore';
|
|
10
11
|
export type ObservedClientModel = {
|
|
11
12
|
clientId: string;
|
|
12
13
|
mediaUnitId: string;
|
|
@@ -63,6 +64,7 @@ export type ObservedClientEvents = {
|
|
|
63
64
|
lastJoined: number;
|
|
64
65
|
}
|
|
65
66
|
];
|
|
67
|
+
score: [CalculatedScore];
|
|
66
68
|
};
|
|
67
69
|
export declare interface ObservedClient<AppData extends Record<string, unknown> = Record<string, unknown>> {
|
|
68
70
|
on<U extends keyof ObservedClientEvents>(event: U, listener: (...args: ObservedClientEvents[U]) => void): this;
|
|
@@ -84,6 +86,7 @@ export declare class ObservedClient<AppData extends Record<string, unknown> = Re
|
|
|
84
86
|
private _acceptedSamples;
|
|
85
87
|
private _timeZoneOffsetInHours?;
|
|
86
88
|
private _left?;
|
|
89
|
+
score?: CalculatedScore;
|
|
87
90
|
usingTURN: boolean;
|
|
88
91
|
availableOutgoingBitrate: number;
|
|
89
92
|
availableIncomingBitrate: number;
|
|
@@ -112,6 +115,7 @@ export declare class ObservedClient<AppData extends Record<string, unknown> = Re
|
|
|
112
115
|
outboundVideoBitrate?: number;
|
|
113
116
|
inboundAudioBitrate?: number;
|
|
114
117
|
inboundVideoBitrate?: number;
|
|
118
|
+
mediaConstraints: string[];
|
|
115
119
|
readonly mediaDevices: string[];
|
|
116
120
|
readonly codecs: string[];
|
|
117
121
|
readonly userMediaErrors: string[];
|
|
@@ -154,6 +158,7 @@ export declare class ObservedClient<AppData extends Record<string, unknown> = Re
|
|
|
154
158
|
addExtensionStatsReport(extensionType: string, payload?: Record<string, unknown>): void;
|
|
155
159
|
addIssue(issue: ClientIssue): void;
|
|
156
160
|
accept(sample: ClientSample): void;
|
|
161
|
+
private _addAndEmitIssue;
|
|
157
162
|
private _createPeerConnection;
|
|
158
163
|
private _addClientLeftReport;
|
|
159
164
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ObservedClient.d.ts","sourceRoot":"","sources":["../src/ObservedClient.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAChJ,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAIlE,OAAO,EAAE,SAAS,EAAe,MAAM,gBAAgB,CAAC;AAGxD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,C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.deltaInboundPacketsReceived = 0;
|
|
57
57
|
this.deltaOutboundPacketsSent = 0;
|
|
58
|
+
this.mediaConstraints = [];
|
|
58
59
|
this.mediaDevices = [];
|
|
59
60
|
this.codecs = [];
|
|
60
61
|
this.userMediaErrors = [];
|
|
@@ -191,11 +192,10 @@ class ObservedClient extends events_1.EventEmitter {
|
|
|
191
192
|
catch (err) {
|
|
192
193
|
logger.warn(`Error adding client issue: ${err === null || err === void 0 ? void 0 : err.message}`);
|
|
193
194
|
}
|
|
194
|
-
this.
|
|
195
|
-
this.emit('issue', issue);
|
|
195
|
+
this._addAndEmitIssue(issue);
|
|
196
196
|
}
|
|
197
197
|
accept(sample) {
|
|
198
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20;
|
|
198
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26;
|
|
199
199
|
if (this._closed)
|
|
200
200
|
throw new Error(`Client ${this.clientId} is closed`);
|
|
201
201
|
if (sample.clientId && sample.clientId !== 'NULL' && sample.clientId !== this.clientId) {
|
|
@@ -267,6 +267,7 @@ class ObservedClient extends events_1.EventEmitter {
|
|
|
267
267
|
payload: mediaConstraint,
|
|
268
268
|
}, this.userId, undefined, sample.timestamp);
|
|
269
269
|
this.reports.addCallMetaReport(callMetaReport);
|
|
270
|
+
this.mediaConstraints.push(mediaConstraint);
|
|
270
271
|
}
|
|
271
272
|
for (const localSDP of (_m = sample.localSDPs) !== null && _m !== void 0 ? _m : []) {
|
|
272
273
|
const callMetaReport = (0, CallMetaReports_1.createCallMetaReport)(this.serviceId, this.mediaUnitId, this.roomId, this.callId, this.clientId, {
|
|
@@ -288,8 +289,8 @@ class ObservedClient extends events_1.EventEmitter {
|
|
|
288
289
|
extensionType: extensionStats.type,
|
|
289
290
|
});
|
|
290
291
|
}
|
|
291
|
-
for (let
|
|
292
|
-
const { timestamp } =
|
|
292
|
+
for (let _27 of (_p = sample.customCallEvents) !== null && _p !== void 0 ? _p : []) {
|
|
293
|
+
const { timestamp } = _27, callEvent = __rest(_27, ["timestamp"]);
|
|
293
294
|
switch (callEvent.name) {
|
|
294
295
|
case CallEventType_1.CallEventType.CLIENT_JOINED: {
|
|
295
296
|
const lastJoined = this._joinedEventAt;
|
|
@@ -314,8 +315,7 @@ class ObservedClient extends events_1.EventEmitter {
|
|
|
314
315
|
trackId: callEvent.mediaTrackId,
|
|
315
316
|
attachments: callEvent.attachments ? JSON.parse(callEvent.attachments) : undefined,
|
|
316
317
|
};
|
|
317
|
-
this.
|
|
318
|
-
this.emit('issue', issue);
|
|
318
|
+
this._addAndEmitIssue(issue);
|
|
319
319
|
}
|
|
320
320
|
catch (err) {
|
|
321
321
|
logger.warn(`Error parsing client issue: ${err === null || err === void 0 ? void 0 : err.message}`);
|
|
@@ -397,16 +397,23 @@ class ObservedClient extends events_1.EventEmitter {
|
|
|
397
397
|
sfuSinkId: track.sfuSinkId,
|
|
398
398
|
});
|
|
399
399
|
inboundAudioTrack.update(track, sample.timestamp);
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
remoteOutboundTrack
|
|
400
|
+
if (!inboundAudioTrack.remoteOutboundTrack) {
|
|
401
|
+
const remoteOutboundTrack = this.call.sfuStreamIdToOutboundAudioTrack.get((_1 = inboundAudioTrack.sfuStreamId) !== null && _1 !== void 0 ? _1 : '');
|
|
402
|
+
if (remoteOutboundTrack) {
|
|
403
|
+
inboundAudioTrack.remoteOutboundTrack = remoteOutboundTrack;
|
|
404
|
+
inboundAudioTrack.once('close', () => {
|
|
405
|
+
var _a;
|
|
406
|
+
remoteOutboundTrack === null || remoteOutboundTrack === void 0 ? void 0 : remoteOutboundTrack.remoteInboundTracks.delete((_a = inboundAudioTrack.trackId) !== null && _a !== void 0 ? _a : '');
|
|
407
|
+
});
|
|
408
|
+
remoteOutboundTrack.remoteInboundTracks.set((_2 = inboundAudioTrack.trackId) !== null && _2 !== void 0 ? _2 : '', inboundAudioTrack);
|
|
409
|
+
}
|
|
403
410
|
}
|
|
404
411
|
}
|
|
405
412
|
catch (err) {
|
|
406
413
|
logger.error(`Error creating inbound audio track: ${err === null || err === void 0 ? void 0 : err.message}`);
|
|
407
414
|
}
|
|
408
415
|
}
|
|
409
|
-
for (const track of (
|
|
416
|
+
for (const track of (_3 = sample.inboundVideoTracks) !== null && _3 !== void 0 ? _3 : []) {
|
|
410
417
|
if (!track.peerConnectionId || !track.trackId) {
|
|
411
418
|
logger.warn(`InboundVideoTrack without peerConnectionId or trackId: ${JSON.stringify(track)}`);
|
|
412
419
|
continue;
|
|
@@ -419,63 +426,76 @@ class ObservedClient extends events_1.EventEmitter {
|
|
|
419
426
|
continue;
|
|
420
427
|
}
|
|
421
428
|
try {
|
|
422
|
-
const peerConnection = (
|
|
429
|
+
const peerConnection = (_4 = this._peerConnections.get(track.peerConnectionId)) !== null && _4 !== void 0 ? _4 : this._createPeerConnection(track.peerConnectionId);
|
|
423
430
|
if (!peerConnection)
|
|
424
431
|
continue;
|
|
425
|
-
const inboundVideoTrack = (
|
|
432
|
+
const inboundVideoTrack = (_5 = peerConnection.inboundVideoTracks.get(track.trackId)) !== null && _5 !== void 0 ? _5 : peerConnection.createInboundVideoTrack({
|
|
426
433
|
trackId: track.trackId,
|
|
427
434
|
sfuStreamId: track.sfuStreamId,
|
|
428
435
|
sfuSinkId: track.sfuSinkId,
|
|
429
436
|
});
|
|
430
437
|
inboundVideoTrack.update(track, sample.timestamp);
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
remoteOutboundTrack
|
|
438
|
+
if (!inboundVideoTrack.remoteOutboundTrack) {
|
|
439
|
+
const remoteOutboundTrack = this.call.sfuStreamIdToOutboundVideoTrack.get((_6 = inboundVideoTrack.sfuStreamId) !== null && _6 !== void 0 ? _6 : '');
|
|
440
|
+
if (remoteOutboundTrack) {
|
|
441
|
+
inboundVideoTrack.remoteOutboundTrack = remoteOutboundTrack;
|
|
442
|
+
inboundVideoTrack.once('close', () => {
|
|
443
|
+
var _a;
|
|
444
|
+
remoteOutboundTrack === null || remoteOutboundTrack === void 0 ? void 0 : remoteOutboundTrack.remoteInboundTracks.delete((_a = inboundVideoTrack.trackId) !== null && _a !== void 0 ? _a : '');
|
|
445
|
+
});
|
|
446
|
+
remoteOutboundTrack.remoteInboundTracks.set((_7 = inboundVideoTrack.trackId) !== null && _7 !== void 0 ? _7 : '', inboundVideoTrack);
|
|
447
|
+
}
|
|
434
448
|
}
|
|
435
449
|
}
|
|
436
450
|
catch (err) {
|
|
437
451
|
logger.error(`Error creating inbound video track: ${err === null || err === void 0 ? void 0 : err.message}`);
|
|
438
452
|
}
|
|
439
453
|
}
|
|
440
|
-
for (const track of (
|
|
454
|
+
for (const track of (_8 = sample.outboundAudioTracks) !== null && _8 !== void 0 ? _8 : []) {
|
|
441
455
|
if (!track.peerConnectionId || !track.trackId) {
|
|
442
456
|
logger.warn(`OutboundAudioTrack without peerConnectionId or trackId: ${JSON.stringify(track)}`);
|
|
443
457
|
continue;
|
|
444
458
|
}
|
|
445
459
|
try {
|
|
446
|
-
const peerConnection = (
|
|
460
|
+
const peerConnection = (_9 = this._peerConnections.get(track.peerConnectionId)) !== null && _9 !== void 0 ? _9 : this._createPeerConnection(track.peerConnectionId);
|
|
447
461
|
if (!peerConnection)
|
|
448
462
|
continue;
|
|
449
|
-
const outboundAudioTrack = (
|
|
463
|
+
const outboundAudioTrack = (_10 = peerConnection.outboundAudioTracks.get(track.trackId)) !== null && _10 !== void 0 ? _10 : peerConnection.createOutboundAudioTrack({
|
|
450
464
|
trackId: track.trackId,
|
|
451
465
|
sfuStreamId: track.sfuStreamId,
|
|
452
466
|
});
|
|
453
467
|
outboundAudioTrack.update(track, sample.timestamp);
|
|
468
|
+
if (outboundAudioTrack.sfuStreamId && !this.call.sfuStreamIdToOutboundAudioTrack.has(outboundAudioTrack.sfuStreamId)) {
|
|
469
|
+
this.call.sfuStreamIdToOutboundAudioTrack.set(outboundAudioTrack.sfuStreamId, outboundAudioTrack);
|
|
470
|
+
}
|
|
454
471
|
}
|
|
455
472
|
catch (err) {
|
|
456
473
|
logger.error(`Error creating outbound audio track: ${err === null || err === void 0 ? void 0 : err.message}`);
|
|
457
474
|
}
|
|
458
475
|
}
|
|
459
|
-
for (const track of (
|
|
476
|
+
for (const track of (_11 = sample.outboundVideoTracks) !== null && _11 !== void 0 ? _11 : []) {
|
|
460
477
|
if (!track.peerConnectionId || !track.trackId) {
|
|
461
478
|
logger.warn(`OutboundVideoTrack without peerConnectionId or trackId: ${JSON.stringify(track)}`);
|
|
462
479
|
continue;
|
|
463
480
|
}
|
|
464
481
|
try {
|
|
465
|
-
const peerConnection = (
|
|
482
|
+
const peerConnection = (_12 = this._peerConnections.get(track.peerConnectionId)) !== null && _12 !== void 0 ? _12 : this._createPeerConnection(track.peerConnectionId);
|
|
466
483
|
if (!peerConnection)
|
|
467
484
|
continue;
|
|
468
|
-
const outboundVideoTrack = (
|
|
485
|
+
const outboundVideoTrack = (_13 = peerConnection.outboundVideoTracks.get(track.trackId)) !== null && _13 !== void 0 ? _13 : peerConnection.createOutboundVideoTrack({
|
|
469
486
|
trackId: track.trackId,
|
|
470
487
|
sfuStreamId: track.sfuStreamId,
|
|
471
488
|
});
|
|
472
489
|
outboundVideoTrack.update(track, sample.timestamp);
|
|
490
|
+
if (outboundVideoTrack.sfuStreamId && !this.call.sfuStreamIdToOutboundVideoTrack.has(outboundVideoTrack.sfuStreamId)) {
|
|
491
|
+
this.call.sfuStreamIdToOutboundVideoTrack.set(outboundVideoTrack.sfuStreamId, outboundVideoTrack);
|
|
492
|
+
}
|
|
473
493
|
}
|
|
474
494
|
catch (err) {
|
|
475
495
|
logger.error(`Error creating outbound video track: ${err === null || err === void 0 ? void 0 : err.message}`);
|
|
476
496
|
}
|
|
477
497
|
}
|
|
478
|
-
for (const iceLocalCandidate of (
|
|
498
|
+
for (const iceLocalCandidate of (_14 = sample.iceLocalCandidates) !== null && _14 !== void 0 ? _14 : []) {
|
|
479
499
|
if (!iceLocalCandidate.peerConnectionId) {
|
|
480
500
|
logger.warn(`Local ice candidate without peerConnectionId: ${JSON.stringify(iceLocalCandidate)}`);
|
|
481
501
|
continue;
|
|
@@ -487,7 +507,7 @@ class ObservedClient extends events_1.EventEmitter {
|
|
|
487
507
|
}
|
|
488
508
|
peerConnection.ICE.addLocalCandidate(iceLocalCandidate, sample.timestamp);
|
|
489
509
|
}
|
|
490
|
-
for (const iceRemoteCandidate of (
|
|
510
|
+
for (const iceRemoteCandidate of (_15 = sample.iceRemoteCandidates) !== null && _15 !== void 0 ? _15 : []) {
|
|
491
511
|
if (!iceRemoteCandidate.peerConnectionId) {
|
|
492
512
|
logger.warn(`Remote ice candidate without peerConnectionId: ${JSON.stringify(iceRemoteCandidate)}`);
|
|
493
513
|
continue;
|
|
@@ -499,7 +519,7 @@ class ObservedClient extends events_1.EventEmitter {
|
|
|
499
519
|
}
|
|
500
520
|
peerConnection.ICE.addRemoteCandidate(iceRemoteCandidate, sample.timestamp);
|
|
501
521
|
}
|
|
502
|
-
for (const candidatePair of (
|
|
522
|
+
for (const candidatePair of (_16 = sample.iceCandidatePairs) !== null && _16 !== void 0 ? _16 : []) {
|
|
503
523
|
const peerConnection = this._peerConnections.get(candidatePair.peerConnectionId);
|
|
504
524
|
if (!peerConnection) {
|
|
505
525
|
logger.debug(`Peer connection ${candidatePair.peerConnectionId} not found for ice candidate pair ${candidatePair.localCandidateId}, ${candidatePair.remoteCandidateId}`);
|
|
@@ -507,16 +527,16 @@ class ObservedClient extends events_1.EventEmitter {
|
|
|
507
527
|
}
|
|
508
528
|
peerConnection.ICE.update(candidatePair, sample.timestamp);
|
|
509
529
|
}
|
|
510
|
-
for (const dataChannel of (
|
|
530
|
+
for (const dataChannel of (_17 = sample.dataChannels) !== null && _17 !== void 0 ? _17 : []) {
|
|
511
531
|
if (!dataChannel.peerConnectionId || !dataChannel.dataChannelIdentifier) {
|
|
512
532
|
logger.warn(`DataChannel without peerConnectionId or dataChannelIdentifier: ${JSON.stringify(dataChannel)}`);
|
|
513
533
|
continue;
|
|
514
534
|
}
|
|
515
535
|
try {
|
|
516
|
-
const peerConnection = (
|
|
536
|
+
const peerConnection = (_18 = this._peerConnections.get(dataChannel.peerConnectionId)) !== null && _18 !== void 0 ? _18 : this._createPeerConnection(dataChannel.peerConnectionId);
|
|
517
537
|
if (!peerConnection)
|
|
518
538
|
continue;
|
|
519
|
-
const observedDataChannel = (
|
|
539
|
+
const observedDataChannel = (_19 = peerConnection.dataChannels.get(dataChannel.dataChannelIdentifier)) !== null && _19 !== void 0 ? _19 : peerConnection.createDataChannel(dataChannel.dataChannelIdentifier);
|
|
520
540
|
observedDataChannel.update(dataChannel, sample.timestamp);
|
|
521
541
|
}
|
|
522
542
|
catch (err) {
|
|
@@ -579,6 +599,8 @@ class ObservedClient extends events_1.EventEmitter {
|
|
|
579
599
|
this.inboundVideoBitrate = 0;
|
|
580
600
|
let sumRttInMs = 0;
|
|
581
601
|
let anyPeerConnectionUsingTurn = false;
|
|
602
|
+
let minPcScore = Number.MAX_SAFE_INTEGER;
|
|
603
|
+
let maxPcScore = Number.MIN_SAFE_INTEGER;
|
|
582
604
|
for (const peerConnection of this._peerConnections.values()) {
|
|
583
605
|
if (peerConnection.closed)
|
|
584
606
|
continue;
|
|
@@ -592,11 +614,22 @@ class ObservedClient extends events_1.EventEmitter {
|
|
|
592
614
|
this.deltaSentVideoBytes += peerConnection.deltaSentVideoBytes;
|
|
593
615
|
this.deltaDataChannelBytesReceived += peerConnection.deltaDataChannelBytesReceived;
|
|
594
616
|
this.deltaDataChannelBytesSent += peerConnection.deltaDataChannelBytesSent;
|
|
595
|
-
this.availableIncomingBitrate += (
|
|
596
|
-
this.availableOutgoingBitrate += (
|
|
597
|
-
sumRttInMs += (
|
|
617
|
+
this.availableIncomingBitrate += (_20 = peerConnection.availableIncomingBitrate) !== null && _20 !== void 0 ? _20 : 0;
|
|
618
|
+
this.availableOutgoingBitrate += (_21 = peerConnection.availableOutgoingBitrate) !== null && _21 !== void 0 ? _21 : 0;
|
|
619
|
+
sumRttInMs += (_22 = peerConnection.avgRttInMs) !== null && _22 !== void 0 ? _22 : 0;
|
|
598
620
|
anyPeerConnectionUsingTurn || (anyPeerConnectionUsingTurn = peerConnection.usingTURN);
|
|
599
|
-
|
|
621
|
+
minPcScore = Math.min(minPcScore, (_24 = (_23 = peerConnection.score) === null || _23 === void 0 ? void 0 : _23.score) !== null && _24 !== void 0 ? _24 : Number.MAX_SAFE_INTEGER);
|
|
622
|
+
maxPcScore = Math.max(maxPcScore, (_26 = (_25 = peerConnection.score) === null || _25 === void 0 ? void 0 : _25.score) !== null && _26 !== void 0 ? _26 : Number.MIN_SAFE_INTEGER);
|
|
623
|
+
}
|
|
624
|
+
this.score = {
|
|
625
|
+
score: minPcScore,
|
|
626
|
+
remarks: [{
|
|
627
|
+
severity: 'none',
|
|
628
|
+
text: `Min and max score of all peer connections: ${minPcScore}, ${maxPcScore}`,
|
|
629
|
+
}],
|
|
630
|
+
timestamp: sample.timestamp,
|
|
631
|
+
};
|
|
632
|
+
this.emit('score', this.score);
|
|
600
633
|
this.usingTURN = anyPeerConnectionUsingTurn === true;
|
|
601
634
|
if (wasUsingTURN !== this.usingTURN)
|
|
602
635
|
this.emit('usingturn', this.usingTURN);
|
|
@@ -624,6 +657,24 @@ class ObservedClient extends events_1.EventEmitter {
|
|
|
624
657
|
elapsedTimeInMs,
|
|
625
658
|
});
|
|
626
659
|
}
|
|
660
|
+
_addAndEmitIssue(issue) {
|
|
661
|
+
var _a;
|
|
662
|
+
this.issues.push(issue);
|
|
663
|
+
if (issue.peerConnectionId) {
|
|
664
|
+
const peerConnection = this._peerConnections.get(issue.peerConnectionId);
|
|
665
|
+
if (peerConnection) {
|
|
666
|
+
if (issue.trackId) {
|
|
667
|
+
const track = (_a = peerConnection.inboundAudioTracks.get(issue.trackId)) !== null && _a !== void 0 ? _a : peerConnection.inboundVideoTracks.get(issue.trackId);
|
|
668
|
+
if (track)
|
|
669
|
+
track.ωpendingIssuesForScores.push(issue);
|
|
670
|
+
}
|
|
671
|
+
else {
|
|
672
|
+
peerConnection.ωpendingIssuesForScores.push(issue);
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
this.emit('issue', issue);
|
|
677
|
+
}
|
|
627
678
|
_createPeerConnection(peerConnectionId, label) {
|
|
628
679
|
const result = new ObservedPeerConnection_1.ObservedPeerConnection({
|
|
629
680
|
peerConnectionId,
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { EventEmitter } from 'events';
|
|
3
|
+
import { ObservedPeerConnection } from './ObservedPeerConnection';
|
|
4
|
+
import { InboundAudioTrack } from '@observertc/sample-schemas-js';
|
|
5
|
+
import { CalculatedScore } from './common/CalculatedScore';
|
|
6
|
+
import { ClientIssue } from './monitors/CallSummary';
|
|
7
|
+
import { ObservedOutboundAudioTrack } from './ObservedOutboundAudioTrack';
|
|
8
|
+
export type ObservedInboundAudioTrackModel = {
|
|
9
|
+
trackId: string;
|
|
10
|
+
sfuStreamId?: string;
|
|
11
|
+
sfuSinkId?: string;
|
|
12
|
+
};
|
|
13
|
+
export type ObservedInboundAudioTrackEvents = {
|
|
14
|
+
update: [
|
|
15
|
+
{
|
|
16
|
+
elapsedTimeInMs: number;
|
|
17
|
+
}
|
|
18
|
+
];
|
|
19
|
+
score: [CalculatedScore];
|
|
20
|
+
close: [];
|
|
21
|
+
remoteoutboundtrack: [ObservedOutboundAudioTrack | undefined];
|
|
22
|
+
};
|
|
23
|
+
export type ObservedInboundAudioTrackStats = InboundAudioTrack & {
|
|
24
|
+
ssrc: number;
|
|
25
|
+
bitrate: number;
|
|
26
|
+
fractionLost: number;
|
|
27
|
+
rttInMs?: number;
|
|
28
|
+
deltaReceivedBytes?: number;
|
|
29
|
+
deltaLostPackets?: number;
|
|
30
|
+
deltaReceivedPackets?: number;
|
|
31
|
+
deltaReceivedFrames?: number;
|
|
32
|
+
deltaDecodedFrames?: number;
|
|
33
|
+
deltaDroppedFrames?: number;
|
|
34
|
+
deltaReceivedSamples?: number;
|
|
35
|
+
deltaSilentConcealedSamples?: number;
|
|
36
|
+
fractionLoss?: number;
|
|
37
|
+
statsTimestamp: number;
|
|
38
|
+
};
|
|
39
|
+
export declare interface ObservedInboundAudioTrack {
|
|
40
|
+
on<U extends keyof ObservedInboundAudioTrackEvents>(event: U, listener: (...args: ObservedInboundAudioTrackEvents[U]) => void): this;
|
|
41
|
+
off<U extends keyof ObservedInboundAudioTrackEvents>(event: U, listener: (...args: ObservedInboundAudioTrackEvents[U]) => void): this;
|
|
42
|
+
once<U extends keyof ObservedInboundAudioTrackEvents>(event: U, listener: (...args: ObservedInboundAudioTrackEvents[U]) => void): this;
|
|
43
|
+
emit<U extends keyof ObservedInboundAudioTrackEvents>(event: U, ...args: ObservedInboundAudioTrackEvents[U]): boolean;
|
|
44
|
+
update(sample: InboundAudioTrack, timestamp: number): void;
|
|
45
|
+
}
|
|
46
|
+
export declare class ObservedInboundAudioTrack extends EventEmitter {
|
|
47
|
+
private readonly _model;
|
|
48
|
+
readonly peerConnection: ObservedPeerConnection;
|
|
49
|
+
readonly created: number;
|
|
50
|
+
visited: boolean;
|
|
51
|
+
private readonly _stats;
|
|
52
|
+
private _closed;
|
|
53
|
+
private _updated;
|
|
54
|
+
private _remoteOutboundTrack?;
|
|
55
|
+
private _lastMaxStatsTimestamp;
|
|
56
|
+
bitrate: number;
|
|
57
|
+
rttInMs?: number;
|
|
58
|
+
jitter?: number;
|
|
59
|
+
fractionLoss: number;
|
|
60
|
+
marker?: string;
|
|
61
|
+
totalLostPackets: number;
|
|
62
|
+
totalReceivedPackets: number;
|
|
63
|
+
totalBytesReceived: number;
|
|
64
|
+
totalReceivedSamples: number;
|
|
65
|
+
totalSilentConcealedSamples: number;
|
|
66
|
+
deltaLostPackets: number;
|
|
67
|
+
deltaReceivedPackets: number;
|
|
68
|
+
deltaBytesReceived: number;
|
|
69
|
+
deltaReceivedSamples: number;
|
|
70
|
+
deltaSilentConcealedSamples: number;
|
|
71
|
+
score?: CalculatedScore;
|
|
72
|
+
ωpendingIssuesForScores: ClientIssue[];
|
|
73
|
+
constructor(_model: ObservedInboundAudioTrackModel, peerConnection: ObservedPeerConnection);
|
|
74
|
+
get serviceId(): string;
|
|
75
|
+
get roomId(): string;
|
|
76
|
+
get callId(): string;
|
|
77
|
+
get clientId(): string;
|
|
78
|
+
get mediaUnitId(): string;
|
|
79
|
+
get peerConnectionId(): string;
|
|
80
|
+
get trackId(): string;
|
|
81
|
+
get sfuStreamId(): string | undefined;
|
|
82
|
+
get sfuSinkId(): string | undefined;
|
|
83
|
+
get updated(): number;
|
|
84
|
+
get statsTimestamp(): number;
|
|
85
|
+
get stats(): ReadonlyMap<number, ObservedInboundAudioTrackStats>;
|
|
86
|
+
get reports(): import("./ReportsCollector").ReportsCollector;
|
|
87
|
+
set remoteOutboundTrack(track: ObservedOutboundAudioTrack | undefined);
|
|
88
|
+
get remoteOutboundTrack(): ObservedOutboundAudioTrack | undefined;
|
|
89
|
+
get closed(): boolean;
|
|
90
|
+
close(): void;
|
|
91
|
+
updateMetrics(): void;
|
|
92
|
+
private _updateQualityScore;
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=ObservedInboundAudioTrack.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ObservedInboundAudioTrack.d.ts","sourceRoot":"","sources":["../src/ObservedInboundAudioTrack.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EA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