@observertc/observer-js 0.9.1-beta → 0.9.2-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/Evaluator.d.ts.map +1 -1
- package/lib/Evaluator.js +13 -2
- package/lib/Observer.d.ts +3 -1
- package/lib/Observer.d.ts.map +1 -1
- package/lib/Observer.js +19 -1
- package/lib/common/logger.d.ts +2 -2
- package/lib/common/logger.d.ts.map +1 -1
- package/lib/common/logger.js +49 -35
- package/lib/common/types.d.ts +22 -0
- package/lib/common/types.d.ts.map +1 -1
- package/lib/middlewares/CommitTransactionMiddleware.d.ts.map +1 -1
- package/lib/middlewares/CommitTransactionMiddleware.js +25 -0
- package/lib/middlewares/TransactionContext.d.ts +4 -2
- package/lib/middlewares/TransactionContext.d.ts.map +1 -1
- package/lib/middlewares/TransactionContext.js +2 -1
- package/lib/middlewares/TransactoinProcessor.d.ts.map +1 -1
- package/lib/middlewares/TransactoinProcessor.js +3 -2
- package/lib/middlewares/VisitObservedCallsMiddleware.d.ts +1 -1
- package/lib/middlewares/VisitObservedCallsMiddleware.d.ts.map +1 -1
- package/lib/middlewares/VisitObservedCallsMiddleware.js +2 -2
- package/lib/middlewares/VisitObservedSfusMiddleware.d.ts +6 -0
- package/lib/middlewares/VisitObservedSfusMiddleware.d.ts.map +1 -0
- package/lib/middlewares/VisitObservedSfusMiddleware.js +142 -0
- package/lib/middlewares/visitors/visitClient.d.ts.map +1 -1
- package/lib/middlewares/visitors/visitClient.js +13 -0
- package/lib/middlewares/visitors/{visitOutboundVideoTarcks.d.ts → visitOutboundVideoTarck.d.ts} +1 -1
- package/lib/middlewares/visitors/visitOutboundVideoTarck.d.ts.map +1 -0
- package/lib/middlewares/visitors/visitSfu.d.ts +5 -0
- package/lib/middlewares/visitors/visitSfu.d.ts.map +1 -0
- package/lib/middlewares/visitors/visitSfu.js +79 -0
- package/lib/middlewares/visitors/visitSfuInboundRtpPad.d.ts +5 -0
- package/lib/middlewares/visitors/visitSfuInboundRtpPad.d.ts.map +1 -0
- package/lib/middlewares/visitors/visitSfuInboundRtpPad.js +60 -0
- package/lib/middlewares/visitors/visitSfuOutboundRtpPad.d.ts +5 -0
- package/lib/middlewares/visitors/visitSfuOutboundRtpPad.d.ts.map +1 -0
- package/lib/middlewares/visitors/visitSfuOutboundRtpPad.js +61 -0
- package/lib/middlewares/visitors/visitSfuSctpChannel.d.ts +5 -0
- package/lib/middlewares/visitors/visitSfuSctpChannel.d.ts.map +1 -0
- package/lib/middlewares/visitors/visitSfuSctpChannel.js +58 -0
- package/lib/middlewares/visitors/visitSfuTransport.d.ts +5 -0
- package/lib/middlewares/visitors/visitSfuTransport.d.ts.map +1 -0
- package/lib/middlewares/visitors/visitSfuTransport.js +59 -0
- package/lib/samples/ObservedSfu.d.ts +27 -0
- package/lib/samples/ObservedSfu.d.ts.map +1 -0
- package/lib/samples/ObservedSfu.js +72 -0
- package/lib/samples/ObservedSfuInboundRtpPad.d.ts +15 -0
- package/lib/samples/ObservedSfuInboundRtpPad.d.ts.map +1 -0
- package/lib/samples/ObservedSfuInboundRtpPad.js +21 -0
- package/lib/samples/ObservedSfuOutboundRtpPad.d.ts +15 -0
- package/lib/samples/ObservedSfuOutboundRtpPad.d.ts.map +1 -0
- package/lib/samples/ObservedSfuOutboundRtpPad.js +21 -0
- package/lib/samples/ObservedSfuSctpChannel.d.ts +15 -0
- package/lib/samples/ObservedSfuSctpChannel.d.ts.map +1 -0
- package/lib/samples/ObservedSfuSctpChannel.js +21 -0
- package/lib/samples/ObservedSfuTransport.d.ts +30 -0
- package/lib/samples/ObservedSfuTransport.d.ts.map +1 -0
- package/lib/samples/ObservedSfuTransport.js +93 -0
- package/lib/samples/ObservedSfus.d.ts +16 -0
- package/lib/samples/ObservedSfus.d.ts.map +1 -0
- package/lib/samples/ObservedSfus.js +66 -0
- package/lib/sinks/ObserverSink.d.ts +3 -3
- package/lib/sinks/ObserverSink.d.ts.map +1 -1
- package/lib/sources/ObservedSfuSource.d.ts +14 -0
- package/lib/sources/ObservedSfuSource.d.ts.map +1 -0
- package/lib/sources/ObservedSfuSource.js +2 -0
- package/lib/sources/Sources.d.ts +8 -0
- package/lib/sources/Sources.d.ts.map +1 -1
- package/lib/sources/Sources.js +47 -1
- package/lib/storages/StorageProvider.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/Evaluator.ts +14 -2
- package/src/Observer.ts +22 -1
- package/src/common/logger.ts +145 -127
- package/src/common/types.ts +27 -0
- package/src/middlewares/CommitTransactionMiddleware.ts +46 -6
- package/src/middlewares/TransactionContext.ts +7 -3
- package/src/middlewares/TransactoinProcessor.ts +3 -1
- package/src/middlewares/VisitObservedCallsMiddleware.ts +1 -1
- package/src/middlewares/VisitObservedSfusMiddleware.ts +202 -0
- package/src/middlewares/visitors/visitClient.ts +15 -0
- package/src/middlewares/visitors/visitSfu.ts +64 -0
- package/src/middlewares/visitors/visitSfuInboundRtpPad.ts +50 -0
- package/src/middlewares/visitors/visitSfuOutboundRtpPad.ts +51 -0
- package/src/middlewares/visitors/visitSfuSctpChannel.ts +48 -0
- package/src/middlewares/visitors/visitSfuTransport.ts +48 -0
- package/src/samples/ObservedSfu.ts +108 -0
- package/src/samples/ObservedSfuInboundRtpPad.ts +34 -0
- package/src/samples/ObservedSfuOutboundRtpPad.ts +34 -0
- package/src/samples/ObservedSfuSctpChannel.ts +35 -0
- package/src/samples/ObservedSfuTransport.ts +130 -0
- package/src/samples/ObservedSfus.ts +85 -0
- package/src/sinks/ObserverSink.ts +5 -3
- package/src/sources/ObservedSfuSource.ts +23 -0
- package/src/sources/Sources.ts +54 -3
- package/src/storages/StorageProvider.ts +1 -4
- package/lib/middlewares/visitors/visitOutboundVideoTarcks.d.ts.map +0 -1
- package/lib/storages/StorageFactory.d.ts +0 -27
- package/lib/storages/StorageFactory.d.ts.map +0 -1
- package/lib/storages/StorageFactory.js +0 -37
- package/src/storages/StorageFactory.ts +0 -58
- /package/lib/middlewares/visitors/{visitOutboundVideoTarcks.js → visitOutboundVideoTarck.js} +0 -0
- /package/src/middlewares/visitors/{visitOutboundVideoTarcks.ts → visitOutboundVideoTarck.ts} +0 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ObservedSfuBuilder = void 0;
|
|
4
|
+
const ObservedSfuTransport_1 = require("./ObservedSfuTransport");
|
|
5
|
+
class ObservedSfuBuilder {
|
|
6
|
+
constructor(_config) {
|
|
7
|
+
this._config = _config;
|
|
8
|
+
this._sfuTransports = new Map();
|
|
9
|
+
this._sfuSamples = [];
|
|
10
|
+
}
|
|
11
|
+
addSfuSample(sfuSample) {
|
|
12
|
+
this._sfuSamples.push(sfuSample);
|
|
13
|
+
if (sfuSample.transports) {
|
|
14
|
+
for (const sfuTransport of sfuSample.transports) {
|
|
15
|
+
const builder = this._getOrCreateSfuTransportBuilder(sfuTransport.transportId);
|
|
16
|
+
builder.addTransportSample(sfuTransport);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
if (sfuSample.inboundRtpPads) {
|
|
20
|
+
for (const inboundRtpPad of sfuSample.inboundRtpPads) {
|
|
21
|
+
const builder = this._getOrCreateSfuTransportBuilder(inboundRtpPad.transportId);
|
|
22
|
+
builder.addSfuInboundRtpPad(inboundRtpPad);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
if (sfuSample.outboundRtpPads) {
|
|
26
|
+
for (const outboundRtpPad of sfuSample.outboundRtpPads) {
|
|
27
|
+
const builder = this._getOrCreateSfuTransportBuilder(outboundRtpPad.transportId);
|
|
28
|
+
builder.addSfuOutboundRtpPad(outboundRtpPad);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
if (sfuSample.sctpChannels) {
|
|
32
|
+
for (const sctpChannel of sfuSample.sctpChannels) {
|
|
33
|
+
const builder = this._getOrCreateSfuTransportBuilder(sctpChannel.transportId);
|
|
34
|
+
builder.addSfuSctpChannel(sctpChannel);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
if (this._minTimestamp === undefined || sfuSample.timestamp < this._minTimestamp) {
|
|
38
|
+
this._minTimestamp = sfuSample.timestamp;
|
|
39
|
+
}
|
|
40
|
+
if (this._maxTimestamp === undefined || this._maxTimestamp < sfuSample.timestamp) {
|
|
41
|
+
this._maxTimestamp = sfuSample.timestamp;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
_getOrCreateSfuTransportBuilder(transportId) {
|
|
45
|
+
let result = this._sfuTransports.get(transportId);
|
|
46
|
+
if (!result) {
|
|
47
|
+
result = new ObservedSfuTransport_1.ObservedSfuTransportBuilder({
|
|
48
|
+
transportId,
|
|
49
|
+
});
|
|
50
|
+
this._sfuTransports.set(transportId, result);
|
|
51
|
+
}
|
|
52
|
+
return result;
|
|
53
|
+
}
|
|
54
|
+
build() {
|
|
55
|
+
var _a, _b;
|
|
56
|
+
const observedSfuTransports = new Map();
|
|
57
|
+
const result = {
|
|
58
|
+
...this._config,
|
|
59
|
+
minTimestamp: (_a = this._minTimestamp) !== null && _a !== void 0 ? _a : Date.now(),
|
|
60
|
+
maxTimestamp: (_b = this._maxTimestamp) !== null && _b !== void 0 ? _b : Date.now(),
|
|
61
|
+
samples: () => this._sfuSamples.values(),
|
|
62
|
+
observedSfuTransports: () => observedSfuTransports.values(),
|
|
63
|
+
getObservedSfuTransport: (transportId) => observedSfuTransports.get(transportId),
|
|
64
|
+
};
|
|
65
|
+
for (const builder of this._sfuTransports.values()) {
|
|
66
|
+
const observedSfuTransport = builder.build(result);
|
|
67
|
+
observedSfuTransports.set(observedSfuTransport.transportId, observedSfuTransport);
|
|
68
|
+
}
|
|
69
|
+
return result;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
exports.ObservedSfuBuilder = ObservedSfuBuilder;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { SfuInboundRtpPad } from '@observertc/sample-schemas-js';
|
|
2
|
+
import { ObservedSfuTransport } from './ObservedSfuTransport';
|
|
3
|
+
export interface ObservedSfuInboundRtpPad {
|
|
4
|
+
readonly sfuTransport: ObservedSfuTransport;
|
|
5
|
+
readonly padId: string;
|
|
6
|
+
samples(): IterableIterator<SfuInboundRtpPad>;
|
|
7
|
+
}
|
|
8
|
+
export declare class ObservedSfuInboundRtpPadBuilder {
|
|
9
|
+
private _config;
|
|
10
|
+
private _samples;
|
|
11
|
+
constructor(_config: Omit<ObservedSfuInboundRtpPad, keyof IterableIterator<SfuInboundRtpPad> | 'sfuTransport' | 'samples'>);
|
|
12
|
+
addSample(sfuInboundRtpPad: SfuInboundRtpPad): void;
|
|
13
|
+
build(sfuTransport: ObservedSfuTransport): ObservedSfuInboundRtpPad;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=ObservedSfuInboundRtpPad.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ObservedSfuInboundRtpPad.d.ts","sourceRoot":"","sources":["../../src/samples/ObservedSfuInboundRtpPad.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D,MAAM,WAAW,wBAAwB;IACxC,QAAQ,CAAC,YAAY,EAAE,oBAAoB,CAAC;IAC5C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAEvB,OAAO,IAAI,gBAAgB,CAAC,gBAAgB,CAAC,CAAC;CAC9C;AAED,qBAAa,+BAA+B;IAG1C,OAAO,CAAC,OAAO;IAFhB,OAAO,CAAC,QAAQ,CAA0B;gBAEjC,OAAO,EAAE,IAAI,CACpB,wBAAwB,EACtB,MAAM,gBAAgB,CAAC,gBAAgB,CAAC,GACxC,cAAc,GACd,SAAS,CACX;IAGK,SAAS,CAAC,gBAAgB,EAAE,gBAAgB;IAI5C,KAAK,CAAC,YAAY,EAAE,oBAAoB,GAAG,wBAAwB;CAQ1E"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ObservedSfuInboundRtpPadBuilder = void 0;
|
|
4
|
+
class ObservedSfuInboundRtpPadBuilder {
|
|
5
|
+
constructor(_config) {
|
|
6
|
+
this._config = _config;
|
|
7
|
+
this._samples = [];
|
|
8
|
+
}
|
|
9
|
+
addSample(sfuInboundRtpPad) {
|
|
10
|
+
this._samples.push(sfuInboundRtpPad);
|
|
11
|
+
}
|
|
12
|
+
build(sfuTransport) {
|
|
13
|
+
const result = {
|
|
14
|
+
sfuTransport,
|
|
15
|
+
...this._config,
|
|
16
|
+
samples: () => this._samples.values(),
|
|
17
|
+
};
|
|
18
|
+
return result;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.ObservedSfuInboundRtpPadBuilder = ObservedSfuInboundRtpPadBuilder;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { SfuOutboundRtpPad } from '@observertc/sample-schemas-js';
|
|
2
|
+
import { ObservedSfuTransport } from './ObservedSfuTransport';
|
|
3
|
+
export interface ObservedSfuOutboundRtpPad {
|
|
4
|
+
readonly sfuTransport: ObservedSfuTransport;
|
|
5
|
+
readonly padId: string;
|
|
6
|
+
samples(): IterableIterator<SfuOutboundRtpPad>;
|
|
7
|
+
}
|
|
8
|
+
export declare class ObservedSfuOutboundRtpPadBuilder {
|
|
9
|
+
private _config;
|
|
10
|
+
private _samples;
|
|
11
|
+
constructor(_config: Omit<ObservedSfuOutboundRtpPad, keyof IterableIterator<SfuOutboundRtpPad> | 'sfuTransport' | 'samples'>);
|
|
12
|
+
addSample(sfuInboundRtpPad: SfuOutboundRtpPad): void;
|
|
13
|
+
build(sfuTransport: ObservedSfuTransport): ObservedSfuOutboundRtpPad;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=ObservedSfuOutboundRtpPad.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ObservedSfuOutboundRtpPad.d.ts","sourceRoot":"","sources":["../../src/samples/ObservedSfuOutboundRtpPad.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D,MAAM,WAAW,yBAAyB;IACzC,QAAQ,CAAC,YAAY,EAAE,oBAAoB,CAAC;IAC5C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAEvB,OAAO,IAAI,gBAAgB,CAAC,iBAAiB,CAAC,CAAC;CAC/C;AAED,qBAAa,gCAAgC;IAG3C,OAAO,CAAC,OAAO;IAFhB,OAAO,CAAC,QAAQ,CAA2B;gBAElC,OAAO,EAAE,IAAI,CACpB,yBAAyB,EACvB,MAAM,gBAAgB,CAAC,iBAAiB,CAAC,GACzC,cAAc,GACd,SAAS,CACX;IAGK,SAAS,CAAC,gBAAgB,EAAE,iBAAiB;IAI7C,KAAK,CAAC,YAAY,EAAE,oBAAoB,GAAG,yBAAyB;CAQ3E"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ObservedSfuOutboundRtpPadBuilder = void 0;
|
|
4
|
+
class ObservedSfuOutboundRtpPadBuilder {
|
|
5
|
+
constructor(_config) {
|
|
6
|
+
this._config = _config;
|
|
7
|
+
this._samples = [];
|
|
8
|
+
}
|
|
9
|
+
addSample(sfuInboundRtpPad) {
|
|
10
|
+
this._samples.push(sfuInboundRtpPad);
|
|
11
|
+
}
|
|
12
|
+
build(sfuTransport) {
|
|
13
|
+
const result = {
|
|
14
|
+
sfuTransport,
|
|
15
|
+
...this._config,
|
|
16
|
+
samples: () => this._samples.values(),
|
|
17
|
+
};
|
|
18
|
+
return result;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.ObservedSfuOutboundRtpPadBuilder = ObservedSfuOutboundRtpPadBuilder;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { SfuSctpChannel } from '@observertc/sample-schemas-js';
|
|
2
|
+
import { ObservedSfuTransport } from './ObservedSfuTransport';
|
|
3
|
+
export interface ObservedSfuSctpChannel {
|
|
4
|
+
readonly sfuTransport: ObservedSfuTransport;
|
|
5
|
+
readonly channelId: string;
|
|
6
|
+
samples(): IterableIterator<SfuSctpChannel>;
|
|
7
|
+
}
|
|
8
|
+
export declare class ObservedSfuSctpChannelBuilder {
|
|
9
|
+
private _config;
|
|
10
|
+
private _samples;
|
|
11
|
+
constructor(_config: Omit<ObservedSfuSctpChannel, keyof IterableIterator<SfuSctpChannel> | 'sfuTransport' | 'samples'>);
|
|
12
|
+
addSample(sfuSctpChannel: SfuSctpChannel): void;
|
|
13
|
+
build(sfuTransport: ObservedSfuTransport): ObservedSfuSctpChannel;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=ObservedSfuSctpChannel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ObservedSfuSctpChannel.d.ts","sourceRoot":"","sources":["../../src/samples/ObservedSfuSctpChannel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D,MAAM,WAAW,sBAAsB;IACtC,QAAQ,CAAC,YAAY,EAAE,oBAAoB,CAAC;IAC5C,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAE3B,OAAO,IAAI,gBAAgB,CAAC,cAAc,CAAC,CAAC;CAC1C;AAED,qBAAa,6BAA6B;IAGzC,OAAO,CAAC,OAAO;IAFjB,OAAO,CAAC,QAAQ,CAAwB;gBAE9B,OAAO,EAAE,IAAI,CACtB,sBAAsB,EACpB,MAAM,gBAAgB,CAAC,cAAc,CAAC,GACtC,cAAc,GACd,SAAS,CACT;IAGI,SAAS,CAAC,cAAc,EAAE,cAAc;IAIxC,KAAK,CAAC,YAAY,EAAE,oBAAoB,GAAG,sBAAsB;CAQtE"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ObservedSfuSctpChannelBuilder = void 0;
|
|
4
|
+
class ObservedSfuSctpChannelBuilder {
|
|
5
|
+
constructor(_config) {
|
|
6
|
+
this._config = _config;
|
|
7
|
+
this._samples = [];
|
|
8
|
+
}
|
|
9
|
+
addSample(sfuSctpChannel) {
|
|
10
|
+
this._samples.push(sfuSctpChannel);
|
|
11
|
+
}
|
|
12
|
+
build(sfuTransport) {
|
|
13
|
+
const result = {
|
|
14
|
+
sfuTransport,
|
|
15
|
+
...this._config,
|
|
16
|
+
samples: () => this._samples.values(),
|
|
17
|
+
};
|
|
18
|
+
return result;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.ObservedSfuSctpChannelBuilder = ObservedSfuSctpChannelBuilder;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { SfuInboundRtpPad, SfuOutboundRtpPad, SfuSctpChannel, SfuTransport } from '@observertc/sample-schemas-js';
|
|
2
|
+
import { ObservedSfu } from './ObservedSfu';
|
|
3
|
+
import { ObservedSfuInboundRtpPad } from './ObservedSfuInboundRtpPad';
|
|
4
|
+
import { ObservedSfuOutboundRtpPad } from './ObservedSfuOutboundRtpPad';
|
|
5
|
+
import { ObservedSfuSctpChannel } from './ObservedSfuSctpChannel';
|
|
6
|
+
export interface ObservedSfuTransport {
|
|
7
|
+
readonly sfu: ObservedSfu;
|
|
8
|
+
readonly transportId: string;
|
|
9
|
+
inboundRtpPads(): IterableIterator<ObservedSfuInboundRtpPad>;
|
|
10
|
+
outboundRtpPads(): IterableIterator<ObservedSfuOutboundRtpPad>;
|
|
11
|
+
sfuSctpChannels(): IterableIterator<ObservedSfuSctpChannel>;
|
|
12
|
+
transportSamples(): IterableIterator<SfuTransport>;
|
|
13
|
+
}
|
|
14
|
+
export declare class ObservedSfuTransportBuilder {
|
|
15
|
+
private _config;
|
|
16
|
+
private _inboundRtpPads;
|
|
17
|
+
private _outboundRtpPads;
|
|
18
|
+
private _sctpChannels;
|
|
19
|
+
private _transportSamples;
|
|
20
|
+
constructor(_config: Omit<ObservedSfuTransport, keyof IterableIterator<ObservedSfuTransport> | 'sfu' | 'inboundRtpPads' | 'outboundRtpPads' | 'sfuSctpChannels' | 'transportSamples'>);
|
|
21
|
+
addTransportSample(transportSample: SfuTransport): void;
|
|
22
|
+
addSfuInboundRtpPad(inboundRtpPad: SfuInboundRtpPad): void;
|
|
23
|
+
private _getSfuInboundRtpPadBuilder;
|
|
24
|
+
addSfuOutboundRtpPad(outboundRtpPad: SfuOutboundRtpPad): void;
|
|
25
|
+
private _getSfuOutboundRtpPadBuilder;
|
|
26
|
+
addSfuSctpChannel(sfuSctpChannel: SfuSctpChannel): void;
|
|
27
|
+
private _getSfuSctpChannel;
|
|
28
|
+
build(sfu: ObservedSfu): ObservedSfuTransport;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=ObservedSfuTransport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ObservedSfuTransport.d.ts","sourceRoot":"","sources":["../../src/samples/ObservedSfuTransport.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,EACd,YAAY,EACZ,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,wBAAwB,EAAmC,MAAM,4BAA4B,CAAC;AACvG,OAAO,EAAE,yBAAyB,EAAoC,MAAM,6BAA6B,CAAC;AAC1G,OAAO,EAAE,sBAAsB,EAAiC,MAAM,0BAA0B,CAAC;AAEjG,MAAM,WAAW,oBAAoB;IACpC,QAAQ,CAAC,GAAG,EAAE,WAAW,CAAC;IAC1B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAE7B,cAAc,IAAI,gBAAgB,CAAC,wBAAwB,CAAC,CAAC;IAC7D,eAAe,IAAI,gBAAgB,CAAC,yBAAyB,CAAC,CAAC;IAC/D,eAAe,IAAI,gBAAgB,CAAC,sBAAsB,CAAC,CAAC;IAE5D,gBAAgB,IAAI,gBAAgB,CAAC,YAAY,CAAC,CAAC;CACnD;AAED,qBAAa,2BAA2B;IAMtC,OAAO,CAAC,OAAO;IALhB,OAAO,CAAC,eAAe,CAAsD;IAC7E,OAAO,CAAC,gBAAgB,CAAuD;IAC/E,OAAO,CAAC,aAAa,CAAoD;IACzE,OAAO,CAAC,iBAAiB,CAAsB;gBAEtC,OAAO,EAAE,IAAI,CACpB,oBAAoB,EAClB,MAAM,gBAAgB,CAAC,oBAAoB,CAAC,GAC5C,KAAK,GACL,gBAAgB,GAChB,iBAAiB,GACjB,iBAAiB,GACjB,kBAAkB,CACpB;IAGK,kBAAkB,CAAC,eAAe,EAAE,YAAY;IAIhD,mBAAmB,CAAC,aAAa,EAAE,gBAAgB;IAO1D,OAAO,CAAC,2BAA2B;IAW5B,oBAAoB,CAAC,cAAc,EAAE,iBAAiB;IAO7D,OAAO,CAAC,4BAA4B;IAW7B,iBAAiB,CAAC,cAAc,EAAE,cAAc;IAOvD,OAAO,CAAC,kBAAkB;IAWnB,KAAK,CAAC,GAAG,EAAE,WAAW,GAAG,oBAAoB;CAgCpD"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ObservedSfuTransportBuilder = void 0;
|
|
4
|
+
const ObservedSfuInboundRtpPad_1 = require("./ObservedSfuInboundRtpPad");
|
|
5
|
+
const ObservedSfuOutboundRtpPad_1 = require("./ObservedSfuOutboundRtpPad");
|
|
6
|
+
const ObservedSfuSctpChannel_1 = require("./ObservedSfuSctpChannel");
|
|
7
|
+
class ObservedSfuTransportBuilder {
|
|
8
|
+
constructor(_config) {
|
|
9
|
+
this._config = _config;
|
|
10
|
+
this._inboundRtpPads = new Map();
|
|
11
|
+
this._outboundRtpPads = new Map();
|
|
12
|
+
this._sctpChannels = new Map();
|
|
13
|
+
this._transportSamples = [];
|
|
14
|
+
}
|
|
15
|
+
addTransportSample(transportSample) {
|
|
16
|
+
this._transportSamples.push(transportSample);
|
|
17
|
+
}
|
|
18
|
+
addSfuInboundRtpPad(inboundRtpPad) {
|
|
19
|
+
if (inboundRtpPad.padId) {
|
|
20
|
+
const builder = this._getSfuInboundRtpPadBuilder(inboundRtpPad.padId);
|
|
21
|
+
builder.addSample(inboundRtpPad);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
_getSfuInboundRtpPadBuilder(padId) {
|
|
25
|
+
let result = this._inboundRtpPads.get(padId);
|
|
26
|
+
if (!result) {
|
|
27
|
+
result = new ObservedSfuInboundRtpPad_1.ObservedSfuInboundRtpPadBuilder({
|
|
28
|
+
padId,
|
|
29
|
+
});
|
|
30
|
+
this._inboundRtpPads.set(padId, result);
|
|
31
|
+
}
|
|
32
|
+
return result;
|
|
33
|
+
}
|
|
34
|
+
addSfuOutboundRtpPad(outboundRtpPad) {
|
|
35
|
+
if (outboundRtpPad.padId) {
|
|
36
|
+
const builder = this._getSfuOutboundRtpPadBuilder(outboundRtpPad.padId);
|
|
37
|
+
builder.addSample(outboundRtpPad);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
_getSfuOutboundRtpPadBuilder(padId) {
|
|
41
|
+
let result = this._outboundRtpPads.get(padId);
|
|
42
|
+
if (!result) {
|
|
43
|
+
result = new ObservedSfuOutboundRtpPad_1.ObservedSfuOutboundRtpPadBuilder({
|
|
44
|
+
padId,
|
|
45
|
+
});
|
|
46
|
+
this._outboundRtpPads.set(padId, result);
|
|
47
|
+
}
|
|
48
|
+
return result;
|
|
49
|
+
}
|
|
50
|
+
addSfuSctpChannel(sfuSctpChannel) {
|
|
51
|
+
if (sfuSctpChannel.channelId) {
|
|
52
|
+
const builder = this._getSfuSctpChannel(sfuSctpChannel.channelId);
|
|
53
|
+
builder.addSample(sfuSctpChannel);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
_getSfuSctpChannel(channelId) {
|
|
57
|
+
let result = this._sctpChannels.get(channelId);
|
|
58
|
+
if (!result) {
|
|
59
|
+
result = new ObservedSfuSctpChannel_1.ObservedSfuSctpChannelBuilder({
|
|
60
|
+
channelId,
|
|
61
|
+
});
|
|
62
|
+
this._sctpChannels.set(channelId, result);
|
|
63
|
+
}
|
|
64
|
+
return result;
|
|
65
|
+
}
|
|
66
|
+
build(sfu) {
|
|
67
|
+
const sfuInboundRtpPads = new Map();
|
|
68
|
+
const sfuOutboundRtpPads = new Map();
|
|
69
|
+
const sfuSctpChannelsMap = new Map();
|
|
70
|
+
const result = {
|
|
71
|
+
sfu,
|
|
72
|
+
...this._config,
|
|
73
|
+
transportSamples: () => this._transportSamples.values(),
|
|
74
|
+
inboundRtpPads: () => sfuInboundRtpPads.values(),
|
|
75
|
+
outboundRtpPads: () => sfuOutboundRtpPads.values(),
|
|
76
|
+
sfuSctpChannels: () => sfuSctpChannelsMap.values(),
|
|
77
|
+
};
|
|
78
|
+
for (const builder of this._inboundRtpPads.values()) {
|
|
79
|
+
const observedInboundRtpPad = builder.build(result);
|
|
80
|
+
sfuInboundRtpPads.set(observedInboundRtpPad.padId, observedInboundRtpPad);
|
|
81
|
+
}
|
|
82
|
+
for (const builder of this._outboundRtpPads.values()) {
|
|
83
|
+
const observedOutboundRtpPad = builder.build(result);
|
|
84
|
+
sfuOutboundRtpPads.set(observedOutboundRtpPad.padId, observedOutboundRtpPad);
|
|
85
|
+
}
|
|
86
|
+
for (const builder of this._sctpChannels.values()) {
|
|
87
|
+
const observedSfuSctpChannel = builder.build(result);
|
|
88
|
+
sfuSctpChannelsMap.set(observedSfuSctpChannel.channelId, observedSfuSctpChannel);
|
|
89
|
+
}
|
|
90
|
+
return result;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
exports.ObservedSfuTransportBuilder = ObservedSfuTransportBuilder;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ObservedSfu, ObservedSfuBuilder } from './ObservedSfu';
|
|
2
|
+
export interface ObservedSfus {
|
|
3
|
+
sfuIds(): IterableIterator<string>;
|
|
4
|
+
sfuTransportIds(): IterableIterator<string>;
|
|
5
|
+
sfuInboundRtpPadIds(): IterableIterator<string>;
|
|
6
|
+
sfuOutboundRtpPadIds(): IterableIterator<string>;
|
|
7
|
+
observedSfus(): IterableIterator<ObservedSfu>;
|
|
8
|
+
getObservedSfu(sfuId: string): ObservedSfu | undefined;
|
|
9
|
+
}
|
|
10
|
+
export declare class ObservedSfusBuilder {
|
|
11
|
+
private _builders;
|
|
12
|
+
constructor();
|
|
13
|
+
getOrCreateObservedSfuBuilder(sfuId: string, configSupplier: () => ConstructorParameters<typeof ObservedSfuBuilder>[0]): ObservedSfuBuilder;
|
|
14
|
+
build(): ObservedSfus;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=ObservedSfus.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ObservedSfus.d.ts","sourceRoot":"","sources":["../../src/samples/ObservedSfus.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAEhE,MAAM,WAAW,YAAY;IAC5B,MAAM,IAAI,gBAAgB,CAAC,MAAM,CAAC,CAAC;IACnC,eAAe,IAAI,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAC5C,mBAAmB,IAAI,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAChD,oBAAoB,IAAI,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAEjD,YAAY,IAAI,gBAAgB,CAAC,WAAW,CAAC,CAAC;IAC9C,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS,CAAC;CACvD;AAED,qBAAa,mBAAmB;IAC/B,OAAO,CAAC,SAAS,CAAyC;;IAKnD,6BAA6B,CACnC,KAAK,EAAE,MAAM,EACb,cAAc,EAAE,MAAM,qBAAqB,CAAC,OAAO,kBAAkB,CAAC,CAAC,CAAC,CAAC;IAWnE,KAAK,IAAI,YAAY;CAoD5B"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ObservedSfusBuilder = void 0;
|
|
4
|
+
const ObservedSfu_1 = require("./ObservedSfu");
|
|
5
|
+
class ObservedSfusBuilder {
|
|
6
|
+
constructor() {
|
|
7
|
+
this._builders = new Map();
|
|
8
|
+
// nothing
|
|
9
|
+
}
|
|
10
|
+
getOrCreateObservedSfuBuilder(sfuId, configSupplier) {
|
|
11
|
+
let result = this._builders.get(sfuId);
|
|
12
|
+
if (!result) {
|
|
13
|
+
const config = configSupplier();
|
|
14
|
+
result = new ObservedSfu_1.ObservedSfuBuilder(config);
|
|
15
|
+
this._builders.set(sfuId, result);
|
|
16
|
+
}
|
|
17
|
+
return result;
|
|
18
|
+
}
|
|
19
|
+
build() {
|
|
20
|
+
const observedSfus = new Map();
|
|
21
|
+
const sfuIds = function* () {
|
|
22
|
+
for (const observedSfu of observedSfus.values()) {
|
|
23
|
+
yield observedSfu.sfuId;
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
const sfuTransportIds = function* () {
|
|
27
|
+
for (const observedSfu of observedSfus.values()) {
|
|
28
|
+
for (const observedTransport of observedSfu.observedSfuTransports()) {
|
|
29
|
+
yield observedTransport.transportId;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
const sfuInboundRtpPadIds = function* () {
|
|
34
|
+
for (const observedSfu of observedSfus.values()) {
|
|
35
|
+
for (const observedTransport of observedSfu.observedSfuTransports()) {
|
|
36
|
+
for (const sfuInboundRtpPad of observedTransport.inboundRtpPads()) {
|
|
37
|
+
yield sfuInboundRtpPad.padId;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
const sfuOutboundRtpPadIds = function* () {
|
|
43
|
+
for (const observedSfu of observedSfus.values()) {
|
|
44
|
+
for (const observedTransport of observedSfu.observedSfuTransports()) {
|
|
45
|
+
for (const sfuOutboundRtpPad of observedTransport.outboundRtpPads()) {
|
|
46
|
+
yield sfuOutboundRtpPad.padId;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
const result = {
|
|
52
|
+
sfuIds,
|
|
53
|
+
sfuTransportIds,
|
|
54
|
+
sfuInboundRtpPadIds,
|
|
55
|
+
sfuOutboundRtpPadIds,
|
|
56
|
+
observedSfus: () => observedSfus.values(),
|
|
57
|
+
getObservedSfu: (sfuId) => observedSfus.get(sfuId),
|
|
58
|
+
};
|
|
59
|
+
for (const builder of this._builders.values()) {
|
|
60
|
+
const observedSfu = builder.build();
|
|
61
|
+
observedSfus.set(observedSfu.sfuId, observedSfu);
|
|
62
|
+
}
|
|
63
|
+
return result;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
exports.ObservedSfusBuilder = ObservedSfusBuilder;
|
|
@@ -16,15 +16,15 @@ export type SinkEventsMap = {
|
|
|
16
16
|
'ice-candidate-pair': {
|
|
17
17
|
reports: IceCandidatePairReport[];
|
|
18
18
|
};
|
|
19
|
+
'peer-connection-transport': {
|
|
20
|
+
reports: PeerConnectionTransportReport[];
|
|
21
|
+
};
|
|
19
22
|
'inbound-audio-track': {
|
|
20
23
|
reports: InboundAudioTrackReport[];
|
|
21
24
|
};
|
|
22
25
|
'inbound-video-track': {
|
|
23
26
|
reports: InboundVideoTrackReport[];
|
|
24
27
|
};
|
|
25
|
-
'peer-connection-transport': {
|
|
26
|
-
reports: PeerConnectionTransportReport[];
|
|
27
|
-
};
|
|
28
28
|
'observer-event': {
|
|
29
29
|
reports: ObserverEventReport[];
|
|
30
30
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ObserverSink.d.ts","sourceRoot":"","sources":["../../src/sinks/ObserverSink.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,eAAe,EACf,cAAc,EACd,uBAAuB,EACvB,qBAAqB,EACrB,sBAAsB,EACtB,uBAAuB,EACvB,uBAAuB,EACvB,mBAAmB,EACnB,wBAAwB,EACxB,wBAAwB,EACxB,6BAA6B,EAC7B,cAAc,EACd,kBAAkB,EAClB,sBAAsB,EACtB,aAAa,EACb,uBAAuB,EACvB,mBAAmB,EACnB,kBAAkB,EAClB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAE9D,MAAM,MAAM,aAAa,GAAG;IAC3B,YAAY,EAAE;QACb,OAAO,EAAE,eAAe,EAAE,CAAC;KAC3B,CAAC;IACF,WAAW,EAAE;QACZ,OAAO,EAAE,cAAc,EAAE,CAAC;KAC1B,CAAC;IACF,qBAAqB,EAAE;QACtB,OAAO,EAAE,uBAAuB,EAAE,CAAC;KACnC,CAAC;IACF,kBAAkB,EAAE;QACnB,OAAO,EAAE,qBAAqB,EAAE,CAAC;KACjC,CAAC;IACF,oBAAoB,EAAE;QACrB,OAAO,EAAE,sBAAsB,EAAE,CAAC;KAClC,CAAC;IACF,
|
|
1
|
+
{"version":3,"file":"ObserverSink.d.ts","sourceRoot":"","sources":["../../src/sinks/ObserverSink.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,eAAe,EACf,cAAc,EACd,uBAAuB,EACvB,qBAAqB,EACrB,sBAAsB,EACtB,uBAAuB,EACvB,uBAAuB,EACvB,mBAAmB,EACnB,wBAAwB,EACxB,wBAAwB,EACxB,6BAA6B,EAC7B,cAAc,EACd,kBAAkB,EAClB,sBAAsB,EACtB,aAAa,EACb,uBAAuB,EACvB,mB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B;IAIhD,yBAAyB,CAAC,MAAM,EAAE,sBAAsB;IAIxD,0BAA0B,CAAC,MAAM,EAAE,uBAAuB;IAI1D,sBAAsB,CAAC,MAAM,EAAE,mBAAmB;IAIlD,qBAAqB,CAAC,MAAM,EAAE,kBAAkB;IAIhD,gBAAgB,CAAC,MAAM,EAAE,aAAa;IAItC,IAAI,IAAI,MAAM;IAkErB,OAAO,CAAC,KAAK;CAGb"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { SfuSample } from '@observertc/sample-schemas-js';
|
|
2
|
+
export type ObservedSfuSourceConfig = {
|
|
3
|
+
readonly serviceId: string;
|
|
4
|
+
readonly mediaUnitId: string;
|
|
5
|
+
readonly sfuId: string;
|
|
6
|
+
readonly joined: number;
|
|
7
|
+
timeZoneId?: string;
|
|
8
|
+
};
|
|
9
|
+
export interface ObservedSfuSource extends ObservedSfuSourceConfig {
|
|
10
|
+
readonly closed: boolean;
|
|
11
|
+
accept(...samples: SfuSample[]): void;
|
|
12
|
+
close(): void;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=ObservedSfuSource.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ObservedSfuSource.d.ts","sourceRoot":"","sources":["../../src/sources/ObservedSfuSource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAExE,MAAM,MAAM,uBAAuB,GAAG;IACrC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAExB,UAAU,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,WAAW,iBAAkB,SAAQ,uBAAuB;IACjE,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IAEzB,MAAM,CAAC,GAAG,OAAO,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC;IAOtC,KAAK,IAAI,IAAI,CAAC;CACd"}
|
package/lib/sources/Sources.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { ObservedCalls } from '../samples/ObservedCalls';
|
|
2
2
|
import { ObservedClientSource, ObservedClientSourceConfig } from './ObservedClientSource';
|
|
3
3
|
import { PartialBy } from '../common/utils';
|
|
4
|
+
import { ObservedSfuSourceConfig, ObservedSfuSource } from './ObservedSfuSource';
|
|
5
|
+
import { ObservedSfus } from '../samples/ObservedSfus';
|
|
4
6
|
export type SourcesConfig = {
|
|
5
7
|
maxSamples: number;
|
|
6
8
|
maxTimeInMs: number;
|
|
@@ -8,15 +10,20 @@ export type SourcesConfig = {
|
|
|
8
10
|
export type SourcesEvents = {
|
|
9
11
|
'observed-samples': {
|
|
10
12
|
observedCalls: ObservedCalls;
|
|
13
|
+
observedSfus: ObservedSfus;
|
|
11
14
|
numberOfSamples: number;
|
|
12
15
|
};
|
|
13
16
|
'removed-client-source': ObservedClientSourceConfig;
|
|
14
17
|
'added-client-source': ObservedClientSourceConfig;
|
|
18
|
+
'removed-sfu-source': ObservedSfuSourceConfig;
|
|
19
|
+
'added-sfu-source': ObservedSfuSourceConfig;
|
|
15
20
|
};
|
|
16
21
|
export declare class Sources {
|
|
17
22
|
readonly config: SourcesConfig;
|
|
18
23
|
private _clientSources;
|
|
24
|
+
private _sfuSources;
|
|
19
25
|
private _observedCallsBuilder;
|
|
26
|
+
private _observedSfusBuilder;
|
|
20
27
|
private _emitter;
|
|
21
28
|
private _timer?;
|
|
22
29
|
private _numberOfSamples;
|
|
@@ -25,6 +32,7 @@ export declare class Sources {
|
|
|
25
32
|
off<K extends keyof SourcesEvents>(event: K, listener: (data: SourcesEvents[K]) => void): this;
|
|
26
33
|
private _emit;
|
|
27
34
|
createClientSource(config: PartialBy<ObservedClientSourceConfig, 'joined'>): ObservedClientSource;
|
|
35
|
+
createSfuSource(config: PartialBy<ObservedSfuSourceConfig, 'joined'>): ObservedSfuSource;
|
|
28
36
|
private _incrementSamples;
|
|
29
37
|
private _emitSamples;
|
|
30
38
|
private _resetTimer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Sources.d.ts","sourceRoot":"","sources":["../../src/sources/Sources.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAwB,MAAM,0BAA0B,CAAC;AAC/E,OAAO,EAAE,oBAAoB,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AAG1F,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"Sources.d.ts","sourceRoot":"","sources":["../../src/sources/Sources.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAwB,MAAM,0BAA0B,CAAC;AAC/E,OAAO,EAAE,oBAAoB,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AAG1F,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACjF,OAAO,EAAE,YAAY,EAAuB,MAAM,yBAAyB,CAAC;AAI5E,MAAM,MAAM,aAAa,GAAG;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC3B,kBAAkB,EAAE;QACnB,aAAa,EAAE,aAAa,CAAC;QAC7B,YAAY,EAAE,YAAY,CAAC;QAC3B,eAAe,EAAE,MAAM,CAAC;KACxB,CAAC;IACF,uBAAuB,EAAE,0BAA0B,CAAC;IACpD,qBAAqB,EAAE,0BAA0B,CAAC;IAClD,oBAAoB,EAAE,uBAAuB,CAAC;IAC9C,kBAAkB,EAAE,uBAAuB,CAAC;CAC5C,CAAC;AAEF,qBAAa,OAAO;aASgB,MAAM,EAAE,aAAa;IARxD,OAAO,CAAC,cAAc,CAA2C;IACjE,OAAO,CAAC,WAAW,CAAwC;IAC3D,OAAO,CAAC,qBAAqB,CAA8B;IAC3D,OAAO,CAAC,oBAAoB,CAA6B;IACzD,OAAO,CAAC,QAAQ,CAAsB;IACtC,OAAO,CAAC,MAAM,CAAC,CAAgC;IAC/C,OAAO,CAAC,gBAAgB,CAAK;gBAEM,MAAM,EAAE,aAAa;IAEjD,EAAE,CAAC,CAAC,SAAS,MAAM,aAAa,EAAE,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,KAAK,IAAI,GAAG,IAAI;IAK7F,GAAG,CAAC,CAAC,SAAS,MAAM,aAAa,EAAE,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,KAAK,IAAI,GAAG,IAAI;IAKrG,OAAO,CAAC,KAAK;IAIN,kBAAkB,CAAC,MAAM,EAAE,SAAS,CAAC,0BAA0B,EAAE,QAAQ,CAAC,GAAG,oBAAoB;IAiDjG,eAAe,CAAC,MAAM,EAAE,SAAS,CAAC,uBAAuB,EAAE,QAAQ,CAAC,GAAG,iBAAiB;IA4C/F,OAAO,CAAC,iBAAiB;IAQzB,OAAO,CAAC,YAAY;IAapB,OAAO,CAAC,WAAW;IAaZ,KAAK;CAQZ"}
|
package/lib/sources/Sources.js
CHANGED
|
@@ -4,12 +4,15 @@ exports.Sources = void 0;
|
|
|
4
4
|
const ObservedCalls_1 = require("../samples/ObservedCalls");
|
|
5
5
|
const events_1 = require("events");
|
|
6
6
|
const logger_1 = require("../common/logger");
|
|
7
|
+
const ObservedSfus_1 = require("../samples/ObservedSfus");
|
|
7
8
|
const logger = (0, logger_1.createLogger)('Sources');
|
|
8
9
|
class Sources {
|
|
9
10
|
constructor(config) {
|
|
10
11
|
this.config = config;
|
|
11
12
|
this._clientSources = new Map();
|
|
13
|
+
this._sfuSources = new Map();
|
|
12
14
|
this._observedCallsBuilder = new ObservedCalls_1.ObservedCallsBuilder();
|
|
15
|
+
this._observedSfusBuilder = new ObservedSfus_1.ObservedSfusBuilder();
|
|
13
16
|
this._emitter = new events_1.EventEmitter();
|
|
14
17
|
this._numberOfSamples = 0;
|
|
15
18
|
}
|
|
@@ -71,6 +74,48 @@ class Sources {
|
|
|
71
74
|
this._emit('added-client-source', source);
|
|
72
75
|
return source;
|
|
73
76
|
}
|
|
77
|
+
createSfuSource(config) {
|
|
78
|
+
var _a;
|
|
79
|
+
const existingSfuSource = this._sfuSources.get(config.sfuId);
|
|
80
|
+
if (existingSfuSource) {
|
|
81
|
+
logger.warn(`Attempted to add a SfuSource for sfu ${config.sfuId} twice`);
|
|
82
|
+
return existingSfuSource;
|
|
83
|
+
}
|
|
84
|
+
let closed = false;
|
|
85
|
+
// config.joined = config.joined ?? Date.now();
|
|
86
|
+
const source = {
|
|
87
|
+
...config,
|
|
88
|
+
joined: (_a = config.joined) !== null && _a !== void 0 ? _a : Date.now(),
|
|
89
|
+
accept: (...samples) => {
|
|
90
|
+
if (closed) {
|
|
91
|
+
throw new Error('Closed ClientSource cannot accept samples');
|
|
92
|
+
}
|
|
93
|
+
const observedSfuBuilder = this._observedSfusBuilder.getOrCreateObservedSfuBuilder(config.sfuId, () => {
|
|
94
|
+
return {
|
|
95
|
+
...source,
|
|
96
|
+
};
|
|
97
|
+
});
|
|
98
|
+
for (const sample of samples) {
|
|
99
|
+
observedSfuBuilder.addSfuSample(sample);
|
|
100
|
+
}
|
|
101
|
+
this._incrementSamples(samples.length);
|
|
102
|
+
},
|
|
103
|
+
close: () => {
|
|
104
|
+
if (closed) {
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
closed = true;
|
|
108
|
+
this._emit('removed-sfu-source', source);
|
|
109
|
+
},
|
|
110
|
+
closed,
|
|
111
|
+
};
|
|
112
|
+
if (this._sfuSources.size < 1) {
|
|
113
|
+
this._resetTimer();
|
|
114
|
+
}
|
|
115
|
+
this._sfuSources.set(config.sfuId, source);
|
|
116
|
+
this._emit('added-sfu-source', source);
|
|
117
|
+
return source;
|
|
118
|
+
}
|
|
74
119
|
_incrementSamples(increment = 1) {
|
|
75
120
|
this._numberOfSamples += increment;
|
|
76
121
|
if (this.config.maxSamples < 1 || this._numberOfSamples < this.config.maxSamples) {
|
|
@@ -82,9 +127,10 @@ class Sources {
|
|
|
82
127
|
this._resetTimer();
|
|
83
128
|
const observedCalls = this._observedCallsBuilder.build();
|
|
84
129
|
this._observedCallsBuilder = new ObservedCalls_1.ObservedCallsBuilder();
|
|
130
|
+
const observedSfus = this._observedSfusBuilder.build();
|
|
85
131
|
this._emit('observed-samples', {
|
|
86
132
|
observedCalls,
|
|
87
|
-
|
|
133
|
+
observedSfus,
|
|
88
134
|
numberOfSamples: this._numberOfSamples,
|
|
89
135
|
});
|
|
90
136
|
this._numberOfSamples = 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StorageProvider.d.ts","sourceRoot":"","sources":["../../src/storages/StorageProvider.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"StorageProvider.d.ts","sourceRoot":"","sources":["../../src/storages/StorageProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC;AAG3C,MAAM,WAAW,eAAe;IAC/B,QAAQ,CAAC,WAAW,EAAE,eAAe,CAAC,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;IAC3D,QAAQ,CAAC,aAAa,EAAE,eAAe,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;IAC/D,QAAQ,CAAC,qBAAqB,EAAE,eAAe,CAAC,MAAM,EAAE,MAAM,CAAC,cAAc,CAAC,CAAC;IAC/E,QAAQ,CAAC,mBAAmB,EAAE,eAAe,CAAC,MAAM,EAAE,MAAM,CAAC,YAAY,CAAC,CAAC;IAC3E,QAAQ,CAAC,oBAAoB,EAAE,eAAe,CAAC,MAAM,EAAE,MAAM,CAAC,aAAa,CAAC,CAAC;IAC7E,QAAQ,CAAC,UAAU,EAAE,eAAe,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC;IACzD,QAAQ,CAAC,mBAAmB,EAAE,eAAe,CAAC,MAAM,EAAE,MAAM,CAAC,YAAY,CAAC,CAAC;IAC3E,QAAQ,CAAC,uBAAuB,EAAE,eAAe,CAAC,MAAM,EAAE,MAAM,CAAC,gBAAgB,CAAC,CAAC;IACnF,QAAQ,CAAC,wBAAwB,EAAE,eAAe,CAAC,MAAM,EAAE,MAAM,CAAC,iBAAiB,CAAC,CAAC;IACrF,QAAQ,CAAC,qBAAqB,EAAE,eAAe,CAAC,MAAM,EAAE,MAAM,CAAC,cAAc,CAAC,CAAC;CAC/E;AAED,wBAAgB,2BAA2B,IAAI,eAAe,CAwB7D"}
|