@observertc/observer-js 0.40.3-beta → 0.40.4-beta
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/CallSummary.d.ts +2 -9
- package/lib/CallSummary.d.ts.map +1 -1
- package/lib/ObservedCall.d.ts.map +1 -1
- package/lib/ObservedCall.js +3 -0
- package/lib/ObservedClient.d.ts +3 -0
- package/lib/ObservedClient.d.ts.map +1 -1
- package/lib/ObservedClient.js +6 -0
- package/lib/ObservedDataChannel.d.ts +1 -0
- package/lib/ObservedDataChannel.d.ts.map +1 -1
- package/lib/ObservedDataChannel.js +1 -1
- package/lib/ObservedICE.d.ts +1 -0
- package/lib/ObservedICE.d.ts.map +1 -1
- package/lib/ObservedICE.js +1 -1
- package/lib/ObservedInboundTrack.d.ts +1 -0
- package/lib/ObservedInboundTrack.d.ts.map +1 -1
- package/lib/ObservedInboundTrack.js +1 -1
- package/lib/ObservedOutboundTrack.d.ts +1 -0
- package/lib/ObservedOutboundTrack.d.ts.map +1 -1
- package/lib/ObservedOutboundTrack.js +1 -1
- package/lib/ObservedPeerConnection.d.ts +3 -0
- package/lib/ObservedPeerConnection.d.ts.map +1 -1
- package/lib/ObservedPeerConnection.js +13 -1
- package/lib/ObservedSfu.d.ts +12 -0
- package/lib/ObservedSfu.d.ts.map +1 -1
- package/lib/ObservedSfu.js +76 -0
- package/lib/ObservedSfuInboundRtpPad.d.ts +38 -0
- package/lib/ObservedSfuInboundRtpPad.d.ts.map +1 -0
- package/lib/ObservedSfuInboundRtpPad.js +67 -0
- package/lib/ObservedSfuOutboundRtpPad.d.ts +38 -0
- package/lib/ObservedSfuOutboundRtpPad.d.ts.map +1 -0
- package/lib/ObservedSfuOutboundRtpPad.js +68 -0
- package/lib/ObservedSfuSctpChannel.d.ts +38 -0
- package/lib/ObservedSfuSctpChannel.d.ts.map +1 -0
- package/lib/ObservedSfuSctpChannel.js +53 -0
- package/lib/ObservedSfuTransport.d.ts +54 -0
- package/lib/ObservedSfuTransport.d.ts.map +1 -0
- package/lib/ObservedSfuTransport.js +116 -0
- package/lib/Observer.d.ts +5 -0
- package/lib/Observer.d.ts.map +1 -1
- package/lib/Observer.js +21 -0
- package/package.json +1 -1
- package/src/CallSummary.ts +2 -10
- package/src/ObservedCall.ts +3 -0
- package/src/ObservedClient.ts +10 -1
- package/src/ObservedDataChannel.ts +2 -0
- package/src/ObservedICE.ts +3 -0
- package/src/ObservedInboundTrack.ts +2 -0
- package/src/ObservedOutboundTrack.ts +2 -0
- package/src/ObservedPeerConnection.ts +16 -0
- package/src/ObservedSfu.ts +118 -2
- package/src/ObservedSfuInboundRtpPad.ts +100 -0
- package/src/ObservedSfuOutboundRtpPad.ts +101 -0
- package/src/ObservedSfuSctpChannel.ts +97 -0
- package/src/ObservedSfuTransport.ts +179 -0
- package/src/Observer.ts +31 -1
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { EventEmitter } from 'events';
|
|
3
|
+
import { SfuOutboundRtpPad } from '@observertc/sample-schemas-js';
|
|
4
|
+
import { ObservedSfuTransport } from './ObservedSfuTransport';
|
|
5
|
+
export type ObservedSfuOutboundRtpPadModel = {
|
|
6
|
+
sfuOutboundRtpPadId: string;
|
|
7
|
+
};
|
|
8
|
+
export type ObservedSfuOutboundRtpPadEvents = {
|
|
9
|
+
update: [];
|
|
10
|
+
close: [];
|
|
11
|
+
};
|
|
12
|
+
export declare interface ObservedSfuOutboundRtpPad {
|
|
13
|
+
on<U extends keyof ObservedSfuOutboundRtpPadEvents>(event: U, listener: (...args: ObservedSfuOutboundRtpPadEvents[U]) => void): this;
|
|
14
|
+
off<U extends keyof ObservedSfuOutboundRtpPadEvents>(event: U, listener: (...args: ObservedSfuOutboundRtpPadEvents[U]) => void): this;
|
|
15
|
+
once<U extends keyof ObservedSfuOutboundRtpPadEvents>(event: U, listener: (...args: ObservedSfuOutboundRtpPadEvents[U]) => void): this;
|
|
16
|
+
emit<U extends keyof ObservedSfuOutboundRtpPadEvents>(event: U, ...args: ObservedSfuOutboundRtpPadEvents[U]): boolean;
|
|
17
|
+
update(sample: SfuOutboundRtpPad, timestamp: number): void;
|
|
18
|
+
}
|
|
19
|
+
export declare class ObservedSfuOutboundRtpPad extends EventEmitter {
|
|
20
|
+
private readonly _model;
|
|
21
|
+
readonly transport: ObservedSfuTransport;
|
|
22
|
+
readonly created: number;
|
|
23
|
+
stats?: SfuOutboundRtpPad;
|
|
24
|
+
marker?: string;
|
|
25
|
+
private _updated;
|
|
26
|
+
private _closed;
|
|
27
|
+
constructor(_model: ObservedSfuOutboundRtpPadModel, transport: ObservedSfuTransport);
|
|
28
|
+
get reports(): import("./ReportsCollector").ReportsCollector;
|
|
29
|
+
get serviceId(): string;
|
|
30
|
+
get mediaUnitId(): string;
|
|
31
|
+
get sfuId(): string;
|
|
32
|
+
get sfuTransportId(): string;
|
|
33
|
+
get sfuRtpPadId(): string;
|
|
34
|
+
get updated(): number;
|
|
35
|
+
get closed(): boolean;
|
|
36
|
+
close(): void;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=ObservedSfuOutboundRtpPad.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ObservedSfuOutboundRtpPad.d.ts","sourceRoot":"","sources":["../src/ObservedSfuOutboundRtpPad.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAElE,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D,MAAM,MAAM,8BAA8B,GAAE;IAC3C,mBAAmB,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,+BAA+B,GAAG;IAC7C,MAAM,EAAE,EAAE,CAAC;IACX,KAAK,EAAE,EAAE,CAAC;CACV,CAAC;AAEF,MAAM,CAAC,OAAO,WAAW,yBAAy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,YAEhB;IAEM,KAAK;CA6BZ"}
|
|
@@ -0,0 +1,68 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.ObservedSfuOutboundRtpPad = void 0;
|
|
15
|
+
const events_1 = require("events");
|
|
16
|
+
class ObservedSfuOutboundRtpPad extends events_1.EventEmitter {
|
|
17
|
+
constructor(_model, transport) {
|
|
18
|
+
super();
|
|
19
|
+
this._model = _model;
|
|
20
|
+
this.transport = transport;
|
|
21
|
+
this.created = Date.now();
|
|
22
|
+
this._updated = Date.now();
|
|
23
|
+
this._closed = false;
|
|
24
|
+
this.setMaxListeners(Infinity);
|
|
25
|
+
}
|
|
26
|
+
get reports() {
|
|
27
|
+
return this.transport.reports;
|
|
28
|
+
}
|
|
29
|
+
get serviceId() {
|
|
30
|
+
return this.transport.serviceId;
|
|
31
|
+
}
|
|
32
|
+
get mediaUnitId() {
|
|
33
|
+
return this.transport.mediaUnitId;
|
|
34
|
+
}
|
|
35
|
+
get sfuId() {
|
|
36
|
+
return this.transport.sfuId;
|
|
37
|
+
}
|
|
38
|
+
get sfuTransportId() {
|
|
39
|
+
return this.transport.sfuTransportId;
|
|
40
|
+
}
|
|
41
|
+
get sfuRtpPadId() {
|
|
42
|
+
return this._model.sfuOutboundRtpPadId;
|
|
43
|
+
}
|
|
44
|
+
get updated() {
|
|
45
|
+
return this._updated;
|
|
46
|
+
}
|
|
47
|
+
get closed() {
|
|
48
|
+
return this._closed;
|
|
49
|
+
}
|
|
50
|
+
close() {
|
|
51
|
+
if (this._closed)
|
|
52
|
+
return;
|
|
53
|
+
this._closed = true;
|
|
54
|
+
this.emit('close');
|
|
55
|
+
}
|
|
56
|
+
update(sample, timestamp) {
|
|
57
|
+
const { streamId: sfuStreamId, padId: rtpPadId, sinkId: sfuSinkId } = sample, reportData = __rest(sample, ["streamId", "padId", "sinkId"]);
|
|
58
|
+
const report = Object.assign(Object.assign({ serviceId: this.serviceId, mediaUnitId: this.mediaUnitId, sfuId: this.sfuId, callId: undefined, // TODO: where to get this from?
|
|
59
|
+
sfuStreamId,
|
|
60
|
+
sfuSinkId,
|
|
61
|
+
rtpPadId }, reportData), { timestamp, marker: this.marker });
|
|
62
|
+
this.reports.addSfuOutboundRtpPadReport(report);
|
|
63
|
+
this.stats = sample;
|
|
64
|
+
this._updated = Date.now();
|
|
65
|
+
this.emit('update');
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
exports.ObservedSfuOutboundRtpPad = ObservedSfuOutboundRtpPad;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { EventEmitter } from 'events';
|
|
3
|
+
import { SfuSctpChannel } from '@observertc/sample-schemas-js';
|
|
4
|
+
import { ObservedSfuTransport } from './ObservedSfuTransport';
|
|
5
|
+
export type ObservedSfuSctpChannelModel = {
|
|
6
|
+
sfuSctpChannelId: string;
|
|
7
|
+
};
|
|
8
|
+
export type ObservedSfuSctpChannelEvents = {
|
|
9
|
+
update: [];
|
|
10
|
+
close: [];
|
|
11
|
+
};
|
|
12
|
+
export declare interface ObservedSfuSctpChannel {
|
|
13
|
+
on<U extends keyof ObservedSfuSctpChannelEvents>(event: U, listener: (...args: ObservedSfuSctpChannelEvents[U]) => void): this;
|
|
14
|
+
off<U extends keyof ObservedSfuSctpChannelEvents>(event: U, listener: (...args: ObservedSfuSctpChannelEvents[U]) => void): this;
|
|
15
|
+
once<U extends keyof ObservedSfuSctpChannelEvents>(event: U, listener: (...args: ObservedSfuSctpChannelEvents[U]) => void): this;
|
|
16
|
+
emit<U extends keyof ObservedSfuSctpChannelEvents>(event: U, ...args: ObservedSfuSctpChannelEvents[U]): boolean;
|
|
17
|
+
update(sample: SfuSctpChannel, timestamp: number): void;
|
|
18
|
+
}
|
|
19
|
+
export declare class ObservedSfuSctpChannel extends EventEmitter {
|
|
20
|
+
private readonly _model;
|
|
21
|
+
readonly transport: ObservedSfuTransport;
|
|
22
|
+
readonly created: number;
|
|
23
|
+
stats?: SfuSctpChannel;
|
|
24
|
+
marker?: string;
|
|
25
|
+
private _updated;
|
|
26
|
+
private _closed;
|
|
27
|
+
constructor(_model: ObservedSfuSctpChannelModel, transport: ObservedSfuTransport);
|
|
28
|
+
get serviceId(): string;
|
|
29
|
+
get sfuId(): string;
|
|
30
|
+
get mediaUnitId(): string;
|
|
31
|
+
get sfuTransportId(): string;
|
|
32
|
+
get sfuSctpChannelId(): string;
|
|
33
|
+
get reports(): import("./ReportsCollector").ReportsCollector;
|
|
34
|
+
get updated(): number;
|
|
35
|
+
get closed(): boolean;
|
|
36
|
+
close(): void;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=ObservedSfuSctpChannel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ObservedSfuSctpChannel.d.ts","sourceRoot":"","sources":["../src/ObservedSfuSctpChannel.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAG9D,MAAM,MAAM,2BAA2B,GAAE;IACxC,gBAAgB,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,MA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AW,WAAW,WAErB;IAED,IAAW,cAAc,WAExB;IAED,IAAW,gBAAgB,WAE1B;IAED,IAAW,OAAO,kDAEjB;IAED,IAAW,OAAO,WAEjB;IAED,IAAW,MAAM,YAEhB;IAEM,KAAK;CAyBZ"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ObservedSfuSctpChannel = void 0;
|
|
4
|
+
const events_1 = require("events");
|
|
5
|
+
class ObservedSfuSctpChannel extends events_1.EventEmitter {
|
|
6
|
+
constructor(_model, transport) {
|
|
7
|
+
super();
|
|
8
|
+
this._model = _model;
|
|
9
|
+
this.transport = transport;
|
|
10
|
+
this.created = Date.now();
|
|
11
|
+
this._updated = Date.now();
|
|
12
|
+
this._closed = false;
|
|
13
|
+
this.setMaxListeners(Infinity);
|
|
14
|
+
}
|
|
15
|
+
get serviceId() {
|
|
16
|
+
return this.transport.serviceId;
|
|
17
|
+
}
|
|
18
|
+
get sfuId() {
|
|
19
|
+
return this.transport.sfuId;
|
|
20
|
+
}
|
|
21
|
+
get mediaUnitId() {
|
|
22
|
+
return this.transport.mediaUnitId;
|
|
23
|
+
}
|
|
24
|
+
get sfuTransportId() {
|
|
25
|
+
return this.transport.sfuTransportId;
|
|
26
|
+
}
|
|
27
|
+
get sfuSctpChannelId() {
|
|
28
|
+
return this._model.sfuSctpChannelId;
|
|
29
|
+
}
|
|
30
|
+
get reports() {
|
|
31
|
+
return this.transport.reports;
|
|
32
|
+
}
|
|
33
|
+
get updated() {
|
|
34
|
+
return this._updated;
|
|
35
|
+
}
|
|
36
|
+
get closed() {
|
|
37
|
+
return this._closed;
|
|
38
|
+
}
|
|
39
|
+
close() {
|
|
40
|
+
if (this._closed)
|
|
41
|
+
return;
|
|
42
|
+
this._closed = true;
|
|
43
|
+
this.emit('close');
|
|
44
|
+
}
|
|
45
|
+
update(sample, timestamp) {
|
|
46
|
+
const report = Object.assign(Object.assign({ serviceId: this.serviceId, mediaUnitId: this.mediaUnitId, sfuId: this.sfuId, callId: undefined, roomId: undefined }, sample), { timestamp, marker: this.marker });
|
|
47
|
+
this.reports.addSfuTransportReport(report);
|
|
48
|
+
this.stats = sample;
|
|
49
|
+
this._updated = Date.now();
|
|
50
|
+
this.emit('update');
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
exports.ObservedSfuSctpChannel = ObservedSfuSctpChannel;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { EventEmitter } from 'events';
|
|
3
|
+
import { SfuTransport } from '@observertc/sample-schemas-js';
|
|
4
|
+
import { ObservedSfu } from './ObservedSfu';
|
|
5
|
+
import { ObservedSfuInboundRtpPad, ObservedSfuInboundRtpPadModel } from './ObservedSfuInboundRtpPad';
|
|
6
|
+
import { ObservedSfuOutboundRtpPad, ObservedSfuOutboundRtpPadModel } from './ObservedSfuOutboundRtpPad';
|
|
7
|
+
import { ObservedSfuSctpChannel, ObservedSfuSctpChannelModel } from './ObservedSfuSctpChannel';
|
|
8
|
+
export type ObservedSfuTransportModel = {
|
|
9
|
+
sfuTransportId: string;
|
|
10
|
+
};
|
|
11
|
+
export type ObservedSfuTransportEvents = {
|
|
12
|
+
update: [];
|
|
13
|
+
close: [];
|
|
14
|
+
newsfuoutboundrtppad: [ObservedSfuOutboundRtpPad];
|
|
15
|
+
newsfuinboundrtppad: [ObservedSfuInboundRtpPad];
|
|
16
|
+
newsfusctpchannel: [ObservedSfuSctpChannel];
|
|
17
|
+
};
|
|
18
|
+
export declare interface ObservedSfuTransport {
|
|
19
|
+
on<U extends keyof ObservedSfuTransportEvents>(event: U, listener: (...args: ObservedSfuTransportEvents[U]) => void): this;
|
|
20
|
+
off<U extends keyof ObservedSfuTransportEvents>(event: U, listener: (...args: ObservedSfuTransportEvents[U]) => void): this;
|
|
21
|
+
once<U extends keyof ObservedSfuTransportEvents>(event: U, listener: (...args: ObservedSfuTransportEvents[U]) => void): this;
|
|
22
|
+
emit<U extends keyof ObservedSfuTransportEvents>(event: U, ...args: ObservedSfuTransportEvents[U]): boolean;
|
|
23
|
+
update(sample: SfuTransport, timestamp: number): void;
|
|
24
|
+
}
|
|
25
|
+
export declare class ObservedSfuTransport extends EventEmitter {
|
|
26
|
+
private readonly _model;
|
|
27
|
+
readonly sfu: ObservedSfu;
|
|
28
|
+
readonly created: number;
|
|
29
|
+
stats?: SfuTransport;
|
|
30
|
+
private _updated;
|
|
31
|
+
private _closed;
|
|
32
|
+
private _marker?;
|
|
33
|
+
private readonly _inboundRtpPads;
|
|
34
|
+
private readonly _outboundRtpPads;
|
|
35
|
+
private readonly _sctpChannels;
|
|
36
|
+
constructor(_model: ObservedSfuTransportModel, sfu: ObservedSfu);
|
|
37
|
+
get inboundRtpPads(): ReadonlyMap<string, ObservedSfuInboundRtpPad>;
|
|
38
|
+
get outboundRtpPads(): ReadonlyMap<string, ObservedSfuOutboundRtpPad>;
|
|
39
|
+
get sctpChannels(): ReadonlyMap<string, ObservedSfuSctpChannel>;
|
|
40
|
+
get serviceId(): string;
|
|
41
|
+
get mediaUnitId(): string;
|
|
42
|
+
get sfuId(): string;
|
|
43
|
+
get sfuTransportId(): string;
|
|
44
|
+
get reports(): import("./ReportsCollector").ReportsCollector;
|
|
45
|
+
get updated(): number;
|
|
46
|
+
get marker(): string | undefined;
|
|
47
|
+
set marker(value: string | undefined);
|
|
48
|
+
get closed(): boolean;
|
|
49
|
+
close(): void;
|
|
50
|
+
createSfuOutboundRtpPad(model: ObservedSfuOutboundRtpPadModel): ObservedSfuOutboundRtpPad;
|
|
51
|
+
createSfuInboundRtpPad(model: ObservedSfuInboundRtpPadModel): ObservedSfuInboundRtpPad;
|
|
52
|
+
createSfuSctpChannel(model: ObservedSfuSctpChannelModel): ObservedSfuSctpChannel;
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=ObservedSfuTransport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|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M,KAAK;IA+BL,uBAAuB,CAAC,KAAK,EAAE,8BAA8B;IAgB7D,sBAAsB,CAAC,KAAK,EAAE,6BAA6B;IAgB3D,oBAAoB,CAAC,KAAK,EAAE,2BAA2B;CAe9D"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ObservedSfuTransport = void 0;
|
|
4
|
+
const events_1 = require("events");
|
|
5
|
+
const ObservedSfuInboundRtpPad_1 = require("./ObservedSfuInboundRtpPad");
|
|
6
|
+
const ObservedSfuOutboundRtpPad_1 = require("./ObservedSfuOutboundRtpPad");
|
|
7
|
+
const ObservedSfuSctpChannel_1 = require("./ObservedSfuSctpChannel");
|
|
8
|
+
class ObservedSfuTransport extends events_1.EventEmitter {
|
|
9
|
+
constructor(_model, sfu) {
|
|
10
|
+
super();
|
|
11
|
+
this._model = _model;
|
|
12
|
+
this.sfu = sfu;
|
|
13
|
+
this.created = Date.now();
|
|
14
|
+
this._updated = Date.now();
|
|
15
|
+
this._closed = false;
|
|
16
|
+
this._inboundRtpPads = new Map();
|
|
17
|
+
this._outboundRtpPads = new Map();
|
|
18
|
+
this._sctpChannels = new Map();
|
|
19
|
+
this.setMaxListeners(Infinity);
|
|
20
|
+
}
|
|
21
|
+
get inboundRtpPads() {
|
|
22
|
+
return this._inboundRtpPads;
|
|
23
|
+
}
|
|
24
|
+
get outboundRtpPads() {
|
|
25
|
+
return this._outboundRtpPads;
|
|
26
|
+
}
|
|
27
|
+
get sctpChannels() {
|
|
28
|
+
return this._sctpChannels;
|
|
29
|
+
}
|
|
30
|
+
get serviceId() {
|
|
31
|
+
return this.sfu.serviceId;
|
|
32
|
+
}
|
|
33
|
+
get mediaUnitId() {
|
|
34
|
+
return this.sfu.mediaUnitId;
|
|
35
|
+
}
|
|
36
|
+
get sfuId() {
|
|
37
|
+
return this.sfu.sfuId;
|
|
38
|
+
}
|
|
39
|
+
get sfuTransportId() {
|
|
40
|
+
return this._model.sfuTransportId;
|
|
41
|
+
}
|
|
42
|
+
get reports() {
|
|
43
|
+
return this.sfu.reports;
|
|
44
|
+
}
|
|
45
|
+
get updated() {
|
|
46
|
+
return this._updated;
|
|
47
|
+
}
|
|
48
|
+
get marker() {
|
|
49
|
+
return this._marker;
|
|
50
|
+
}
|
|
51
|
+
set marker(value) {
|
|
52
|
+
this._marker = value;
|
|
53
|
+
this._inboundRtpPads.forEach((pad) => (pad.marker = value));
|
|
54
|
+
this._outboundRtpPads.forEach((pad) => (pad.marker = value));
|
|
55
|
+
this._sctpChannels.forEach((channel) => (channel.marker = value));
|
|
56
|
+
}
|
|
57
|
+
get closed() {
|
|
58
|
+
return this._closed;
|
|
59
|
+
}
|
|
60
|
+
close() {
|
|
61
|
+
if (this._closed)
|
|
62
|
+
return;
|
|
63
|
+
this._closed = true;
|
|
64
|
+
[...this._inboundRtpPads.values()].forEach((pad) => pad.close());
|
|
65
|
+
[...this._outboundRtpPads.values()].forEach((pad) => pad.close());
|
|
66
|
+
[...this._sctpChannels.values()].forEach((channel) => channel.close());
|
|
67
|
+
this.emit('close');
|
|
68
|
+
}
|
|
69
|
+
update(sample, timestamp) {
|
|
70
|
+
const report = Object.assign(Object.assign({ serviceId: this.serviceId, mediaUnitId: this.mediaUnitId, sfuId: this.sfuId, callId: undefined, roomId: undefined }, sample), { timestamp, marker: this.marker });
|
|
71
|
+
this.reports.addSfuTransportReport(report);
|
|
72
|
+
this.stats = sample;
|
|
73
|
+
this._updated = Date.now();
|
|
74
|
+
this.emit('update');
|
|
75
|
+
}
|
|
76
|
+
createSfuOutboundRtpPad(model) {
|
|
77
|
+
if (this._closed)
|
|
78
|
+
throw new Error('Cannot create SfuOutboundRtpPad on closed SfuTransport');
|
|
79
|
+
if (this._inboundRtpPads.has(model.sfuOutboundRtpPadId))
|
|
80
|
+
throw new Error(`SfuOutboundRtpPad with id ${model.sfuOutboundRtpPadId} already exists`);
|
|
81
|
+
const result = new ObservedSfuOutboundRtpPad_1.ObservedSfuOutboundRtpPad(model, this);
|
|
82
|
+
result.once('close', () => {
|
|
83
|
+
this._outboundRtpPads.delete(model.sfuOutboundRtpPadId);
|
|
84
|
+
});
|
|
85
|
+
this._outboundRtpPads.set(model.sfuOutboundRtpPadId, result);
|
|
86
|
+
this.emit('newsfuoutboundrtppad', result);
|
|
87
|
+
return result;
|
|
88
|
+
}
|
|
89
|
+
createSfuInboundRtpPad(model) {
|
|
90
|
+
if (this._closed)
|
|
91
|
+
throw new Error('Cannot create SfuInboundRtpPad on closed SfuTransport');
|
|
92
|
+
if (this._inboundRtpPads.has(model.sfuInboundRtpPadId))
|
|
93
|
+
throw new Error(`SfuInboundRtpPad with id ${model.sfuInboundRtpPadId} already exists`);
|
|
94
|
+
const result = new ObservedSfuInboundRtpPad_1.ObservedSfuInboundRtpPad(model, this);
|
|
95
|
+
result.once('close', () => {
|
|
96
|
+
this._inboundRtpPads.delete(model.sfuInboundRtpPadId);
|
|
97
|
+
});
|
|
98
|
+
this._inboundRtpPads.set(model.sfuInboundRtpPadId, result);
|
|
99
|
+
this.emit('newsfuinboundrtppad', result);
|
|
100
|
+
return result;
|
|
101
|
+
}
|
|
102
|
+
createSfuSctpChannel(model) {
|
|
103
|
+
if (this._closed)
|
|
104
|
+
throw new Error('Cannot create SfuSctpChannel on closed SfuTransport');
|
|
105
|
+
if (this._sctpChannels.has(model.sfuSctpChannelId))
|
|
106
|
+
throw new Error(`SfuSctpChannel with id ${model.sfuSctpChannelId} already exists`);
|
|
107
|
+
const result = new ObservedSfuSctpChannel_1.ObservedSfuSctpChannel(model, this);
|
|
108
|
+
result.once('close', () => {
|
|
109
|
+
this._sctpChannels.delete(model.sfuSctpChannelId);
|
|
110
|
+
});
|
|
111
|
+
this._sctpChannels.set(model.sfuSctpChannelId, result);
|
|
112
|
+
this.emit('newsfusctpchannel', result);
|
|
113
|
+
return result;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
exports.ObservedSfuTransport = ObservedSfuTransport;
|
package/lib/Observer.d.ts
CHANGED
|
@@ -4,8 +4,10 @@ import { ReportsCollector } from './ReportsCollector';
|
|
|
4
4
|
import { EventEmitter } from 'events';
|
|
5
5
|
import { PartialBy } from './common/utils';
|
|
6
6
|
import { ObserverSinkContext } from './common/types';
|
|
7
|
+
import { ObservedSfu, ObservedSfuModel } from './ObservedSfu';
|
|
7
8
|
export type ObserverEvents = {
|
|
8
9
|
'newcall': [ObservedCall];
|
|
10
|
+
'newsfu': [ObservedSfu];
|
|
9
11
|
'reports': [ObserverSinkContext];
|
|
10
12
|
'close': [];
|
|
11
13
|
};
|
|
@@ -39,13 +41,16 @@ export declare class Observer extends EventEmitter {
|
|
|
39
41
|
static create(providedConfig: Partial<ObserverConfig>): Observer;
|
|
40
42
|
readonly reports: ReportsCollector;
|
|
41
43
|
private readonly _observedCalls;
|
|
44
|
+
private readonly _observedSfus;
|
|
42
45
|
private _reportTimer?;
|
|
43
46
|
private _closed;
|
|
44
47
|
constructor(config: ObserverConfig);
|
|
45
48
|
createObservedCall<T extends Record<string, unknown> = Record<string, unknown>>(config: PartialBy<ObservedCallModel, 'serviceId' | 'started'> & {
|
|
46
49
|
appData: T;
|
|
47
50
|
}): ObservedCall<T>;
|
|
51
|
+
createObservedSfu<AppData extends Record<string, unknown> = Record<string, unknown>>(model: ObservedSfuModel, appData: AppData): ObservedSfu<AppData>;
|
|
48
52
|
get observedCalls(): ReadonlyMap<string, ObservedCall>;
|
|
53
|
+
get observedSfus(): ReadonlyMap<string, ObservedSfu>;
|
|
49
54
|
get closed(): boolean;
|
|
50
55
|
close(): void;
|
|
51
56
|
private _emitReports;
|
package/lib/Observer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Observer.d.ts","sourceRoot":"","sources":["../src/Observer.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACjE,OAAO,EAAE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AO,CAAC,EACzF,KAAK,EAAE,gBAAgB,EACvB,OAAO,EAAE,OAAO,GACd,WAAW,CAAC,OAAO,CAAC;IAoBvB,IAAW,aAAa,IAAI,WAAW,CAAC,MAAM,EAAE,YAAY,CAAC,CAE5D;IAED,IAAW,YAAY,IAAI,WAAW,CAAC,MAAM,EAAE,WAAW,CAAC,CAE1D;IAED,IAAW,MAAM,YAEhB;IAEM,KAAK;IAWZ,OAAO,CAAC,YAAY;CAepB"}
|
package/lib/Observer.js
CHANGED
|
@@ -17,6 +17,7 @@ const ObservedCall_1 = require("./ObservedCall");
|
|
|
17
17
|
const ReportsCollector_1 = require("./ReportsCollector");
|
|
18
18
|
const events_1 = require("events");
|
|
19
19
|
const callEventReports_1 = require("./common/callEventReports");
|
|
20
|
+
const ObservedSfu_1 = require("./ObservedSfu");
|
|
20
21
|
const logger = (0, logger_1.createLogger)('Observer');
|
|
21
22
|
class Observer extends events_1.EventEmitter {
|
|
22
23
|
static create(providedConfig) {
|
|
@@ -37,6 +38,7 @@ class Observer extends events_1.EventEmitter {
|
|
|
37
38
|
this.config = config;
|
|
38
39
|
this.reports = new ReportsCollector_1.ReportsCollector();
|
|
39
40
|
this._observedCalls = new Map();
|
|
41
|
+
this._observedSfus = new Map();
|
|
40
42
|
this._closed = false;
|
|
41
43
|
this.setMaxListeners(Infinity);
|
|
42
44
|
logger.debug('Observer is created with config', this.config);
|
|
@@ -75,9 +77,28 @@ class Observer extends events_1.EventEmitter {
|
|
|
75
77
|
this.emit('newcall', call);
|
|
76
78
|
return call;
|
|
77
79
|
}
|
|
80
|
+
createObservedSfu(model, appData) {
|
|
81
|
+
if (this._closed) {
|
|
82
|
+
throw new Error('Attempted to create an sfu source on a closed observer');
|
|
83
|
+
}
|
|
84
|
+
const sfu = new ObservedSfu_1.ObservedSfu(model, this, appData);
|
|
85
|
+
if (this._closed)
|
|
86
|
+
throw new Error('Cannot create an observed sfu on a closed observer');
|
|
87
|
+
if (this._observedSfus.has(sfu.sfuId))
|
|
88
|
+
throw new Error(`Observed SFU with id ${sfu.sfuId} already exists`);
|
|
89
|
+
sfu.once('close', () => {
|
|
90
|
+
this._observedSfus.delete(sfu.sfuId);
|
|
91
|
+
});
|
|
92
|
+
this._observedSfus.set(sfu.sfuId, sfu);
|
|
93
|
+
this.emit('newsfu', sfu);
|
|
94
|
+
return sfu;
|
|
95
|
+
}
|
|
78
96
|
get observedCalls() {
|
|
79
97
|
return this._observedCalls;
|
|
80
98
|
}
|
|
99
|
+
get observedSfus() {
|
|
100
|
+
return this._observedSfus;
|
|
101
|
+
}
|
|
81
102
|
get closed() {
|
|
82
103
|
return this._closed;
|
|
83
104
|
}
|
package/package.json
CHANGED
package/src/CallSummary.ts
CHANGED
|
@@ -2,14 +2,7 @@ export interface ClientSummary {
|
|
|
2
2
|
clientId: string;
|
|
3
3
|
userId: string;
|
|
4
4
|
joined: number;
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export interface DetectedIssues {
|
|
9
|
-
clientId: string,
|
|
10
|
-
issue: string,
|
|
11
|
-
started: number,
|
|
12
|
-
ended: number,
|
|
5
|
+
durationInMs: number;
|
|
13
6
|
}
|
|
14
7
|
|
|
15
8
|
export interface CallSummary {
|
|
@@ -17,7 +10,6 @@ export interface CallSummary {
|
|
|
17
10
|
roomId: string;
|
|
18
11
|
callId: string;
|
|
19
12
|
started: number;
|
|
20
|
-
|
|
13
|
+
durationInMs: number;
|
|
21
14
|
clients: ClientSummary[];
|
|
22
|
-
detectedIssues: DetectedIssues[];
|
|
23
15
|
}
|
package/src/ObservedCall.ts
CHANGED
|
@@ -92,10 +92,13 @@ export class ObservedCall<AppData extends Record<string, unknown> = Record<strin
|
|
|
92
92
|
const { appData, generateClientJoinedReport, joined = Date.now(), ...model } = config;
|
|
93
93
|
|
|
94
94
|
const result = new ObservedClient(model, this, appData);
|
|
95
|
+
const onUpdate = () => this.emit('update');
|
|
95
96
|
|
|
96
97
|
result.once('close', () => {
|
|
98
|
+
result.off('update', onUpdate);
|
|
97
99
|
this._clients.delete(result.clientId);
|
|
98
100
|
});
|
|
101
|
+
result.on('update', onUpdate);
|
|
99
102
|
this._clients.set(result.clientId, result);
|
|
100
103
|
|
|
101
104
|
if (generateClientJoinedReport) {
|
package/src/ObservedClient.ts
CHANGED
|
@@ -8,6 +8,7 @@ import { CallMetaType, createCallMetaReport } from './common/callMetaReports';
|
|
|
8
8
|
import { isValidUuid } from './common/utils';
|
|
9
9
|
import { createClientLeftEventReport } from './common/callEventReports';
|
|
10
10
|
import { CallEventType } from './common/CallEventType';
|
|
11
|
+
import { ObservedSfu } from './ObservedSfu';
|
|
11
12
|
|
|
12
13
|
const logger = createLogger('ObservedClient');
|
|
13
14
|
|
|
@@ -58,7 +59,8 @@ export class ObservedClient<AppData extends Record<string, unknown> = Record<str
|
|
|
58
59
|
|
|
59
60
|
public readonly created = Date.now();
|
|
60
61
|
public _updated = Date.now();
|
|
61
|
-
|
|
62
|
+
public sfuId?: string;
|
|
63
|
+
|
|
62
64
|
private readonly _peerConnections = new Map<string, ObservedPeerConnection>();
|
|
63
65
|
|
|
64
66
|
private _closed = false;
|
|
@@ -98,6 +100,12 @@ export class ObservedClient<AppData extends Record<string, unknown> = Record<str
|
|
|
98
100
|
this.setMaxListeners(Infinity);
|
|
99
101
|
}
|
|
100
102
|
|
|
103
|
+
public get sfu(): ObservedSfu | undefined {
|
|
104
|
+
if (!this.sfuId) return;
|
|
105
|
+
|
|
106
|
+
return this.call.observer.observedSfus.get(this.sfuId);
|
|
107
|
+
}
|
|
108
|
+
|
|
101
109
|
public get clientId(): string {
|
|
102
110
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
103
111
|
return this._model.clientId!;
|
|
@@ -203,6 +211,7 @@ export class ObservedClient<AppData extends Record<string, unknown> = Record<str
|
|
|
203
211
|
}
|
|
204
212
|
if (this._model.marker !== sample.marker) {
|
|
205
213
|
this._model.marker = sample.marker;
|
|
214
|
+
this._peerConnections.forEach((peerConnection) => (peerConnection.marker = sample.marker));
|
|
206
215
|
}
|
|
207
216
|
|
|
208
217
|
if (this._timeZoneOffsetInHours !== sample.timeZoneOffsetInHours) {
|
|
@@ -49,6 +49,7 @@ export class ObservedDataChannel extends EventEmitter {
|
|
|
49
49
|
private _closed = false;
|
|
50
50
|
private _updated = Date.now();
|
|
51
51
|
public bitrate = 0;
|
|
52
|
+
public marker?: string;
|
|
52
53
|
|
|
53
54
|
public totalReceivedMessages = 0;
|
|
54
55
|
public totalSentMessages = 0;
|
|
@@ -158,6 +159,7 @@ export class ObservedDataChannel extends EventEmitter {
|
|
|
158
159
|
...sample,
|
|
159
160
|
timestamp,
|
|
160
161
|
sampleSeq: -1,
|
|
162
|
+
marker: this.marker,
|
|
161
163
|
};
|
|
162
164
|
|
|
163
165
|
this.reports.addClientDataChannelReport(report);
|
package/src/ObservedICE.ts
CHANGED
|
@@ -27,6 +27,8 @@ export class ObservedICE extends EventEmitter {
|
|
|
27
27
|
return new ObservedICE(peerConnection);
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
+
public marker?: string;
|
|
31
|
+
|
|
30
32
|
private readonly _localCandidates = new Map<string, IceLocalCandidate>();
|
|
31
33
|
private readonly _remoteCandidates = new Map<string, IceLocalCandidate>();
|
|
32
34
|
|
|
@@ -141,6 +143,7 @@ export class ObservedICE extends EventEmitter {
|
|
|
141
143
|
timestamp,
|
|
142
144
|
...candidatePair,
|
|
143
145
|
sampleSeq: -1, // deprecated
|
|
146
|
+
marker: this.marker,
|
|
144
147
|
};
|
|
145
148
|
|
|
146
149
|
this.reports.addIceCandidatePairReport(report);
|
|
@@ -58,6 +58,7 @@ export class ObservedInboundTrack<Kind extends MediaKind> extends EventEmitter {
|
|
|
58
58
|
public bitrate = 0;
|
|
59
59
|
public rttInMs?: number;
|
|
60
60
|
public fractionLoss = 0;
|
|
61
|
+
public marker?: string;
|
|
61
62
|
|
|
62
63
|
public totalLostPackets = 0;
|
|
63
64
|
public totalReceivedPackets = 0;
|
|
@@ -197,6 +198,7 @@ export class ObservedInboundTrack<Kind extends MediaKind> extends EventEmitter {
|
|
|
197
198
|
remoteUserId: this.remoteOutboundTrack?.peerConnection.client.userId,
|
|
198
199
|
remoteTrackId: this.remoteOutboundTrack?.trackId,
|
|
199
200
|
remotePeerConnectionId: this.remoteOutboundTrack?.peerConnection.peerConnectionId,
|
|
201
|
+
marker: this.marker,
|
|
200
202
|
};
|
|
201
203
|
|
|
202
204
|
if (this.kind === 'audio') this.reports.addInboundAudioTrackReport(report);
|
|
@@ -47,6 +47,7 @@ export class ObservedOutboundTrack<Kind extends MediaKind> extends EventEmitter
|
|
|
47
47
|
|
|
48
48
|
public bitrate = 0;
|
|
49
49
|
public rttInMs?: number;
|
|
50
|
+
public marker?: string;
|
|
50
51
|
|
|
51
52
|
public totalLostPackets = 0;
|
|
52
53
|
public totalSentPackets = 0;
|
|
@@ -162,6 +163,7 @@ export class ObservedOutboundTrack<Kind extends MediaKind> extends EventEmitter
|
|
|
162
163
|
...sample,
|
|
163
164
|
timestamp,
|
|
164
165
|
sampleSeq: -1,
|
|
166
|
+
marker: this.marker,
|
|
165
167
|
};
|
|
166
168
|
|
|
167
169
|
if (this.kind === 'audio') this.reports.addOutboundAudioTrackReport(report);
|
|
@@ -73,6 +73,7 @@ export class ObservedPeerConnection extends EventEmitter {
|
|
|
73
73
|
private _closed = false;
|
|
74
74
|
private _updated = Date.now();
|
|
75
75
|
private _sample?: ObservedPeerConnectionStats;
|
|
76
|
+
private _marker?: string;
|
|
76
77
|
|
|
77
78
|
public readonly ICE = ObservedICE.create(this);
|
|
78
79
|
private readonly _inboundAudioTracks = new Map<string, ObservedInboundTrack<'audio'>>();
|
|
@@ -170,6 +171,20 @@ export class ObservedPeerConnection extends EventEmitter {
|
|
|
170
171
|
return this._updated - this.created;
|
|
171
172
|
}
|
|
172
173
|
|
|
174
|
+
public get marker() {
|
|
175
|
+
return this._marker;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
public set marker(value: string | undefined) {
|
|
179
|
+
this._marker = value;
|
|
180
|
+
this._inboundAudioTracks.forEach((track) => (track.marker = value));
|
|
181
|
+
this._inboundVideoTracks.forEach((track) => (track.marker = value));
|
|
182
|
+
this._outboundAudioTracks.forEach((track) => (track.marker = value));
|
|
183
|
+
this._outboundVideoTracks.forEach((track) => (track.marker = value));
|
|
184
|
+
this._dataChannels.forEach((channel) => (channel.marker = value));
|
|
185
|
+
this.ICE.marker = value;
|
|
186
|
+
}
|
|
187
|
+
|
|
173
188
|
public get closed() {
|
|
174
189
|
return this._closed;
|
|
175
190
|
}
|
|
@@ -330,6 +345,7 @@ export class ObservedPeerConnection extends EventEmitter {
|
|
|
330
345
|
...sample,
|
|
331
346
|
timestamp,
|
|
332
347
|
sampleSeq: -1, // deprecated
|
|
348
|
+
marker: this.marker,
|
|
333
349
|
};
|
|
334
350
|
|
|
335
351
|
this.reports.addPeerConnectionTransportReports(report);
|