@observertc/observer-js 0.42.9 → 1.0.1-57a1811.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.prettierrc +6 -6
- package/README.md +0 -104
- package/lib/ObservedCall.d.ts +38 -41
- package/lib/ObservedCall.d.ts.map +1 -1
- package/lib/ObservedCall.js +97 -109
- package/lib/ObservedCertificate.d.ts +19 -0
- package/lib/ObservedCertificate.d.ts.map +1 -0
- package/lib/ObservedCertificate.js +38 -0
- package/lib/ObservedClient.d.ts +49 -127
- package/lib/ObservedClient.d.ts.map +1 -1
- package/lib/ObservedClient.js +201 -750
- package/lib/ObservedCodec.d.ts +22 -0
- package/lib/ObservedCodec.d.ts.map +1 -0
- package/lib/ObservedCodec.js +45 -0
- package/lib/ObservedDataChannel.d.ts +23 -69
- package/lib/ObservedDataChannel.d.ts.map +1 -1
- package/lib/ObservedDataChannel.js +67 -109
- package/lib/ObservedIceCandidate.d.ts +29 -0
- package/lib/ObservedIceCandidate.d.ts.map +1 -0
- package/lib/ObservedIceCandidate.js +59 -0
- package/lib/ObservedIceCandidatePair.d.ts +44 -0
- package/lib/ObservedIceCandidatePair.d.ts.map +1 -0
- package/lib/ObservedIceCandidatePair.js +111 -0
- package/lib/ObservedIceTransport.d.ts +32 -0
- package/lib/ObservedIceTransport.d.ts.map +1 -0
- package/lib/ObservedIceTransport.js +65 -0
- package/lib/ObservedInboundRtp.d.ts +92 -0
- package/lib/ObservedInboundRtp.d.ts.map +1 -0
- package/lib/ObservedInboundRtp.js +193 -0
- package/lib/ObservedInboundTrack.d.ts +29 -0
- package/lib/ObservedInboundTrack.d.ts.map +1 -0
- package/lib/ObservedInboundTrack.js +57 -0
- package/lib/ObservedMediaPlayout.d.ts +22 -0
- package/lib/ObservedMediaPlayout.d.ts.map +1 -0
- package/lib/ObservedMediaPlayout.js +42 -0
- package/lib/ObservedMediaSource.d.ts +28 -0
- package/lib/ObservedMediaSource.d.ts.map +1 -0
- package/lib/ObservedMediaSource.js +55 -0
- package/lib/ObservedOutboundRtp.d.ts +62 -0
- package/lib/ObservedOutboundRtp.d.ts.map +1 -0
- package/lib/ObservedOutboundRtp.js +144 -0
- package/lib/ObservedOutboundTrack.d.ts +29 -0
- package/lib/ObservedOutboundTrack.d.ts.map +1 -0
- package/lib/ObservedOutboundTrack.js +57 -0
- package/lib/ObservedPeerConnection.d.ts +128 -78
- package/lib/ObservedPeerConnection.d.ts.map +1 -1
- package/lib/ObservedPeerConnection.js +624 -357
- package/lib/ObservedPeerConnectionTransport.d.ts +17 -0
- package/lib/ObservedPeerConnectionTransport.d.ts.map +1 -0
- package/lib/ObservedPeerConnectionTransport.js +34 -0
- package/lib/ObservedRemoteInboundRtp.d.ts +30 -0
- package/lib/ObservedRemoteInboundRtp.d.ts.map +1 -0
- package/lib/ObservedRemoteInboundRtp.js +60 -0
- package/lib/ObservedRemoteOutboundRtp.d.ts +30 -0
- package/lib/ObservedRemoteOutboundRtp.d.ts.map +1 -0
- package/lib/ObservedRemoteOutboundRtp.js +60 -0
- package/lib/ObservedTURN.d.ts +31 -0
- package/lib/ObservedTURN.d.ts.map +1 -0
- package/lib/ObservedTURN.js +58 -0
- package/lib/ObservedTurnServer.d.ts +25 -0
- package/lib/ObservedTurnServer.d.ts.map +1 -0
- package/lib/ObservedTurnServer.js +59 -0
- package/lib/Observer.d.ts +31 -51
- package/lib/Observer.d.ts.map +1 -1
- package/lib/Observer.js +75 -229
- package/lib/common/Middleware.d.ts +10 -1
- package/lib/common/Middleware.d.ts.map +1 -1
- package/lib/common/Middleware.js +55 -36
- package/lib/common/logger.d.ts +8 -4
- package/lib/common/logger.d.ts.map +1 -1
- package/lib/common/logger.js +44 -68
- package/lib/common/types.d.ts +0 -21
- package/lib/common/types.d.ts.map +1 -1
- package/lib/common/types.js +1 -0
- package/lib/common/utils.d.ts +1 -0
- package/lib/common/utils.d.ts.map +1 -1
- package/lib/common/utils.js +13 -1
- package/lib/detectors/Detector.d.ts +5 -0
- package/lib/detectors/Detector.d.ts.map +1 -0
- package/lib/detectors/Detector.js +3 -0
- package/lib/detectors/Detectors.d.ts +11 -0
- package/lib/detectors/Detectors.d.ts.map +1 -0
- package/lib/detectors/Detectors.js +34 -0
- package/lib/index.d.ts +24 -25
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +41 -41
- package/lib/monitors/TurnUsageMonitor.d.ts +0 -52
- package/lib/monitors/TurnUsageMonitor.d.ts.map +1 -1
- package/lib/monitors/TurnUsageMonitor.js +145 -120
- package/lib/schema/ClientEventTypes.d.ts +33 -0
- package/lib/schema/ClientEventTypes.d.ts.map +1 -0
- package/lib/schema/ClientEventTypes.js +38 -0
- package/lib/schema/ClientMetaTypes.d.ts +34 -0
- package/lib/schema/ClientMetaTypes.d.ts.map +1 -0
- package/lib/schema/ClientMetaTypes.js +16 -0
- package/lib/schema/ClientSample.d.ts +1333 -0
- package/lib/schema/ClientSample.d.ts.map +1 -0
- package/lib/schema/ClientSample.js +4 -0
- package/lib/scores/CalculatedScore.d.ts +6 -0
- package/lib/scores/CalculatedScore.d.ts.map +1 -0
- package/lib/scores/DefaultCallScoreCalculator.d.ts +7 -0
- package/lib/scores/DefaultCallScoreCalculator.d.ts.map +1 -0
- package/lib/scores/DefaultCallScoreCalculator.js +21 -0
- package/lib/scores/ScoreCalculator.d.ts +4 -0
- package/lib/scores/ScoreCalculator.d.ts.map +1 -0
- package/lib/scores/ScoreCalculator.js +2 -0
- package/lib/utils/CallUpdater.d.ts +5 -0
- package/lib/utils/CallUpdater.d.ts.map +1 -0
- package/lib/utils/CallUpdater.js +2 -0
- package/lib/utils/OnAllClientCallUpdater.d.ts +16 -0
- package/lib/utils/OnAllClientCallUpdater.d.ts.map +1 -0
- package/lib/utils/OnAllClientCallUpdater.js +58 -0
- package/lib/utils/RemoteTrackResolver.d.ts +7 -0
- package/lib/utils/RemoteTrackResolver.d.ts.map +1 -0
- package/lib/utils/RemoteTrackResolver.js +2 -0
- package/lib/utils/onAnyClientCallUpdater.d.ts +14 -0
- package/lib/utils/onAnyClientCallUpdater.d.ts.map +1 -0
- package/lib/utils/onAnyClientCallUpdater.js +51 -0
- package/package.json +4 -4
- package/src/ObservedCall.ts +116 -166
- package/src/ObservedCertificate.ts +43 -0
- package/src/ObservedClient.ts +213 -1060
- package/src/ObservedCodec.ts +49 -0
- package/src/ObservedDataChannel.ts +68 -181
- package/src/ObservedIceCandidate.ts +64 -0
- package/src/ObservedIceCandidatePair.ts +118 -0
- package/src/ObservedIceTransport.ts +70 -0
- package/src/ObservedInboundRtp.ts +205 -0
- package/src/ObservedInboundTrack.ts +70 -0
- package/src/ObservedMediaPlayout.ts +49 -0
- package/src/ObservedMediaSource.ts +60 -0
- package/src/ObservedOutboundRtp.ts +156 -0
- package/src/ObservedOutboundTrack.ts +69 -0
- package/src/ObservedPeerConnection.ts +827 -405
- package/src/ObservedPeerConnectionTransport.ts +38 -0
- package/src/ObservedRemoteInboundRtp.ts +64 -0
- package/src/ObservedRemoteOutboundRtp.ts +65 -0
- package/src/ObservedTURN.ts +86 -0
- package/src/ObservedTurnServer.ts +72 -0
- package/src/Observer.ts +91 -302
- package/src/common/Middleware.ts +70 -42
- package/src/common/logger.ts +60 -69
- package/src/common/types.ts +0 -42
- package/src/common/utils.ts +12 -0
- package/src/detectors/Detector.ts +6 -0
- package/src/detectors/Detectors.ts +38 -0
- package/src/index.ts +24 -90
- package/src/monitors/TurnUsageMonitor.ts +164 -164
- package/src/schema/ClientEventTypes.ts +36 -0
- package/src/schema/ClientMetaTypes.ts +41 -0
- package/src/schema/ClientSample.ts +1682 -0
- package/src/scores/CalculatedScore.ts +6 -0
- package/src/scores/DefaultCallScoreCalculator.ts +23 -0
- package/src/scores/ScoreCalculator.ts +3 -0
- package/src/utils/CallUpdater.ts +5 -0
- package/src/utils/OnAllClientCallUpdater.ts +68 -0
- package/src/utils/RemoteTrackResolver.ts +12 -0
- package/src/utils/onAnyClientCallUpdater.ts +59 -0
- package/tsconfig.json +3 -3
- package/lib/ObservedICE.d.ts +0 -64
- package/lib/ObservedICE.d.ts.map +0 -1
- package/lib/ObservedICE.js +0 -141
- package/lib/ObservedInboundAudioTrack.d.ts +0 -96
- package/lib/ObservedInboundAudioTrack.d.ts.map +0 -1
- package/lib/ObservedInboundAudioTrack.js +0 -217
- package/lib/ObservedInboundVideoTrack.d.ts +0 -101
- package/lib/ObservedInboundVideoTrack.d.ts.map +0 -1
- package/lib/ObservedInboundVideoTrack.js +0 -232
- package/lib/ObservedOutboundAudioTrack.d.ts +0 -87
- package/lib/ObservedOutboundAudioTrack.d.ts.map +0 -1
- package/lib/ObservedOutboundAudioTrack.js +0 -186
- package/lib/ObservedOutboundVideoTrack.d.ts +0 -91
- package/lib/ObservedOutboundVideoTrack.d.ts.map +0 -1
- package/lib/ObservedOutboundVideoTrack.js +0 -193
- package/lib/ObservedSfu.d.ts +0 -59
- package/lib/ObservedSfu.d.ts.map +0 -1
- package/lib/ObservedSfu.js +0 -157
- package/lib/ObservedSfuInboundRtpPad.d.ts +0 -42
- package/lib/ObservedSfuInboundRtpPad.d.ts.map +0 -1
- package/lib/ObservedSfuInboundRtpPad.js +0 -71
- package/lib/ObservedSfuOutboundRtpPad.d.ts +0 -42
- package/lib/ObservedSfuOutboundRtpPad.d.ts.map +0 -1
- package/lib/ObservedSfuOutboundRtpPad.js +0 -72
- package/lib/ObservedSfuSctpChannel.d.ts +0 -42
- package/lib/ObservedSfuSctpChannel.d.ts.map +0 -1
- package/lib/ObservedSfuSctpChannel.js +0 -57
- package/lib/ObservedSfuTransport.d.ts +0 -58
- package/lib/ObservedSfuTransport.d.ts.map +0 -1
- package/lib/ObservedSfuTransport.js +0 -120
- package/lib/RemoteTrackAssigner.d.ts +0 -14
- package/lib/RemoteTrackAssigner.d.ts.map +0 -1
- package/lib/RemoteTrackAssigner.js +0 -52
- package/lib/ReportsCollector.d.ts +0 -109
- package/lib/ReportsCollector.d.ts.map +0 -1
- package/lib/ReportsCollector.js +0 -207
- package/lib/common/CalculatedScore.d.ts +0 -80
- package/lib/common/CalculatedScore.d.ts.map +0 -1
- package/lib/common/CalculatedScore.js +0 -162
- package/lib/common/CallEventType.d.ts +0 -63
- package/lib/common/CallEventType.d.ts.map +0 -1
- package/lib/common/CallEventType.js +0 -39
- package/lib/common/CallMetaReports.d.ts +0 -42
- package/lib/common/CallMetaReports.d.ts.map +0 -1
- package/lib/common/CallMetaReports.js +0 -36
- package/lib/common/QualityScoreUtils.d.ts +0 -1
- package/lib/common/QualityScoreUtils.d.ts.map +0 -1
- package/lib/common/QualityScoreUtils.js +0 -1
- package/lib/common/TypedEventEmitter.d.ts +0 -22
- package/lib/common/TypedEventEmitter.d.ts.map +0 -1
- package/lib/common/TypedEventEmitter.js +0 -11
- package/lib/common/callEventReports.d.ts +0 -10
- package/lib/common/callEventReports.d.ts.map +0 -1
- package/lib/common/callEventReports.js +0 -112
- package/lib/monitors/CallSummary.d.ts +0 -37
- package/lib/monitors/CallSummary.d.ts.map +0 -1
- package/lib/monitors/CallSummaryMonitor.d.ts +0 -32
- package/lib/monitors/CallSummaryMonitor.d.ts.map +0 -1
- package/lib/monitors/CallSummaryMonitor.js +0 -152
- package/lib/monitors/ClientIssueMonitor.d.ts +0 -32
- package/lib/monitors/ClientIssueMonitor.d.ts.map +0 -1
- package/lib/monitors/ClientIssueMonitor.js +0 -49
- package/lib/monitors/SfuServerMonitor.d.ts +0 -79
- package/lib/monitors/SfuServerMonitor.d.ts.map +0 -1
- package/lib/monitors/SfuServerMonitor.js +0 -198
- package/src/ObservedICE.ts +0 -237
- package/src/ObservedInboundAudioTrack.ts +0 -344
- package/src/ObservedInboundVideoTrack.ts +0 -361
- package/src/ObservedOutboundAudioTrack.ts +0 -307
- package/src/ObservedOutboundVideoTrack.ts +0 -319
- package/src/ObservedSfu.ts +0 -231
- package/src/ObservedSfuInboundRtpPad.ts +0 -106
- package/src/ObservedSfuOutboundRtpPad.ts +0 -107
- package/src/ObservedSfuSctpChannel.ts +0 -103
- package/src/ObservedSfuTransport.ts +0 -185
- package/src/RemoteTrackAssigner.ts +0 -68
- package/src/ReportsCollector.ts +0 -336
- package/src/common/CalculatedScore.ts +0 -188
- package/src/common/CallEventType.ts +0 -69
- package/src/common/CallMetaReports.ts +0 -82
- package/src/common/QualityScoreUtils.ts +0 -0
- package/src/common/TypedEventEmitter.ts +0 -32
- package/src/common/callEventReports.ts +0 -178
- package/src/monitors/CallSummary.ts +0 -38
- package/src/monitors/CallSummaryMonitor.ts +0 -192
- package/src/monitors/ClientIssueMonitor.ts +0 -88
- package/src/monitors/SfuServerMonitor.ts +0 -285
- /package/lib/{monitors/CallSummary.js → scores/CalculatedScore.js} +0 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ObservedPeerConnection } from './ObservedPeerConnection';
|
|
2
|
+
import { PeerConnectionTransportStats } from './schema/ClientSample';
|
|
3
|
+
export declare class ObservedPeerConnectionTransport implements PeerConnectionTransportStats {
|
|
4
|
+
timestamp: number;
|
|
5
|
+
id: string;
|
|
6
|
+
private readonly _peerConnection;
|
|
7
|
+
private _visited;
|
|
8
|
+
appData?: Record<string, unknown>;
|
|
9
|
+
dataChannelsOpened?: number | undefined;
|
|
10
|
+
dataChannelsClosed?: number | undefined;
|
|
11
|
+
attachments?: Record<string, unknown> | undefined;
|
|
12
|
+
constructor(timestamp: number, id: string, _peerConnection: ObservedPeerConnection);
|
|
13
|
+
get visited(): boolean;
|
|
14
|
+
getPeerConnection(): ObservedPeerConnection;
|
|
15
|
+
update(stats: PeerConnectionTransportStats): void;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=ObservedPeerConnectionTransport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ObservedPeerConnectionTransport.d.ts","sourceRoot":"","sources":["../src/ObservedPeerConnectionTransport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,4BAA4B,EAAE,MAAM,uBAAuB,CAAC;AAErE,qBAAa,+BAAgC,YAAW,4BAA4B;IAS3E,SAAS,EAAE,MAAM;IACjB,EAAE,EAAE,MAAM;IACjB,OAAO,CAAC,QAAQ,CAAC,eAAe;IAVjC,OAAO,CAAC,QAAQ,CAAS;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAEzC,kBAAkB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACxC,kBAAkB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACxC,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC;gBAG1C,SAAS,EAAE,MAAM,EACjB,EAAE,EAAE,MAAM,EACA,eAAe,EAAE,sBAAsB;IAGzD,IAAW,OAAO,YAMjB;IAEM,iBAAiB;IAIjB,MAAM,CAAC,KAAK,EAAE,4BAA4B;CAQjD"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ObservedPeerConnectionTransport = void 0;
|
|
4
|
+
class ObservedPeerConnectionTransport {
|
|
5
|
+
timestamp;
|
|
6
|
+
id;
|
|
7
|
+
_peerConnection;
|
|
8
|
+
_visited = false;
|
|
9
|
+
appData;
|
|
10
|
+
dataChannelsOpened;
|
|
11
|
+
dataChannelsClosed;
|
|
12
|
+
attachments;
|
|
13
|
+
constructor(timestamp, id, _peerConnection) {
|
|
14
|
+
this.timestamp = timestamp;
|
|
15
|
+
this.id = id;
|
|
16
|
+
this._peerConnection = _peerConnection;
|
|
17
|
+
}
|
|
18
|
+
get visited() {
|
|
19
|
+
const visited = this._visited;
|
|
20
|
+
this._visited = false;
|
|
21
|
+
return visited;
|
|
22
|
+
}
|
|
23
|
+
getPeerConnection() {
|
|
24
|
+
return this._peerConnection;
|
|
25
|
+
}
|
|
26
|
+
update(stats) {
|
|
27
|
+
this._visited = true;
|
|
28
|
+
this.timestamp = stats.timestamp;
|
|
29
|
+
this.dataChannelsOpened = stats.dataChannelsOpened;
|
|
30
|
+
this.dataChannelsClosed = stats.dataChannelsClosed;
|
|
31
|
+
this.attachments = stats.attachments;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.ObservedPeerConnectionTransport = ObservedPeerConnectionTransport;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { MediaKind } from './common/types';
|
|
2
|
+
import { ObservedPeerConnection } from './ObservedPeerConnection';
|
|
3
|
+
import { RemoteInboundRtpStats } from './schema/ClientSample';
|
|
4
|
+
export declare class ObservedRemoteInboundRtp implements RemoteInboundRtpStats {
|
|
5
|
+
timestamp: number;
|
|
6
|
+
id: string;
|
|
7
|
+
ssrc: number;
|
|
8
|
+
kind: MediaKind;
|
|
9
|
+
private readonly _peerConnection;
|
|
10
|
+
private _visited;
|
|
11
|
+
appData?: Record<string, unknown>;
|
|
12
|
+
transportId?: string | undefined;
|
|
13
|
+
codecId?: string | undefined;
|
|
14
|
+
packetsReceived?: number | undefined;
|
|
15
|
+
packetsLost?: number | undefined;
|
|
16
|
+
jitter?: number | undefined;
|
|
17
|
+
localId?: string | undefined;
|
|
18
|
+
roundTripTime?: number | undefined;
|
|
19
|
+
totalRoundTripTime?: number | undefined;
|
|
20
|
+
fractionLost?: number | undefined;
|
|
21
|
+
roundTripTimeMeasurements?: number | undefined;
|
|
22
|
+
attachments?: Record<string, unknown> | undefined;
|
|
23
|
+
constructor(timestamp: number, id: string, ssrc: number, kind: MediaKind, _peerConnection: ObservedPeerConnection);
|
|
24
|
+
get visited(): boolean;
|
|
25
|
+
getPeerConnection(): ObservedPeerConnection;
|
|
26
|
+
getOutboundRtp(): import("./ObservedOutboundRtp").ObservedOutboundRtp | undefined;
|
|
27
|
+
getCodec(): import("./ObservedCodec").ObservedCodec | undefined;
|
|
28
|
+
update(stats: RemoteInboundRtpStats): void;
|
|
29
|
+
}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V,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,SAAS,EACL,eAAe,EAAE,sBAAsB;IAGzD,IAAW,OAAO,YAMjB;IAEM,iBAAiB;IAIjB,cAAc;IAId,QAAQ;IAIR,MAAM,CAAC,KAAK,EAAE,qBAAqB;CAgB1C"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ObservedRemoteInboundRtp = void 0;
|
|
4
|
+
class ObservedRemoteInboundRtp {
|
|
5
|
+
timestamp;
|
|
6
|
+
id;
|
|
7
|
+
ssrc;
|
|
8
|
+
kind;
|
|
9
|
+
_peerConnection;
|
|
10
|
+
_visited = false;
|
|
11
|
+
appData;
|
|
12
|
+
transportId;
|
|
13
|
+
codecId;
|
|
14
|
+
packetsReceived;
|
|
15
|
+
packetsLost;
|
|
16
|
+
jitter;
|
|
17
|
+
localId;
|
|
18
|
+
roundTripTime;
|
|
19
|
+
totalRoundTripTime;
|
|
20
|
+
fractionLost;
|
|
21
|
+
roundTripTimeMeasurements;
|
|
22
|
+
attachments;
|
|
23
|
+
constructor(timestamp, id, ssrc, kind, _peerConnection) {
|
|
24
|
+
this.timestamp = timestamp;
|
|
25
|
+
this.id = id;
|
|
26
|
+
this.ssrc = ssrc;
|
|
27
|
+
this.kind = kind;
|
|
28
|
+
this._peerConnection = _peerConnection;
|
|
29
|
+
}
|
|
30
|
+
get visited() {
|
|
31
|
+
const visited = this._visited;
|
|
32
|
+
this._visited = false;
|
|
33
|
+
return visited;
|
|
34
|
+
}
|
|
35
|
+
getPeerConnection() {
|
|
36
|
+
return this._peerConnection;
|
|
37
|
+
}
|
|
38
|
+
getOutboundRtp() {
|
|
39
|
+
return this._peerConnection.observedOutboundRtps.get(this.ssrc);
|
|
40
|
+
}
|
|
41
|
+
getCodec() {
|
|
42
|
+
return this._peerConnection.observedCodecs.get(this.codecId ?? '');
|
|
43
|
+
}
|
|
44
|
+
update(stats) {
|
|
45
|
+
this._visited = true;
|
|
46
|
+
this.timestamp = stats.timestamp;
|
|
47
|
+
this.transportId = stats.transportId;
|
|
48
|
+
this.codecId = stats.codecId;
|
|
49
|
+
this.packetsReceived = stats.packetsReceived;
|
|
50
|
+
this.packetsLost = stats.packetsLost;
|
|
51
|
+
this.jitter = stats.jitter;
|
|
52
|
+
this.localId = stats.localId;
|
|
53
|
+
this.roundTripTime = stats.roundTripTime;
|
|
54
|
+
this.totalRoundTripTime = stats.totalRoundTripTime;
|
|
55
|
+
this.fractionLost = stats.fractionLost;
|
|
56
|
+
this.roundTripTimeMeasurements = stats.roundTripTimeMeasurements;
|
|
57
|
+
this.attachments = stats.attachments;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
exports.ObservedRemoteInboundRtp = ObservedRemoteInboundRtp;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { MediaKind } from './common/types';
|
|
2
|
+
import { ObservedPeerConnection } from './ObservedPeerConnection';
|
|
3
|
+
import { RemoteOutboundRtpStats } from './schema/ClientSample';
|
|
4
|
+
export declare class ObservedRemoteOutboundRtp implements RemoteOutboundRtpStats {
|
|
5
|
+
timestamp: number;
|
|
6
|
+
id: string;
|
|
7
|
+
ssrc: number;
|
|
8
|
+
kind: MediaKind;
|
|
9
|
+
private readonly _peerConnection;
|
|
10
|
+
private _visited;
|
|
11
|
+
appData?: Record<string, unknown>;
|
|
12
|
+
transportId?: string | undefined;
|
|
13
|
+
codecId?: string | undefined;
|
|
14
|
+
packetsSent?: number | undefined;
|
|
15
|
+
bytesSent?: number | undefined;
|
|
16
|
+
localId?: string | undefined;
|
|
17
|
+
remoteTimestamp?: number | undefined;
|
|
18
|
+
reportsSent?: number | undefined;
|
|
19
|
+
roundTripTime?: number | undefined;
|
|
20
|
+
totalRoundTripTime?: number | undefined;
|
|
21
|
+
roundTripTimeMeasurements?: number | undefined;
|
|
22
|
+
attachments?: Record<string, unknown> | undefined;
|
|
23
|
+
constructor(timestamp: number, id: string, ssrc: number, kind: MediaKind, _peerConnection: ObservedPeerConnection);
|
|
24
|
+
get visited(): boolean;
|
|
25
|
+
getPeerConnection(): ObservedPeerConnection;
|
|
26
|
+
getInboundRtp(): import("./ObservedInboundRtp").ObservedInboundRtp | undefined;
|
|
27
|
+
getCodec(): import("./ObservedCodec").ObservedCodec | undefined;
|
|
28
|
+
update(stats: RemoteOutboundRtpStats): void;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=ObservedRemoteOutboundRtp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ObservedRemoteOutboundRtp.d.ts","sourceRoot":"","sources":["../src/ObservedRemoteOutboundRtp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAE/D,qBAAa,yBAA0B,YAAW,sBAAsB;IAiB/D,SAAS,EAAE,MAAM;IACjB,EAAE,EAAE,MAAM;IACV,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,SAAS;IACtB,OAAO,CAAC,QAAQ,CAAC,eAAe;IApBjC,OAAO,CAAC,QAAQ,CAAS;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAEzC,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,eAAe,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,aAAa,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,kBAAkB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACxC,yBAAyB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/C,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC;gBAG1C,SAAS,EAAE,MAAM,EACjB,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,SAAS,EACL,eAAe,EAAE,sBAAsB;IAGzD,IAAW,OAAO,YAMjB;IAEM,iBAAiB;IAIjB,aAAa;IAIb,QAAQ;IAIR,MAAM,CAAC,KAAK,EAAE,sBAAsB;CAgB3C"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ObservedRemoteOutboundRtp = void 0;
|
|
4
|
+
class ObservedRemoteOutboundRtp {
|
|
5
|
+
timestamp;
|
|
6
|
+
id;
|
|
7
|
+
ssrc;
|
|
8
|
+
kind;
|
|
9
|
+
_peerConnection;
|
|
10
|
+
_visited = false;
|
|
11
|
+
appData;
|
|
12
|
+
transportId;
|
|
13
|
+
codecId;
|
|
14
|
+
packetsSent;
|
|
15
|
+
bytesSent;
|
|
16
|
+
localId;
|
|
17
|
+
remoteTimestamp;
|
|
18
|
+
reportsSent;
|
|
19
|
+
roundTripTime;
|
|
20
|
+
totalRoundTripTime;
|
|
21
|
+
roundTripTimeMeasurements;
|
|
22
|
+
attachments;
|
|
23
|
+
constructor(timestamp, id, ssrc, kind, _peerConnection) {
|
|
24
|
+
this.timestamp = timestamp;
|
|
25
|
+
this.id = id;
|
|
26
|
+
this.ssrc = ssrc;
|
|
27
|
+
this.kind = kind;
|
|
28
|
+
this._peerConnection = _peerConnection;
|
|
29
|
+
}
|
|
30
|
+
get visited() {
|
|
31
|
+
const visited = this._visited;
|
|
32
|
+
this._visited = false;
|
|
33
|
+
return visited;
|
|
34
|
+
}
|
|
35
|
+
getPeerConnection() {
|
|
36
|
+
return this._peerConnection;
|
|
37
|
+
}
|
|
38
|
+
getInboundRtp() {
|
|
39
|
+
return this._peerConnection.observedInboundRtps.get(this.ssrc);
|
|
40
|
+
}
|
|
41
|
+
getCodec() {
|
|
42
|
+
return this._peerConnection.observedCodecs.get(this.codecId ?? '');
|
|
43
|
+
}
|
|
44
|
+
update(stats) {
|
|
45
|
+
this._visited = true;
|
|
46
|
+
this.timestamp = stats.timestamp;
|
|
47
|
+
this.transportId = stats.transportId;
|
|
48
|
+
this.codecId = stats.codecId;
|
|
49
|
+
this.packetsSent = stats.packetsSent;
|
|
50
|
+
this.bytesSent = stats.bytesSent;
|
|
51
|
+
this.localId = stats.localId;
|
|
52
|
+
this.remoteTimestamp = stats.remoteTimestamp;
|
|
53
|
+
this.reportsSent = stats.reportsSent;
|
|
54
|
+
this.roundTripTime = stats.roundTripTime;
|
|
55
|
+
this.totalRoundTripTime = stats.totalRoundTripTime;
|
|
56
|
+
this.roundTripTimeMeasurements = stats.roundTripTimeMeasurements;
|
|
57
|
+
this.attachments = stats.attachments;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
exports.ObservedRemoteOutboundRtp = ObservedRemoteOutboundRtp;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { EventEmitter } from 'stream';
|
|
3
|
+
import { ObservedPeerConnection } from './ObservedPeerConnection';
|
|
4
|
+
import { ObservedTurnServer } from './ObservedTurnServer';
|
|
5
|
+
export type ObservedTURNEventMap = {
|
|
6
|
+
'update': [ObservedTURN];
|
|
7
|
+
'close': [];
|
|
8
|
+
};
|
|
9
|
+
export declare interface ObservedTURN {
|
|
10
|
+
on<U extends keyof ObservedTURNEventMap>(event: U, listener: (...args: ObservedTURNEventMap[U]) => void): this;
|
|
11
|
+
off<U extends keyof ObservedTURNEventMap>(event: U, listener: (...args: ObservedTURNEventMap[U]) => void): this;
|
|
12
|
+
once<U extends keyof ObservedTURNEventMap>(event: U, listener: (...args: ObservedTURNEventMap[U]) => void): this;
|
|
13
|
+
emit<U extends keyof ObservedTURNEventMap>(event: U, ...args: ObservedTURNEventMap[U]): boolean;
|
|
14
|
+
}
|
|
15
|
+
export declare class ObservedTURN extends EventEmitter {
|
|
16
|
+
totalBytesSent: number;
|
|
17
|
+
totalBytesReceived: number;
|
|
18
|
+
totalPacketsSent: number;
|
|
19
|
+
totalPacketsReceived: number;
|
|
20
|
+
packetsSentPerSecond: number;
|
|
21
|
+
packetsReceivedPerSecond: number;
|
|
22
|
+
outboundBitrate: number;
|
|
23
|
+
inboundBitrate: number;
|
|
24
|
+
numberOfClients: number;
|
|
25
|
+
readonly servers: Map<string, ObservedTurnServer>;
|
|
26
|
+
constructor();
|
|
27
|
+
update(): void;
|
|
28
|
+
addPeerConnection(peerConnection: ObservedPeerConnection): ObservedTurnServer | undefined;
|
|
29
|
+
removePeerConnection(peerConnection: ObservedPeerConnection): void;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=ObservedTURN.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ObservedTURN.d.ts","sourceRoot":"","sources":["../src/ObservedTURN.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAK1D,MAAM,MAAM,oBAAoB,GAAG;IAClC,QAAQ,EAAE,CAAC,YAAY,CAAC,CAAC;IACzB,OAAO,EAAE,EAAE,CAAC;CACZ,CAAA;AAED,MAAM,CAAC,OAAO,WAAW,YAAY;IACpC,EAAE,CAAC,CAAC,SAAS,MAAM,oBAAoB,EAAE,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,GAAG,IAAI,EAAE,oBAAoB,CAAC,CAAC,CAAC,KAAK,IAAI,GAAG,IAAI,CAAC;IAC/G,GAAG,CAAC,CAAC,SAAS,MAAM,oBAAoB,EAAE,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,GAAG,IAAI,EAAE,oBAAoB,CAAC,CAAC,CAAC,KAAK,IAAI,GAAG,IAAI,CAAC;IAChH,IAAI,CAAC,CAAC,SAAS,MAAM,oBAAoB,EAAE,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,GAAG,IAAI,EAAE,oBAAoB,CAAC,CAAC,CAAC,KAAK,IAAI,GAAG,IAAI,CAAC;IACjH,IAAI,CAAC,CAAC,SAAS,MAAM,oBAAoB,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,IAAI,EAAE,oBAAoB,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC;CAChG;AAED,qBAAa,YAAa,SAAQ,YAAY;IACtC,cAAc,SAAK;IACnB,kBAAkB,SAAK;IACvB,gBAAgB,SAAK;IACrB,oBAAoB,SAAK;IAEzB,oBAAoB,SAAK;IACzB,wBAAwB,SAAK;IAC7B,eAAe,SAAK;IACpB,cAAc,SAAK;IACnB,eAAe,SAAK;IAE3B,SAAgB,OAAO,kCAAyC;;IAOzD,MAAM;IAgBN,iBAAiB,CAAC,cAAc,EAAE,sBAAsB;IAyBxD,oBAAoB,CAAC,cAAc,EAAE,sBAAsB;CAMlE"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ObservedTURN = void 0;
|
|
4
|
+
const stream_1 = require("stream");
|
|
5
|
+
const ObservedTurnServer_1 = require("./ObservedTurnServer");
|
|
6
|
+
const logger_1 = require("./common/logger");
|
|
7
|
+
const logger = (0, logger_1.createLogger)('ObservedTURN');
|
|
8
|
+
class ObservedTURN extends stream_1.EventEmitter {
|
|
9
|
+
totalBytesSent = 0;
|
|
10
|
+
totalBytesReceived = 0;
|
|
11
|
+
totalPacketsSent = 0;
|
|
12
|
+
totalPacketsReceived = 0;
|
|
13
|
+
packetsSentPerSecond = 0;
|
|
14
|
+
packetsReceivedPerSecond = 0;
|
|
15
|
+
outboundBitrate = 0;
|
|
16
|
+
inboundBitrate = 0;
|
|
17
|
+
numberOfClients = 0;
|
|
18
|
+
servers = new Map();
|
|
19
|
+
constructor() {
|
|
20
|
+
super();
|
|
21
|
+
}
|
|
22
|
+
update() {
|
|
23
|
+
const clientIds = new Set();
|
|
24
|
+
this.packetsReceivedPerSecond = 0;
|
|
25
|
+
this.packetsSentPerSecond = 0;
|
|
26
|
+
this.outboundBitrate = 0;
|
|
27
|
+
this.inboundBitrate = 0;
|
|
28
|
+
for (const server of this.servers.values()) {
|
|
29
|
+
server.update();
|
|
30
|
+
server.observedPeerConnections.forEach((pc) => clientIds.add(pc.client.clientId));
|
|
31
|
+
}
|
|
32
|
+
this.numberOfClients = clientIds.size;
|
|
33
|
+
}
|
|
34
|
+
addPeerConnection(peerConnection) {
|
|
35
|
+
const turnPairs = peerConnection.selectedIceCandidatePairs.filter((pair) => pair.getLocalCandidate()?.candidateType === 'relay' && pair.getRemoteCandidate()?.url?.startsWith('turn:'));
|
|
36
|
+
if (turnPairs.length !== 1) {
|
|
37
|
+
return (logger.warn(`Expected exactly one TURN pair, but found for peerconnection ${peerConnection.peerConnectionId}`, turnPairs.length), undefined);
|
|
38
|
+
}
|
|
39
|
+
const candidatePair = turnPairs[0];
|
|
40
|
+
const rawUrl = candidatePair.getRemoteCandidate()?.url;
|
|
41
|
+
if (!rawUrl) {
|
|
42
|
+
return (logger.warn(`No remote candidate URL found for peerconnection ${peerConnection.peerConnectionId}`), undefined);
|
|
43
|
+
}
|
|
44
|
+
const turnUrl = new URL(rawUrl);
|
|
45
|
+
const turnServerUrl = `${turnUrl.protocol}//${turnUrl.hostname}:${turnUrl.port}`;
|
|
46
|
+
let turnServer = this.servers.get(turnServerUrl);
|
|
47
|
+
if (!turnServer) {
|
|
48
|
+
turnServer = new ObservedTurnServer_1.ObservedTurnServer(turnServerUrl, this);
|
|
49
|
+
}
|
|
50
|
+
return turnServer;
|
|
51
|
+
}
|
|
52
|
+
removePeerConnection(peerConnection) {
|
|
53
|
+
for (const turnServer of this.servers.values()) {
|
|
54
|
+
turnServer.observedPeerConnections.delete(peerConnection.peerConnectionId);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
exports.ObservedTURN = ObservedTURN;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ObservedIceCandidatePair } from './ObservedIceCandidatePair';
|
|
2
|
+
import { ObservedPeerConnection } from './ObservedPeerConnection';
|
|
3
|
+
import { ObservedTURN } from './ObservedTURN';
|
|
4
|
+
export declare class ObservedTurnServer {
|
|
5
|
+
readonly url: string;
|
|
6
|
+
readonly observedTURN: ObservedTURN;
|
|
7
|
+
totalBytesSent: number;
|
|
8
|
+
totalBytesReceived: number;
|
|
9
|
+
totalPacketsSent: number;
|
|
10
|
+
totalPacketsReceived: number;
|
|
11
|
+
packetsSentPerSecond: number;
|
|
12
|
+
packetsReceivedPerSecond: number;
|
|
13
|
+
outboundBitrate: number;
|
|
14
|
+
inboundBitrate: number;
|
|
15
|
+
deltaBytesSent: number;
|
|
16
|
+
deltaBytesReceived: number;
|
|
17
|
+
deltaPacketsSent: number;
|
|
18
|
+
deltaPacketsReceived: number;
|
|
19
|
+
readonly observedPeerConnections: Map<string, ObservedPeerConnection>;
|
|
20
|
+
updated: number;
|
|
21
|
+
constructor(url: string, observedTURN: ObservedTURN);
|
|
22
|
+
updateTurnUsage(...selectedcandidatepairs: ObservedIceCandidatePair[]): void;
|
|
23
|
+
update(): void;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=ObservedTurnServer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ObservedTurnServer.d.ts","sourceRoot":"","sources":["../src/ObservedTurnServer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,qBAAa,kBAAkB;aAqBb,GAAG,EAAE,MAAM;aACX,YAAY,EAAE,YAAY;IArBpC,cAAc,SAAK;IACnB,kBAAkB,SAAK;IACvB,gBAAgB,SAAK;IACrB,oBAAoB,SAAK;IAEzB,oBAAoB,SAAK;IACzB,wBAAwB,SAAK;IAC7B,eAAe,SAAK;IACpB,cAAc,SAAK;IAEnB,cAAc,SAAK;IACnB,kBAAkB,SAAK;IACvB,gBAAgB,SAAK;IACrB,oBAAoB,SAAK;IAEhC,SAAgB,uBAAuB,sCAA6C;IAE7E,OAAO,SAAc;gBAGX,GAAG,EAAE,MAAM,EACX,YAAY,EAAE,YAAY;IAKpC,eAAe,CAAC,GAAG,sBAAsB,EAAE,wBAAwB,EAAE;IASrE,MAAM;CA+Bb"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ObservedTurnServer = void 0;
|
|
4
|
+
class ObservedTurnServer {
|
|
5
|
+
url;
|
|
6
|
+
observedTURN;
|
|
7
|
+
totalBytesSent = 0;
|
|
8
|
+
totalBytesReceived = 0;
|
|
9
|
+
totalPacketsSent = 0;
|
|
10
|
+
totalPacketsReceived = 0;
|
|
11
|
+
packetsSentPerSecond = 0;
|
|
12
|
+
packetsReceivedPerSecond = 0;
|
|
13
|
+
outboundBitrate = 0;
|
|
14
|
+
inboundBitrate = 0;
|
|
15
|
+
deltaBytesSent = 0;
|
|
16
|
+
deltaBytesReceived = 0;
|
|
17
|
+
deltaPacketsSent = 0;
|
|
18
|
+
deltaPacketsReceived = 0;
|
|
19
|
+
observedPeerConnections = new Map();
|
|
20
|
+
updated = Date.now();
|
|
21
|
+
constructor(url, observedTURN) {
|
|
22
|
+
this.url = url;
|
|
23
|
+
this.observedTURN = observedTURN;
|
|
24
|
+
}
|
|
25
|
+
updateTurnUsage(...selectedcandidatepairs) {
|
|
26
|
+
for (const selectedcandidatepair of selectedcandidatepairs) {
|
|
27
|
+
this.deltaBytesReceived += selectedcandidatepair.deltaBytesReceived;
|
|
28
|
+
this.deltaBytesSent += selectedcandidatepair.deltaBytesSent;
|
|
29
|
+
this.deltaPacketsReceived += selectedcandidatepair.deltaPacketsReceived;
|
|
30
|
+
this.deltaPacketsSent += selectedcandidatepair.deltaPacketsSent;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
update() {
|
|
34
|
+
const now = Date.now();
|
|
35
|
+
const deltaInS = (now - this.updated) / 1000;
|
|
36
|
+
this.packetsSentPerSecond = this.deltaPacketsSent / deltaInS;
|
|
37
|
+
this.packetsReceivedPerSecond = this.deltaPacketsReceived / deltaInS;
|
|
38
|
+
this.outboundBitrate = (this.deltaBytesReceived * 8) / deltaInS;
|
|
39
|
+
this.inboundBitrate = (this.deltaBytesSent * 8) / deltaInS;
|
|
40
|
+
this.totalBytesSent += this.deltaBytesSent;
|
|
41
|
+
this.totalBytesReceived += this.deltaBytesReceived;
|
|
42
|
+
this.totalPacketsSent += this.deltaPacketsSent;
|
|
43
|
+
this.totalPacketsReceived += this.deltaPacketsReceived;
|
|
44
|
+
this.observedTURN.totalBytesSent += this.deltaBytesSent;
|
|
45
|
+
this.observedTURN.totalBytesReceived += this.deltaBytesReceived;
|
|
46
|
+
this.observedTURN.totalPacketsSent += this.deltaPacketsSent;
|
|
47
|
+
this.observedTURN.totalPacketsReceived += this.deltaPacketsReceived;
|
|
48
|
+
this.observedTURN.inboundBitrate += this.inboundBitrate;
|
|
49
|
+
this.observedTURN.outboundBitrate += this.outboundBitrate;
|
|
50
|
+
this.observedTURN.packetsReceivedPerSecond += this.packetsReceivedPerSecond;
|
|
51
|
+
this.observedTURN.packetsSentPerSecond += this.packetsSentPerSecond;
|
|
52
|
+
this.deltaBytesSent = 0;
|
|
53
|
+
this.deltaBytesReceived = 0;
|
|
54
|
+
this.deltaPacketsSent = 0;
|
|
55
|
+
this.deltaPacketsReceived = 0;
|
|
56
|
+
this.updated = now;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
exports.ObservedTurnServer = ObservedTurnServer;
|
package/lib/Observer.d.ts
CHANGED
|
@@ -1,37 +1,20 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import { ObservedCall,
|
|
3
|
-
import { ReportsCollector } from './ReportsCollector';
|
|
2
|
+
import { ObservedCall, ObservedCallSettings } from './ObservedCall';
|
|
4
3
|
import { EventEmitter } from 'events';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { CallSummaryMonitor, CallSummaryMonitorConfig } from './monitors/CallSummaryMonitor';
|
|
9
|
-
import { TurnUsageMonitor } from './monitors/TurnUsageMonitor';
|
|
10
|
-
import { ClientIssueMonitor } from './monitors/ClientIssueMonitor';
|
|
11
|
-
import { SfuServerMonitor } from './monitors/SfuServerMonitor';
|
|
4
|
+
import { ClientEvent, ClientMetaData, ClientIssue, ExtensionStat, ClientSample } from './schema/ClientSample';
|
|
5
|
+
import { ObservedClient } from './ObservedClient';
|
|
6
|
+
import { ObservedTURN } from './ObservedTURN';
|
|
12
7
|
export type ObserverEvents = {
|
|
8
|
+
'client-event': [ObservedClient, ClientEvent];
|
|
9
|
+
'call-updated': [ObservedCall];
|
|
10
|
+
'client-issue': [ObservedClient, ClientIssue];
|
|
11
|
+
'client-metadata': [ObservedClient, ClientMetaData];
|
|
12
|
+
'client-extension-stats': [ObservedClient, ExtensionStat];
|
|
13
13
|
'newcall': [ObservedCall];
|
|
14
|
-
'newsfu': [ObservedSfu];
|
|
15
|
-
'reports': [ObserverSinkContext];
|
|
16
14
|
'close': [];
|
|
17
15
|
};
|
|
18
16
|
export type ObserverConfig = {
|
|
19
|
-
|
|
20
|
-
*
|
|
21
|
-
* Sets the default serviceId for samples.
|
|
22
|
-
*
|
|
23
|
-
* For more information about a serviceId please visit https://observertc.org
|
|
24
|
-
*
|
|
25
|
-
*/
|
|
26
|
-
defaultServiceId: string;
|
|
27
|
-
/**
|
|
28
|
-
* Sets the default mediaUnitId for samples.
|
|
29
|
-
*
|
|
30
|
-
* For more information about a mediaUnitId please visit https://observertc.org
|
|
31
|
-
*/
|
|
32
|
-
defaultMediaUnitId: string;
|
|
33
|
-
maxReports?: number | undefined;
|
|
34
|
-
maxCollectingTimeInMs?: number | undefined;
|
|
17
|
+
updateIntervalInMs?: number;
|
|
35
18
|
};
|
|
36
19
|
export declare interface Observer {
|
|
37
20
|
on<U extends keyof ObserverEvents>(event: U, listener: (...args: ObserverEvents[U]) => void): this;
|
|
@@ -39,32 +22,29 @@ export declare interface Observer {
|
|
|
39
22
|
once<U extends keyof ObserverEvents>(event: U, listener: (...args: ObserverEvents[U]) => void): this;
|
|
40
23
|
emit<U extends keyof ObserverEvents>(event: U, ...args: ObserverEvents[U]): boolean;
|
|
41
24
|
}
|
|
25
|
+
export type ObserverSummary = {
|
|
26
|
+
rttlt50: number;
|
|
27
|
+
};
|
|
42
28
|
export declare class Observer extends EventEmitter {
|
|
29
|
+
readonly observedTURN: ObservedTURN;
|
|
30
|
+
readonly observedCalls: Map<string, ObservedCall<Record<string, unknown>>>;
|
|
43
31
|
readonly config: ObserverConfig;
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
reportCallEnded?: boolean;
|
|
56
|
-
}): ObservedCall<T>;
|
|
57
|
-
createObservedSfu<AppData extends Record<string, unknown> = Record<string, unknown>>(model: ObservedSfuModel, appData: AppData): ObservedSfu<AppData>;
|
|
58
|
-
createCallSummaryMonitor(options?: CallSummaryMonitorConfig & {
|
|
59
|
-
timeoutAfterCallClose?: number;
|
|
60
|
-
}): CallSummaryMonitor;
|
|
61
|
-
createTurnUsageMonitor(): TurnUsageMonitor;
|
|
62
|
-
createSfuServerMonitor(): SfuServerMonitor;
|
|
63
|
-
createClientIssueMonitor(): ClientIssueMonitor;
|
|
64
|
-
get observedCalls(): ReadonlyMap<string, ObservedCall>;
|
|
65
|
-
get observedSfus(): ReadonlyMap<string, ObservedSfu>;
|
|
66
|
-
get closed(): boolean;
|
|
32
|
+
closed: boolean;
|
|
33
|
+
numberOfClients: number;
|
|
34
|
+
numberOfInboundRtpStreams: number;
|
|
35
|
+
numberOfOutboundRtpStreams: number;
|
|
36
|
+
numberOfDataChannels: number;
|
|
37
|
+
numberOfPeerConnections: number;
|
|
38
|
+
get numberOfCalls(): number;
|
|
39
|
+
private _timer?;
|
|
40
|
+
constructor(config?: ObserverConfig);
|
|
41
|
+
getObservedCall<T extends Record<string, unknown> = Record<string, unknown>>(callId: string): ObservedCall<T> | undefined;
|
|
42
|
+
createObservedCall<T extends Record<string, unknown> = Record<string, unknown>>(settings: ObservedCallSettings<T>): ObservedCall<T>;
|
|
67
43
|
close(): void;
|
|
68
|
-
|
|
44
|
+
accept(sample: ClientSample & {
|
|
45
|
+
callId: string;
|
|
46
|
+
clientId: string;
|
|
47
|
+
}): void;
|
|
48
|
+
update(): void;
|
|
69
49
|
}
|
|
70
50
|
//# sourceMappingURL=Observer.d.ts.map
|
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,
|
|
1
|
+
{"version":3,"file":"Observer.d.ts","sourceRoot":"","sources":["../src/Observer.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ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