@observertc/observer-js 0.9.7-beta → 0.9.8-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 +1 -1
- package/lib/Evaluator.d.ts.map +1 -1
- package/lib/Evaluator.js +1 -1
- package/lib/Observer.d.ts +4 -2
- package/lib/Observer.d.ts.map +1 -1
- package/lib/Observer.js +16 -0
- package/lib/common/types.d.ts +22 -1
- package/lib/common/types.d.ts.map +1 -1
- package/lib/common/types.js +0 -2
- package/lib/index.d.ts +2 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/middlewares/Processor.d.ts +1 -0
- package/lib/middlewares/Processor.d.ts.map +1 -1
- package/lib/middlewares/Processor.js +3 -0
- package/lib/sinks/ObserverSink.d.ts +12 -2
- package/lib/sinks/ObserverSink.d.ts.map +1 -1
- package/lib/sinks/ObserverSink.js +97 -1
- package/package.json +1 -1
- package/src/Evaluator.ts +4 -2
- package/src/Observer.ts +20 -2
- package/src/common/types.ts +29 -2
- package/src/index.ts +2 -2
- package/src/middlewares/Processor.ts +4 -0
- package/src/sinks/ObserverSink.ts +110 -3
package/lib/Evaluator.d.ts
CHANGED
|
@@ -17,13 +17,13 @@ export declare class Evaluator {
|
|
|
17
17
|
private readonly _storageProvider;
|
|
18
18
|
private readonly _reportsCollector;
|
|
19
19
|
private _index;
|
|
20
|
+
private _evaluations;
|
|
20
21
|
private _clientOperations;
|
|
21
22
|
private _emitter;
|
|
22
23
|
private _evaluatorProcesses;
|
|
23
24
|
private _callProcessor;
|
|
24
25
|
private _transactionProcessor;
|
|
25
26
|
private _customProcessor;
|
|
26
|
-
private _evaluations;
|
|
27
27
|
constructor(config: EvaluatorConfig, _callSemaphore: Semaphore, _storageProvider: StorageProvider, _reportsCollector: ReportsCollector);
|
|
28
28
|
addProcess(process: EvaluatorProcess): void;
|
|
29
29
|
removeProcess(process: EvaluatorProcess): void;
|
package/lib/Evaluator.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Evaluator.d.ts","sourceRoot":"","sources":["../src/Evaluator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,
|
|
1
|
+
{"version":3,"file":"Evaluator.d.ts","sourceRoot":"","sources":["../src/Evaluator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAuB,MAAM,gBAAgB,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,0BAA0B,EAAE,MAAM,gCAAgC,CAAC;AAC5E,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAW7D,MAAM,MAAM,eAAe,GAAG;IAC7B,KAAK,EAAE,SAAS,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC7B,YAAY,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,CAAC,gBAAgB,EAAE,gBAAgB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAErF,qBAAa,SAAS;aAeJ,MAAM,EAAE,eAAe;IACvC,OAAO,CAAC,QAAQ,CAAC,cAAc;IAC/B,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IACjC,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IAjBnC,OAAO,CAAC,MAAM,CAAK;IACnB,OAAO,CAAC,YAAY,CAAoC;IAExD,OAAO,CAAC,iBAAiB,CAAoC;IAC7D,OAAO,CAAC,QAAQ,CAAsB;IAEtC,OAAO,CAAC,mBAAmB,CAA6D;IACxF,OAAO,CAAC,cAAc,CAAmC;IACzD,OAAO,CAAC,qBAAqB,CAAgC;IAC7D,OAAO,CAAC,gBAAgB,CAA8B;gBAKrC,MAAM,EAAE,eAAe,EACtB,cAAc,EAAE,SAAS,EACzB,gBAAgB,EAAE,eAAe,EACjC,iBAAiB,EAAE,gBAAgB;IAa9C,UAAU,CAAC,OAAO,EAAE,gBAAgB;IASpC,aAAa,CAAC,OAAO,EAAE,gBAAgB;IASvC,qBAAqB,CAAC,YAAY,EAAE,0BAA0B;IAQ9D,sBAAsB,CAAC,YAAY,EAAE,0BAA0B;IAO/D,EAAE,CAAC,CAAC,SAAS,MAAM,eAAe,EAAE,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC,CAAC,KAAK,IAAI,GAAG,IAAI;IAKjG,GAAG,CAAC,CAAC,SAAS,MAAM,eAAe,EAAE,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC,CAAC,KAAK,IAAI,GAAG,IAAI;IAKzG,OAAO,CAAC,KAAK;IAIN,kBAAkB,CAAC,OAAO,EAAE,aAAa,CAAC,kBAAkB,CAAC,GAAG,IAAI;YAuD7D,KAAK;IAuBnB,IAAW,cAAc,IAAI,MAAM,CAElC;YAEa,QAAQ;CAqBtB"}
|
package/lib/Evaluator.js
CHANGED
|
@@ -16,10 +16,10 @@ class Evaluator {
|
|
|
16
16
|
this._storageProvider = _storageProvider;
|
|
17
17
|
this._reportsCollector = _reportsCollector;
|
|
18
18
|
this._index = 0;
|
|
19
|
+
this._evaluations = new Map();
|
|
19
20
|
this._clientOperations = new Map();
|
|
20
21
|
this._emitter = new events_1.EventEmitter();
|
|
21
22
|
this._evaluatorProcesses = new Map();
|
|
22
|
-
this._evaluations = new Map();
|
|
23
23
|
this._callProcessor = (0, CallProcessor_1.createCallProcessor)(_storageProvider, _reportsCollector);
|
|
24
24
|
this._transactionProcessor = (0, TransactoinProcessor_1.createTransactionProcessor)(_storageProvider, _reportsCollector, this.config.fetchSamples);
|
|
25
25
|
this._customProcessor = (0, Processor_1.createProcessor)();
|
package/lib/Observer.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ObserverSinkEmitter, ObserverSinkProcess, SinkConfig } from './sinks/ObserverSink';
|
|
2
2
|
import { SourcesConfig } from './sources/Sources';
|
|
3
3
|
import { StorageProvider } from './storages/StorageProvider';
|
|
4
4
|
import * as Models from './models/Models';
|
|
@@ -47,9 +47,11 @@ export declare class Observer {
|
|
|
47
47
|
createCallSource(config: PartialBy<ObservedCallSourceConfig, 'serviceId' | 'mediaUnitId'>): ObservedCallSource;
|
|
48
48
|
createClientSource(config: PartialBy<ObservedClientSourceConfig, 'serviceId' | 'mediaUnitId' | 'joined'>): ObservedClientSource;
|
|
49
49
|
createSfuSource(config: PartialBy<ObservedSfuSourceConfig, 'serviceId' | 'mediaUnitId' | 'joined'>): ObservedSfuSource;
|
|
50
|
-
get sink():
|
|
50
|
+
get sink(): ObserverSinkEmitter;
|
|
51
51
|
addEvaluators(...processes: EvaluatorProcess[]): void;
|
|
52
52
|
removeEvaluators(...processes: EvaluatorProcess[]): void;
|
|
53
|
+
addSinks(...processes: ObserverSinkProcess[]): void;
|
|
54
|
+
removeSinks(...processes: ObserverSinkProcess[]): void;
|
|
53
55
|
calls(): AsyncIterableIterator<[string, Models.Call]>;
|
|
54
56
|
sfus(): AsyncIterableIterator<[string, Models.Sfu]>;
|
|
55
57
|
sfuTransports(): AsyncIterableIterator<[string, Models.SfuTransport]>;
|
package/lib/Observer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Observer.d.ts","sourceRoot":"","sources":["../src/Observer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"Observer.d.ts","sourceRoot":"","sources":["../src/Observer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,UAAU,EAAY,MAAM,sBAAsB,CAAC;AACtG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,GAAG,SAAS,CAAC;IAKpF,oBAAoB,CAChC,cAAc,EAAE,QAAQ,CAAC,MAAM,CAAC,GAC9B,OAAO,CAAC,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,cAAc,CAAC,CAAC;IAKtD,IAAW,MAAM,YAEhB;IAEM,KAAK;CAQZ"}
|
package/lib/Observer.js
CHANGED
|
@@ -141,6 +141,22 @@ class Observer {
|
|
|
141
141
|
this._evaluator.removeProcess(process);
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
|
+
addSinks(...processes) {
|
|
145
|
+
if (this._closed) {
|
|
146
|
+
throw new Error(`Attempted to add an evaluator to a closed observer`);
|
|
147
|
+
}
|
|
148
|
+
for (const process of processes) {
|
|
149
|
+
this._sink.addProcess(process);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
removeSinks(...processes) {
|
|
153
|
+
if (this._closed) {
|
|
154
|
+
throw new Error(`Attempted to remove an evaluator from a closed observer`);
|
|
155
|
+
}
|
|
156
|
+
for (const process of processes) {
|
|
157
|
+
this._sink.removeProcess(process);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
144
160
|
calls() {
|
|
145
161
|
const { callStorage } = this._storages;
|
|
146
162
|
return callStorage[Symbol.asyncIterator]();
|
package/lib/common/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CallEventReport, CallMetaReport, ClientExtensionReport, InboundAudioTrackReport, InboundVideoTrackReport, OutboundAudioTrackReport, OutboundVideoTrackReport, PeerConnectionTransportReport, SfuEventReport, SfuExtensionReport } from '@observertc/report-schemas-js';
|
|
1
|
+
import { CallEventReport, CallMetaReport, ClientDataChannelReport, ClientExtensionReport, IceCandidatePairReport, InboundAudioTrackReport, InboundVideoTrackReport, ObserverEventReport, OutboundAudioTrackReport, OutboundVideoTrackReport, PeerConnectionTransportReport, SfuEventReport, SfuExtensionReport, SfuInboundRtpPadReport, SfuMetaReport, SfuOutboundRtpPadReport, SfuSctpStreamReport, SFUTransportReport } from '@observertc/report-schemas-js';
|
|
2
2
|
import { ObservedCalls } from '../samples/ObservedCalls';
|
|
3
3
|
import { ReportsCollector } from './ReportsCollector';
|
|
4
4
|
import * as Models from '../models/Models';
|
|
@@ -66,4 +66,25 @@ export interface EvaluatorContext {
|
|
|
66
66
|
readonly sfuExtensionStats: SfuExtensionReport[];
|
|
67
67
|
}
|
|
68
68
|
export type EvaluatorMiddleware = Middleware<EvaluatorContext>;
|
|
69
|
+
export interface ObserverSinkContext {
|
|
70
|
+
readonly callEventReports: CallEventReport[];
|
|
71
|
+
readonly callMetaReports: CallMetaReport[];
|
|
72
|
+
readonly clientDataChannelReports: ClientDataChannelReport[];
|
|
73
|
+
readonly clientExtensionReports: ClientExtensionReport[];
|
|
74
|
+
readonly iceCandidatePairReports: IceCandidatePairReport[];
|
|
75
|
+
readonly inboundAudioTrackReports: InboundAudioTrackReport[];
|
|
76
|
+
readonly inboundVideoTrackReports: InboundVideoTrackReport[];
|
|
77
|
+
readonly peerConnectionTransportReports: PeerConnectionTransportReport[];
|
|
78
|
+
readonly observerEventReports: ObserverEventReport[];
|
|
79
|
+
readonly outboundAudioTrackReports: OutboundAudioTrackReport[];
|
|
80
|
+
readonly outboundVideoTrackReports: OutboundVideoTrackReport[];
|
|
81
|
+
readonly sfuEventReports: SfuEventReport[];
|
|
82
|
+
readonly sfuExtensionReports: SfuExtensionReport[];
|
|
83
|
+
readonly sfuInboundRtpPadReports: SfuInboundRtpPadReport[];
|
|
84
|
+
readonly sfuOutboundRtpPadReports: SfuOutboundRtpPadReport[];
|
|
85
|
+
readonly sfuSctpStreamReports: SfuSctpStreamReport[];
|
|
86
|
+
readonly sfuTransportReports: SFUTransportReport[];
|
|
87
|
+
readonly sfuMetaReports: SfuMetaReport[];
|
|
88
|
+
}
|
|
89
|
+
export type ObserverSinkMiddleware = Middleware<ObserverSinkContext>;
|
|
69
90
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"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,7 @@ export type { ObserverConfig } from './Observer';
|
|
|
2
2
|
export type { EvaluatorConfig, EvaluatorProcess } from './Evaluator';
|
|
3
3
|
export type { SourcesConfig } from './sources/Sources';
|
|
4
4
|
export { Observer } from './Observer';
|
|
5
|
-
export type { ObserverSink } from './sinks/ObserverSink';
|
|
5
|
+
export type { ObserverSinkEmitter as ObserverSink } from './sinks/ObserverSink';
|
|
6
6
|
export type { ObserverStorage } from './storages/ObserverStorage';
|
|
7
7
|
export type { StorageProvider } from './storages/StorageProvider';
|
|
8
8
|
export * as Models from './models/Models';
|
|
@@ -13,7 +13,7 @@ export type { CallEventReport, CallMetaReport, ClientDataChannelReport, ClientEx
|
|
|
13
13
|
export type { ObservedClientSource, ObservedClientSourceConfig } from './sources/ObservedClientSource';
|
|
14
14
|
export type { ObservedSfuSource, ObservedSfuSourceConfig } from './sources/ObservedSfuSource';
|
|
15
15
|
export type { ObservedCallSource, ObservedCallSourceConfig as ObservedCallConfig } from './sources/ObservedCallSource';
|
|
16
|
-
export type { EvaluatorContext, EvaluatorMiddleware } from './common/types';
|
|
16
|
+
export type { EvaluatorContext, EvaluatorMiddleware, ObserverSinkContext, ObserverSinkMiddleware } from './common/types';
|
|
17
17
|
import { Observer, ObserverConfig } from './Observer';
|
|
18
18
|
export declare function createObserver(config?: Partial<ObserverConfig>): Observer;
|
|
19
19
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAErE,YAAY,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEvD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,YAAY,EAAE,YAAY,EAAE,MAAM,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AA0B,EAAE,MAAM,gCAAgC,CAAC;AAEvG,YAAY,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAE9F,YAAY,EAAE,kBAAkB,EAAE,wBAAwB,IAAI,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAEvH,YAAY,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAEzH,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACtD,wBAAgB,cAAc,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,YAE9D"}
|
|
@@ -3,6 +3,7 @@ export interface Processor<T> {
|
|
|
3
3
|
use(value: T): Promise<void | T>;
|
|
4
4
|
addMiddleware(...middlewares: Middleware<T>[]): Processor<T>;
|
|
5
5
|
removeMiddleware(...middlewares: Middleware<T>[]): Processor<T>;
|
|
6
|
+
getSize(): number;
|
|
6
7
|
}
|
|
7
8
|
export declare function createProcessor<T>(...processes: Middleware<T>[]): Processor<T>;
|
|
8
9
|
//# sourceMappingURL=Processor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Processor.d.ts","sourceRoot":"","sources":["../../src/middlewares/Processor.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAI1C,MAAM,WAAW,SAAS,CAAC,CAAC;IAC3B,GAAG,CAAC,KAAK,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC;IACjC,aAAa,CAAC,GAAG,WAAW,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;IAC7D,gBAAgB,CAAC,GAAG,WAAW,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"Processor.d.ts","sourceRoot":"","sources":["../../src/middlewares/Processor.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAI1C,MAAM,WAAW,SAAS,CAAC,CAAC;IAC3B,GAAG,CAAC,KAAK,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC;IACjC,aAAa,CAAC,GAAG,WAAW,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;IAC7D,gBAAgB,CAAC,GAAG,WAAW,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;IAChE,OAAO,IAAI,MAAM,CAAC;CAClB;AAED,wBAAgB,eAAe,CAAC,CAAC,EAAE,GAAG,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,GAAG,SAAS,CAAC,CAAC,CAAC,CAyC9E"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { CallEventReport, CallMetaReport, ClientDataChannelReport, ClientExtensionReport, IceCandidatePairReport, InboundAudioTrackReport, InboundVideoTrackReport, ObserverEventReport, OutboundAudioTrackReport, OutboundVideoTrackReport, PeerConnectionTransportReport, SfuEventReport, SfuExtensionReport, SfuInboundRtpPadReport, SfuMetaReport, SfuOutboundRtpPadReport, SfuSctpStreamReport, SFUTransportReport } from '@observertc/report-schemas-js';
|
|
2
2
|
import { ReportsCollector } from '../common/ReportsCollector';
|
|
3
|
+
import { ObserverSinkContext } from '../common/types';
|
|
3
4
|
export type SinkEventsMap = {
|
|
4
5
|
'call-event': {
|
|
5
6
|
reports: CallEventReport[];
|
|
@@ -57,13 +58,18 @@ export type SinkEventsMap = {
|
|
|
57
58
|
};
|
|
58
59
|
};
|
|
59
60
|
export type SinkConfig = Record<string, unknown>;
|
|
60
|
-
export
|
|
61
|
+
export type ObserverSinkProcess = (observerSinkContext: ObserverSinkContext) => Promise<void>;
|
|
62
|
+
export interface ObserverSinkEmitter {
|
|
61
63
|
on<K extends keyof SinkEventsMap>(event: K, listener: (reports: SinkEventsMap[K]) => void): this;
|
|
62
64
|
off<K extends keyof SinkEventsMap>(event: K, listener: (reports: SinkEventsMap[K]) => void): this;
|
|
63
65
|
once<K extends keyof SinkEventsMap>(event: K, listener: (reports: SinkEventsMap[K]) => void): this;
|
|
64
66
|
}
|
|
65
|
-
export declare class SinkImpl implements ReportsCollector,
|
|
67
|
+
export declare class SinkImpl implements ReportsCollector, ObserverSinkEmitter {
|
|
66
68
|
readonly config: SinkConfig;
|
|
69
|
+
private _index;
|
|
70
|
+
private _processes;
|
|
71
|
+
private _customProcesses;
|
|
72
|
+
private readonly _processor;
|
|
67
73
|
private _emitter;
|
|
68
74
|
private _callEventReports;
|
|
69
75
|
private _callMetaReports;
|
|
@@ -109,7 +115,11 @@ export declare class SinkImpl implements ReportsCollector, ObserverSink {
|
|
|
109
115
|
getClientExtensionReports(): ClientExtensionReport[];
|
|
110
116
|
getSfuEventReports(): SfuEventReport[];
|
|
111
117
|
getSfuExtensionReports(): SfuExtensionReport[];
|
|
118
|
+
addProcess(process: ObserverSinkProcess): void;
|
|
119
|
+
removeProcess(process: ObserverSinkProcess): void;
|
|
120
|
+
private _process;
|
|
112
121
|
emit(): number;
|
|
113
122
|
private _emit;
|
|
123
|
+
private _createObserverSinkContext;
|
|
114
124
|
}
|
|
115
125
|
//# sourceMappingURL=ObserverSink.d.ts.map
|
|
@@ -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;
|
|
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;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAKtD,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,2BAA2B,EAAE;QAC5B,OAAO,EAAE,6BAA6B,EAAE,CAAC;KACzC,CAAC;IACF,qBAAqB,EAAE;QACtB,OAAO,EAAE,uBAAuB,EAAE,CAAC;KACnC,CAAC;IACF,qBAAqB,EAAE;QACtB,OAAO,EAAE,uBAAuB,EAAE,CAAC;KACnC,CAAC;IACF,gBAAgB,EAAE;QACjB,OAAO,EAA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O,CAAC,KAAK;IAIb,OAAO,CAAE,0BAA0B;CAyCnC"}
|
|
@@ -2,9 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SinkImpl = void 0;
|
|
4
4
|
const events_1 = require("events");
|
|
5
|
+
const Processor_1 = require("../middlewares/Processor");
|
|
6
|
+
const VisitObservedCallsMiddleware_1 = require("../middlewares/VisitObservedCallsMiddleware");
|
|
5
7
|
class SinkImpl {
|
|
6
8
|
constructor(config) {
|
|
7
9
|
this.config = config;
|
|
10
|
+
this._index = 0;
|
|
11
|
+
this._processes = new Map();
|
|
12
|
+
this._customProcesses = new Map();
|
|
8
13
|
this._emitter = new events_1.EventEmitter();
|
|
9
14
|
this._callEventReports = [];
|
|
10
15
|
this._callMetaReports = [];
|
|
@@ -24,7 +29,7 @@ class SinkImpl {
|
|
|
24
29
|
this._sfuSctpStreamReports = [];
|
|
25
30
|
this._sfuTransportReports = [];
|
|
26
31
|
this._sfuMetaReports = [];
|
|
27
|
-
|
|
32
|
+
this._processor = (0, Processor_1.createProcessor)();
|
|
28
33
|
}
|
|
29
34
|
on(event, listener) {
|
|
30
35
|
this._emitter.addListener(event, listener);
|
|
@@ -104,6 +109,53 @@ class SinkImpl {
|
|
|
104
109
|
getSfuExtensionReports() {
|
|
105
110
|
return this._sfuExtensionReports;
|
|
106
111
|
}
|
|
112
|
+
addProcess(process) {
|
|
113
|
+
const middleware = async (context, next) => {
|
|
114
|
+
await process(context);
|
|
115
|
+
if (next)
|
|
116
|
+
await next(context);
|
|
117
|
+
};
|
|
118
|
+
this._customProcesses.set(process, middleware);
|
|
119
|
+
this._processor.addMiddleware(middleware);
|
|
120
|
+
}
|
|
121
|
+
removeProcess(process) {
|
|
122
|
+
const middleware = this._customProcesses.get(process);
|
|
123
|
+
if (!middleware) {
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
this._customProcesses.delete(process);
|
|
127
|
+
this._processor.removeMiddleware(middleware);
|
|
128
|
+
}
|
|
129
|
+
async _process(context) {
|
|
130
|
+
var _a;
|
|
131
|
+
if (this._processor.getSize() < 1) {
|
|
132
|
+
// no process to execute
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
if (this._processes.has(this._index)) {
|
|
136
|
+
VisitObservedCallsMiddleware_1.logger.warn(`The sink process has been called while the previous process has not yet completed. This may indicate that the observer is attempting to process more reports than it can handle.`);
|
|
137
|
+
}
|
|
138
|
+
const actualBlockingPoint = (_a = this._processes.get(this._index)) !== null && _a !== void 0 ? _a : Promise.resolve();
|
|
139
|
+
const index = ++this._index;
|
|
140
|
+
const result = new Promise((resolve, reject) => {
|
|
141
|
+
actualBlockingPoint.then(() => {
|
|
142
|
+
this._processor.use(context)
|
|
143
|
+
.then(() => resolve())
|
|
144
|
+
.catch((err) => reject(err));
|
|
145
|
+
});
|
|
146
|
+
});
|
|
147
|
+
const nextBlockingPoint = new Promise((resolve) => {
|
|
148
|
+
result.then(() => {
|
|
149
|
+
this._processes.delete(index);
|
|
150
|
+
resolve();
|
|
151
|
+
}).catch(() => {
|
|
152
|
+
this._processes.delete(index);
|
|
153
|
+
resolve();
|
|
154
|
+
});
|
|
155
|
+
});
|
|
156
|
+
this._processes.set(index, nextBlockingPoint);
|
|
157
|
+
return result;
|
|
158
|
+
}
|
|
107
159
|
emit() {
|
|
108
160
|
let result = 0;
|
|
109
161
|
const checkAndEmit = (eventName, reports) => {
|
|
@@ -112,6 +164,10 @@ class SinkImpl {
|
|
|
112
164
|
result += reports.length;
|
|
113
165
|
}
|
|
114
166
|
};
|
|
167
|
+
const context = this._createObserverSinkContext();
|
|
168
|
+
this._process(context).catch(err => {
|
|
169
|
+
VisitObservedCallsMiddleware_1.logger.error(`Error occurred while processing reports`, err);
|
|
170
|
+
});
|
|
115
171
|
checkAndEmit('call-event', this._callEventReports);
|
|
116
172
|
this._callEventReports = [];
|
|
117
173
|
checkAndEmit('call-meta', this._callMetaReports);
|
|
@@ -153,5 +209,45 @@ class SinkImpl {
|
|
|
153
209
|
_emit(event, reports) {
|
|
154
210
|
return this._emitter.emit(event, reports);
|
|
155
211
|
}
|
|
212
|
+
_createObserverSinkContext() {
|
|
213
|
+
const callEventReports = [...this._callEventReports];
|
|
214
|
+
const callMetaReports = [...this._callMetaReports];
|
|
215
|
+
const clientDataChannelReports = [...this._clientDataChannelReports];
|
|
216
|
+
const clientExtensionReports = [...this._clientExtensionReports];
|
|
217
|
+
const iceCandidatePairReports = [...this._iceCandidatePairReports];
|
|
218
|
+
const inboundAudioTrackReports = [...this._inboundAudioTrackReports];
|
|
219
|
+
const inboundVideoTrackReports = [...this._inboundVideoTrackReports];
|
|
220
|
+
const peerConnectionTransportReports = [...this._peerConnectionTransportReports];
|
|
221
|
+
const observerEventReports = [...this._observerEventReports];
|
|
222
|
+
const outboundAudioTrackReports = [...this._outboundAudioTrackReports];
|
|
223
|
+
const outboundVideoTrackReports = [...this._outboundVideoTrackReports];
|
|
224
|
+
const sfuEventReports = [...this._sfuEventReports];
|
|
225
|
+
const sfuExtensionReports = [...this._sfuExtensionReports];
|
|
226
|
+
const sfuInboundRtpPadReports = [...this._sfuInboundRtpPadReports];
|
|
227
|
+
const sfuOutboundRtpPadReports = [...this._sfuOutboundRtpPadReports];
|
|
228
|
+
const sfuSctpStreamReports = [...this._sfuSctpStreamReports];
|
|
229
|
+
const sfuTransportReports = [...this._sfuTransportReports];
|
|
230
|
+
const sfuMetaReports = [...this._sfuMetaReports];
|
|
231
|
+
return {
|
|
232
|
+
callEventReports,
|
|
233
|
+
callMetaReports,
|
|
234
|
+
clientDataChannelReports,
|
|
235
|
+
clientExtensionReports,
|
|
236
|
+
iceCandidatePairReports,
|
|
237
|
+
inboundAudioTrackReports,
|
|
238
|
+
inboundVideoTrackReports,
|
|
239
|
+
peerConnectionTransportReports,
|
|
240
|
+
observerEventReports,
|
|
241
|
+
outboundAudioTrackReports,
|
|
242
|
+
outboundVideoTrackReports,
|
|
243
|
+
sfuEventReports,
|
|
244
|
+
sfuExtensionReports,
|
|
245
|
+
sfuInboundRtpPadReports,
|
|
246
|
+
sfuOutboundRtpPadReports,
|
|
247
|
+
sfuSctpStreamReports,
|
|
248
|
+
sfuTransportReports,
|
|
249
|
+
sfuMetaReports,
|
|
250
|
+
};
|
|
251
|
+
}
|
|
156
252
|
}
|
|
157
253
|
exports.SinkImpl = SinkImpl;
|
package/package.json
CHANGED
package/src/Evaluator.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createLogger } from './common/logger';
|
|
2
2
|
import { Semaphore } from './common/Semaphore';
|
|
3
|
-
import { EvaluatorContext } from './common/types';
|
|
3
|
+
import { EvaluatorContext, ObserverSinkContext } from './common/types';
|
|
4
4
|
import { ReportsCollector } from './common/ReportsCollector';
|
|
5
5
|
import { ObservedClientSourceConfig } from './sources/ObservedClientSource';
|
|
6
6
|
import { SourcesEvents } from './sources/Sources';
|
|
@@ -27,6 +27,8 @@ export type EvaluatorProcess = (evaluatorContext: EvaluatorContext) => Promise<v
|
|
|
27
27
|
|
|
28
28
|
export class Evaluator {
|
|
29
29
|
private _index = 0;
|
|
30
|
+
private _evaluations = new Map<number, Promise<void>>();
|
|
31
|
+
|
|
30
32
|
private _clientOperations = new Map<string, CallOperation>();
|
|
31
33
|
private _emitter = new EventEmitter();
|
|
32
34
|
|
|
@@ -35,7 +37,7 @@ export class Evaluator {
|
|
|
35
37
|
private _transactionProcessor: Processor<TransactionContext>;
|
|
36
38
|
private _customProcessor: Processor<EvaluatorContext>;
|
|
37
39
|
|
|
38
|
-
|
|
40
|
+
|
|
39
41
|
|
|
40
42
|
public constructor(
|
|
41
43
|
public readonly config: EvaluatorConfig,
|
package/src/Observer.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ObserverSinkEmitter, ObserverSinkProcess, SinkConfig, SinkImpl } from './sinks/ObserverSink';
|
|
2
2
|
import { Sources, SourcesConfig } from './sources/Sources';
|
|
3
3
|
import { createSimpleStorageProvider, StorageProvider } from './storages/StorageProvider';
|
|
4
4
|
import * as Models from './models/Models';
|
|
@@ -172,7 +172,7 @@ export class Observer {
|
|
|
172
172
|
});
|
|
173
173
|
}
|
|
174
174
|
|
|
175
|
-
public get sink():
|
|
175
|
+
public get sink(): ObserverSinkEmitter {
|
|
176
176
|
return this._sink;
|
|
177
177
|
}
|
|
178
178
|
|
|
@@ -194,6 +194,24 @@ export class Observer {
|
|
|
194
194
|
}
|
|
195
195
|
}
|
|
196
196
|
|
|
197
|
+
public addSinks(...processes: ObserverSinkProcess[]) {
|
|
198
|
+
if (this._closed) {
|
|
199
|
+
throw new Error(`Attempted to add an evaluator to a closed observer`);
|
|
200
|
+
}
|
|
201
|
+
for (const process of processes) {
|
|
202
|
+
this._sink.addProcess(process);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
public removeSinks(...processes: ObserverSinkProcess[]) {
|
|
207
|
+
if (this._closed) {
|
|
208
|
+
throw new Error(`Attempted to remove an evaluator from a closed observer`);
|
|
209
|
+
}
|
|
210
|
+
for (const process of processes) {
|
|
211
|
+
this._sink.removeProcess(process);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
197
215
|
public calls(): AsyncIterableIterator<[string, Models.Call]> {
|
|
198
216
|
const { callStorage } = this._storages;
|
|
199
217
|
return callStorage[Symbol.asyncIterator]();
|
package/src/common/types.ts
CHANGED
|
@@ -1,14 +1,22 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CallEventReport,
|
|
3
3
|
CallMetaReport,
|
|
4
|
+
ClientDataChannelReport,
|
|
4
5
|
ClientExtensionReport,
|
|
6
|
+
IceCandidatePairReport,
|
|
5
7
|
InboundAudioTrackReport,
|
|
6
8
|
InboundVideoTrackReport,
|
|
9
|
+
ObserverEventReport,
|
|
7
10
|
OutboundAudioTrackReport,
|
|
8
11
|
OutboundVideoTrackReport,
|
|
9
12
|
PeerConnectionTransportReport,
|
|
10
13
|
SfuEventReport,
|
|
11
14
|
SfuExtensionReport,
|
|
15
|
+
SfuInboundRtpPadReport,
|
|
16
|
+
SfuMetaReport,
|
|
17
|
+
SfuOutboundRtpPadReport,
|
|
18
|
+
SfuSctpStreamReport,
|
|
19
|
+
SFUTransportReport,
|
|
12
20
|
} from '@observertc/report-schemas-js';
|
|
13
21
|
import { ObservedCalls } from '../samples/ObservedCalls';
|
|
14
22
|
import { ReportsCollector } from './ReportsCollector';
|
|
@@ -102,6 +110,25 @@ export interface EvaluatorContext {
|
|
|
102
110
|
|
|
103
111
|
export type EvaluatorMiddleware = Middleware<EvaluatorContext>;
|
|
104
112
|
|
|
105
|
-
|
|
113
|
+
export interface ObserverSinkContext {
|
|
114
|
+
readonly callEventReports: CallEventReport[];
|
|
115
|
+
readonly callMetaReports: CallMetaReport[];
|
|
116
|
+
readonly clientDataChannelReports: ClientDataChannelReport[];
|
|
117
|
+
readonly clientExtensionReports: ClientExtensionReport[];
|
|
118
|
+
readonly iceCandidatePairReports: IceCandidatePairReport[];
|
|
119
|
+
readonly inboundAudioTrackReports: InboundAudioTrackReport[];
|
|
120
|
+
readonly inboundVideoTrackReports: InboundVideoTrackReport[];
|
|
121
|
+
readonly peerConnectionTransportReports: PeerConnectionTransportReport[];
|
|
122
|
+
readonly observerEventReports: ObserverEventReport[];
|
|
123
|
+
readonly outboundAudioTrackReports: OutboundAudioTrackReport[];
|
|
124
|
+
readonly outboundVideoTrackReports: OutboundVideoTrackReport[];
|
|
125
|
+
readonly sfuEventReports: SfuEventReport[];
|
|
126
|
+
readonly sfuExtensionReports: SfuExtensionReport[];
|
|
127
|
+
readonly sfuInboundRtpPadReports: SfuInboundRtpPadReport[];
|
|
128
|
+
readonly sfuOutboundRtpPadReports: SfuOutboundRtpPadReport[];
|
|
129
|
+
readonly sfuSctpStreamReports: SfuSctpStreamReport[];
|
|
130
|
+
readonly sfuTransportReports: SFUTransportReport[];
|
|
131
|
+
readonly sfuMetaReports: SfuMetaReport[];
|
|
132
|
+
}
|
|
106
133
|
|
|
107
|
-
|
|
134
|
+
export type ObserverSinkMiddleware = Middleware<ObserverSinkContext>;
|
package/src/index.ts
CHANGED
|
@@ -5,7 +5,7 @@ export type { EvaluatorConfig, EvaluatorProcess } from './Evaluator';
|
|
|
5
5
|
export type { SourcesConfig } from './sources/Sources';
|
|
6
6
|
|
|
7
7
|
export { Observer } from './Observer';
|
|
8
|
-
export type { ObserverSink } from './sinks/ObserverSink';
|
|
8
|
+
export type { ObserverSinkEmitter as ObserverSink } from './sinks/ObserverSink';
|
|
9
9
|
export type { ObserverStorage } from './storages/ObserverStorage';
|
|
10
10
|
export type { StorageProvider } from './storages/StorageProvider';
|
|
11
11
|
export * as Models from './models/Models';
|
|
@@ -64,7 +64,7 @@ export type { ObservedSfuSource, ObservedSfuSourceConfig } from './sources/Obser
|
|
|
64
64
|
|
|
65
65
|
export type { ObservedCallSource, ObservedCallSourceConfig as ObservedCallConfig } from './sources/ObservedCallSource';
|
|
66
66
|
|
|
67
|
-
export type { EvaluatorContext, EvaluatorMiddleware } from './common/types';
|
|
67
|
+
export type { EvaluatorContext, EvaluatorMiddleware, ObserverSinkContext, ObserverSinkMiddleware } from './common/types';
|
|
68
68
|
|
|
69
69
|
import { Observer, ObserverConfig } from './Observer';
|
|
70
70
|
export function createObserver(config?: Partial<ObserverConfig>) {
|
|
@@ -7,6 +7,7 @@ export interface Processor<T> {
|
|
|
7
7
|
use(value: T): Promise<void | T>;
|
|
8
8
|
addMiddleware(...middlewares: Middleware<T>[]): Processor<T>;
|
|
9
9
|
removeMiddleware(...middlewares: Middleware<T>[]): Processor<T>;
|
|
10
|
+
getSize(): number;
|
|
10
11
|
}
|
|
11
12
|
|
|
12
13
|
export function createProcessor<T>(...processes: Middleware<T>[]): Processor<T> {
|
|
@@ -44,6 +45,9 @@ export function createProcessor<T>(...processes: Middleware<T>[]): Processor<T>
|
|
|
44
45
|
|
|
45
46
|
return executeMiddleware(value, 0);
|
|
46
47
|
},
|
|
48
|
+
getSize: (): number => {
|
|
49
|
+
return stack.length;
|
|
50
|
+
}
|
|
47
51
|
};
|
|
48
52
|
|
|
49
53
|
return result;
|
|
@@ -20,6 +20,10 @@ import {
|
|
|
20
20
|
} from '@observertc/report-schemas-js';
|
|
21
21
|
import { EventEmitter } from 'events';
|
|
22
22
|
import { ReportsCollector } from '../common/ReportsCollector';
|
|
23
|
+
import { ObserverSinkContext } from '../common/types';
|
|
24
|
+
import { Middleware } from '../middlewares/Middleware';
|
|
25
|
+
import { createProcessor, Processor } from '../middlewares/Processor';
|
|
26
|
+
import { logger } from '../middlewares/VisitObservedCallsMiddleware';
|
|
23
27
|
|
|
24
28
|
export type SinkEventsMap = {
|
|
25
29
|
'call-event': {
|
|
@@ -79,14 +83,20 @@ export type SinkEventsMap = {
|
|
|
79
83
|
};
|
|
80
84
|
|
|
81
85
|
export type SinkConfig = Record<string, unknown>;
|
|
86
|
+
export type ObserverSinkProcess = (observerSinkContext: ObserverSinkContext) => Promise<void>;
|
|
82
87
|
|
|
83
|
-
export interface
|
|
88
|
+
export interface ObserverSinkEmitter {
|
|
84
89
|
on<K extends keyof SinkEventsMap>(event: K, listener: (reports: SinkEventsMap[K]) => void): this;
|
|
85
90
|
off<K extends keyof SinkEventsMap>(event: K, listener: (reports: SinkEventsMap[K]) => void): this;
|
|
86
91
|
once<K extends keyof SinkEventsMap>(event: K, listener: (reports: SinkEventsMap[K]) => void): this;
|
|
87
92
|
}
|
|
88
93
|
|
|
89
|
-
export class SinkImpl implements ReportsCollector,
|
|
94
|
+
export class SinkImpl implements ReportsCollector, ObserverSinkEmitter {
|
|
95
|
+
private _index = 0;
|
|
96
|
+
private _processes = new Map<number, Promise<void>>();
|
|
97
|
+
private _customProcesses = new Map<ObserverSinkProcess, Middleware<ObserverSinkContext>>();
|
|
98
|
+
private readonly _processor: Processor<ObserverSinkContext>;
|
|
99
|
+
|
|
90
100
|
private _emitter = new EventEmitter();
|
|
91
101
|
private _callEventReports: CallEventReport[] = [];
|
|
92
102
|
private _callMetaReports: CallMetaReport[] = [];
|
|
@@ -108,9 +118,10 @@ export class SinkImpl implements ReportsCollector, ObserverSink {
|
|
|
108
118
|
private _sfuMetaReports: SfuMetaReport[] = [];
|
|
109
119
|
|
|
110
120
|
public constructor(public readonly config: SinkConfig) {
|
|
111
|
-
|
|
121
|
+
this._processor = createProcessor();
|
|
112
122
|
}
|
|
113
123
|
|
|
124
|
+
|
|
114
125
|
public on<K extends keyof SinkEventsMap>(event: K, listener: (reports: SinkEventsMap[K]) => void): this {
|
|
115
126
|
this._emitter.addListener(event, listener);
|
|
116
127
|
return this;
|
|
@@ -214,6 +225,55 @@ export class SinkImpl implements ReportsCollector, ObserverSink {
|
|
|
214
225
|
return this._sfuExtensionReports;
|
|
215
226
|
}
|
|
216
227
|
|
|
228
|
+
public addProcess(process: ObserverSinkProcess) {
|
|
229
|
+
const middleware: Middleware<ObserverSinkContext> = async (context, next) => {
|
|
230
|
+
await process(context);
|
|
231
|
+
if (next) await next(context);
|
|
232
|
+
};
|
|
233
|
+
this._customProcesses.set(process, middleware);
|
|
234
|
+
this._processor.addMiddleware(middleware);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
public removeProcess(process: ObserverSinkProcess) {
|
|
238
|
+
const middleware = this._customProcesses.get(process);
|
|
239
|
+
if (!middleware) {
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
this._customProcesses.delete(process);
|
|
243
|
+
this._processor.removeMiddleware(middleware);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
private async _process(context: ObserverSinkContext): Promise<void> {
|
|
247
|
+
if (this._processor.getSize() < 1) {
|
|
248
|
+
// no process to execute
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
if (this._processes.has(this._index)) {
|
|
252
|
+
logger.warn(`The sink process has been called while the previous process has not yet completed. This may indicate that the observer is attempting to process more reports than it can handle.`);
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
const actualBlockingPoint = this._processes.get(this._index) ?? Promise.resolve();
|
|
256
|
+
const index = ++this._index;
|
|
257
|
+
const result = new Promise<void>((resolve, reject) => {
|
|
258
|
+
actualBlockingPoint.then(() => {
|
|
259
|
+
this._processor.use(context)
|
|
260
|
+
.then(() => resolve())
|
|
261
|
+
.catch((err) => reject(err));
|
|
262
|
+
});
|
|
263
|
+
});
|
|
264
|
+
const nextBlockingPoint = new Promise<void>((resolve) => {
|
|
265
|
+
result.then(() => {
|
|
266
|
+
this._processes.delete(index);
|
|
267
|
+
resolve();
|
|
268
|
+
}).catch(() => {
|
|
269
|
+
this._processes.delete(index);
|
|
270
|
+
resolve();
|
|
271
|
+
});
|
|
272
|
+
});
|
|
273
|
+
this._processes.set(index, nextBlockingPoint);
|
|
274
|
+
return result;
|
|
275
|
+
}
|
|
276
|
+
|
|
217
277
|
public emit(): number {
|
|
218
278
|
let result = 0;
|
|
219
279
|
const checkAndEmit = (eventName: keyof SinkEventsMap, reports: any[]) => {
|
|
@@ -222,6 +282,11 @@ export class SinkImpl implements ReportsCollector, ObserverSink {
|
|
|
222
282
|
result += reports.length;
|
|
223
283
|
}
|
|
224
284
|
};
|
|
285
|
+
|
|
286
|
+
const context = this._createObserverSinkContext();
|
|
287
|
+
this._process(context).catch(err => {
|
|
288
|
+
logger.error(`Error occurred while processing reports`, err);
|
|
289
|
+
})
|
|
225
290
|
|
|
226
291
|
checkAndEmit('call-event', this._callEventReports);
|
|
227
292
|
this._callEventReports = [];
|
|
@@ -283,4 +348,46 @@ export class SinkImpl implements ReportsCollector, ObserverSink {
|
|
|
283
348
|
private _emit<K extends keyof SinkEventsMap>(event: K, reports: SinkEventsMap[K]): boolean {
|
|
284
349
|
return this._emitter.emit(event, reports);
|
|
285
350
|
}
|
|
351
|
+
|
|
352
|
+
private _createObserverSinkContext(): ObserverSinkContext {
|
|
353
|
+
const callEventReports = [...this._callEventReports];
|
|
354
|
+
const callMetaReports = [...this._callMetaReports];
|
|
355
|
+
const clientDataChannelReports = [...this._clientDataChannelReports];
|
|
356
|
+
const clientExtensionReports = [...this._clientExtensionReports];
|
|
357
|
+
const iceCandidatePairReports = [...this._iceCandidatePairReports];
|
|
358
|
+
const inboundAudioTrackReports = [...this._inboundAudioTrackReports];
|
|
359
|
+
const inboundVideoTrackReports = [...this._inboundVideoTrackReports];
|
|
360
|
+
const peerConnectionTransportReports = [...this._peerConnectionTransportReports];
|
|
361
|
+
const observerEventReports = [...this._observerEventReports];
|
|
362
|
+
const outboundAudioTrackReports = [...this._outboundAudioTrackReports];
|
|
363
|
+
const outboundVideoTrackReports = [...this._outboundVideoTrackReports];
|
|
364
|
+
const sfuEventReports = [...this._sfuEventReports];
|
|
365
|
+
const sfuExtensionReports = [...this._sfuExtensionReports];
|
|
366
|
+
const sfuInboundRtpPadReports = [...this._sfuInboundRtpPadReports];
|
|
367
|
+
const sfuOutboundRtpPadReports = [...this._sfuOutboundRtpPadReports];
|
|
368
|
+
const sfuSctpStreamReports = [...this._sfuSctpStreamReports];
|
|
369
|
+
const sfuTransportReports = [...this._sfuTransportReports];
|
|
370
|
+
const sfuMetaReports = [...this._sfuMetaReports];
|
|
371
|
+
|
|
372
|
+
return {
|
|
373
|
+
callEventReports,
|
|
374
|
+
callMetaReports,
|
|
375
|
+
clientDataChannelReports,
|
|
376
|
+
clientExtensionReports,
|
|
377
|
+
iceCandidatePairReports,
|
|
378
|
+
inboundAudioTrackReports,
|
|
379
|
+
inboundVideoTrackReports,
|
|
380
|
+
peerConnectionTransportReports,
|
|
381
|
+
observerEventReports,
|
|
382
|
+
outboundAudioTrackReports,
|
|
383
|
+
outboundVideoTrackReports,
|
|
384
|
+
sfuEventReports,
|
|
385
|
+
sfuExtensionReports,
|
|
386
|
+
sfuInboundRtpPadReports,
|
|
387
|
+
sfuOutboundRtpPadReports,
|
|
388
|
+
sfuSctpStreamReports,
|
|
389
|
+
sfuTransportReports,
|
|
390
|
+
sfuMetaReports,
|
|
391
|
+
};
|
|
392
|
+
}
|
|
286
393
|
}
|