@observertc/observer-js 0.42.9 → 1.0.0-beta.2
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 +493 -63
- package/lib/ObservedCall.d.ts +64 -43
- package/lib/ObservedCall.d.ts.map +1 -1
- package/lib/ObservedCall.js +193 -107
- package/lib/ObservedCallEventMonitor.d.ts +104 -0
- package/lib/ObservedCallEventMonitor.d.ts.map +1 -0
- package/lib/ObservedCallEventMonitor.js +314 -0
- package/lib/ObservedCallSummary.d.ts +18 -0
- package/lib/ObservedCallSummary.d.ts.map +1 -0
- 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 +84 -136
- package/lib/ObservedClient.d.ts.map +1 -1
- package/lib/ObservedClient.js +594 -743
- package/lib/ObservedClientEventMonitor.d.ts +91 -0
- package/lib/ObservedClientEventMonitor.d.ts.map +1 -0
- package/lib/ObservedClientEventMonitor.js +254 -0
- package/lib/ObservedClientSummary.d.ts +23 -0
- package/lib/ObservedClientSummary.d.ts.map +1 -0
- package/lib/ObservedClientSummary.js +2 -0
- 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 +25 -69
- package/lib/ObservedDataChannel.d.ts.map +1 -1
- package/lib/ObservedDataChannel.js +69 -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 +45 -0
- package/lib/ObservedIceCandidatePair.d.ts.map +1 -0
- package/lib/ObservedIceCandidatePair.js +127 -0
- package/lib/ObservedIceTransport.d.ts +36 -0
- package/lib/ObservedIceTransport.d.ts.map +1 -0
- package/lib/ObservedIceTransport.js +93 -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 +32 -0
- package/lib/ObservedInboundTrack.d.ts.map +1 -0
- package/lib/ObservedInboundTrack.js +60 -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 +32 -0
- package/lib/ObservedOutboundTrack.d.ts.map +1 -0
- package/lib/ObservedOutboundTrack.js +60 -0
- package/lib/ObservedPeerConnection.d.ts +154 -80
- package/lib/ObservedPeerConnection.d.ts.map +1 -1
- package/lib/ObservedPeerConnection.js +709 -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 +49 -54
- package/lib/Observer.d.ts.map +1 -1
- package/lib/Observer.js +137 -226
- package/lib/ObserverEventMonitor.d.ts +138 -0
- package/lib/ObserverEventMonitor.d.ts.map +1 -0
- package/lib/ObserverEventMonitor.js +433 -0
- package/lib/ObserverSummary.d.ts +13 -0
- package/lib/ObserverSummary.d.ts.map +1 -0
- package/lib/ObserverSummary.js +2 -0
- 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 +3 -1
- package/lib/common/utils.d.ts.map +1 -1
- package/lib/common/utils.js +23 -3
- 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 +26 -25
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +45 -41
- package/lib/mediasoup/ObservedMediaRouter.d.ts +10 -0
- package/lib/mediasoup/ObservedMediaRouter.d.ts.map +1 -0
- package/lib/mediasoup/ObservedMediaRouter.js +6 -0
- 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 +228 -0
- package/lib/schema/ClientEventTypes.d.ts.map +1 -0
- package/lib/schema/ClientEventTypes.js +41 -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/CalculatedScore.js +2 -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/updaters/CallUpdater.d.ts +5 -0
- package/lib/updaters/CallUpdater.d.ts.map +1 -0
- package/lib/updaters/CallUpdater.js +2 -0
- package/lib/updaters/ObserverUpdater.d.ts +5 -0
- package/lib/updaters/ObserverUpdater.d.ts.map +1 -0
- package/lib/updaters/ObserverUpdater.js +2 -0
- package/lib/updaters/OnAllCallObserverUpdater.d.ts +15 -0
- package/lib/updaters/OnAllCallObserverUpdater.d.ts.map +1 -0
- package/lib/updaters/OnAllCallObserverUpdater.js +50 -0
- package/lib/updaters/OnAllClientCallUpdater.d.ts +15 -0
- package/lib/updaters/OnAllClientCallUpdater.d.ts.map +1 -0
- package/lib/updaters/OnAllClientCallUpdater.js +53 -0
- package/lib/updaters/OnAnyCallObserverUpdater.d.ts +12 -0
- package/lib/updaters/OnAnyCallObserverUpdater.d.ts.map +1 -0
- package/lib/updaters/OnAnyCallObserverUpdater.js +37 -0
- package/lib/updaters/OnAnyClientCallUpdater.d.ts +12 -0
- package/lib/updaters/OnAnyClientCallUpdater.d.ts.map +1 -0
- package/lib/updaters/OnAnyClientCallUpdater.js +36 -0
- package/lib/updaters/OnIntervalUpdater.d.ts +10 -0
- package/lib/updaters/OnIntervalUpdater.d.ts.map +1 -0
- package/lib/updaters/OnIntervalUpdater.js +17 -0
- package/lib/updaters/Updater.d.ts +6 -0
- package/lib/updaters/Updater.d.ts.map +1 -0
- package/lib/updaters/Updater.js +2 -0
- package/lib/utils/MediasoupRemoteTrackResolver.d.ts +25 -0
- package/lib/utils/MediasoupRemoteTrackResolver.d.ts.map +1 -0
- package/lib/utils/MediasoupRemoteTrackResolver.js +110 -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/package.json +4 -4
- package/src/ObservedCall.ts +281 -165
- package/src/ObservedCallEventMonitor.ts +392 -0
- package/src/ObservedCallSummary.ts +22 -0
- package/src/ObservedCertificate.ts +43 -0
- package/src/ObservedClient.ts +640 -1004
- package/src/ObservedClientEventMonitor.ts +309 -0
- package/src/ObservedClientSummary.ts +24 -0
- package/src/ObservedCodec.ts +49 -0
- package/src/ObservedDataChannel.ts +71 -181
- package/src/ObservedIceCandidate.ts +64 -0
- package/src/ObservedIceCandidatePair.ts +134 -0
- package/src/ObservedIceTransport.ts +99 -0
- package/src/ObservedInboundRtp.ts +205 -0
- package/src/ObservedInboundTrack.ts +75 -0
- package/src/ObservedMediaPlayout.ts +49 -0
- package/src/ObservedMediaSource.ts +60 -0
- package/src/ObservedOutboundRtp.ts +156 -0
- package/src/ObservedOutboundTrack.ts +74 -0
- package/src/ObservedPeerConnection.ts +917 -402
- 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 +186 -298
- package/src/ObserverEventMonitor.ts +551 -0
- package/src/ObserverSummary.ts +15 -0
- 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 +24 -2
- package/src/detectors/Detector.ts +6 -0
- package/src/detectors/Detectors.ts +38 -0
- package/src/index.ts +26 -91
- package/src/mediasoup/ObservedMediaRouter.ts +10 -0
- package/src/monitors/TurnUsageMonitor.ts +164 -164
- package/src/schema/ClientEventTypes.ts +280 -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/updaters/CallUpdater.ts +5 -0
- package/src/updaters/ObserverUpdater.ts +5 -0
- package/src/updaters/OnAllCallObserverUpdater.ts +59 -0
- package/src/updaters/OnAllClientCallUpdater.ts +61 -0
- package/src/updaters/OnAnyCallObserverUpdater.ts +41 -0
- package/src/updaters/OnAnyClientCallUpdater.ts +39 -0
- package/src/updaters/OnIntervalUpdater.ts +19 -0
- package/src/updaters/Updater.ts +5 -0
- package/src/utils/MediasoupRemoteTrackResolver.ts +155 -0
- package/src/utils/RemoteTrackResolver.ts +12 -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 → ObservedCallSummary.js} +0 -0
package/src/ReportsCollector.ts
DELETED
|
@@ -1,336 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
CallEventReport,
|
|
3
|
-
CallMetaReport,
|
|
4
|
-
ClientDataChannelReport,
|
|
5
|
-
ClientExtensionReport,
|
|
6
|
-
IceCandidatePairReport,
|
|
7
|
-
InboundAudioTrackReport,
|
|
8
|
-
InboundVideoTrackReport,
|
|
9
|
-
ObserverEventReport,
|
|
10
|
-
OutboundAudioTrackReport,
|
|
11
|
-
OutboundVideoTrackReport,
|
|
12
|
-
PeerConnectionTransportReport,
|
|
13
|
-
SfuEventReport,
|
|
14
|
-
SfuExtensionReport,
|
|
15
|
-
SfuInboundRtpPadReport,
|
|
16
|
-
SfuMetaReport,
|
|
17
|
-
SfuOutboundRtpPadReport,
|
|
18
|
-
SfuSctpStreamReport,
|
|
19
|
-
SFUTransportReport,
|
|
20
|
-
} from '@observertc/report-schemas-js';
|
|
21
|
-
import { EventEmitter } from 'events';
|
|
22
|
-
import { ObserverSinkContext } from './common/types';
|
|
23
|
-
|
|
24
|
-
export type SinkEventsMap = {
|
|
25
|
-
'call-event': {
|
|
26
|
-
reports: CallEventReport[];
|
|
27
|
-
};
|
|
28
|
-
'call-meta': {
|
|
29
|
-
reports: CallMetaReport[];
|
|
30
|
-
};
|
|
31
|
-
'client-data-channel': {
|
|
32
|
-
reports: ClientDataChannelReport[];
|
|
33
|
-
};
|
|
34
|
-
'client-extension': {
|
|
35
|
-
reports: ClientExtensionReport[];
|
|
36
|
-
};
|
|
37
|
-
'ice-candidate-pair': {
|
|
38
|
-
reports: IceCandidatePairReport[];
|
|
39
|
-
};
|
|
40
|
-
'peer-connection-transport': {
|
|
41
|
-
reports: PeerConnectionTransportReport[];
|
|
42
|
-
};
|
|
43
|
-
'inbound-audio-track': {
|
|
44
|
-
reports: InboundAudioTrackReport[];
|
|
45
|
-
};
|
|
46
|
-
'inbound-video-track': {
|
|
47
|
-
reports: InboundVideoTrackReport[];
|
|
48
|
-
};
|
|
49
|
-
'observer-event': {
|
|
50
|
-
reports: ObserverEventReport[]
|
|
51
|
-
};
|
|
52
|
-
'outbound-audio-track': {
|
|
53
|
-
reports: OutboundAudioTrackReport[];
|
|
54
|
-
};
|
|
55
|
-
'outbound-video-track': {
|
|
56
|
-
reports: OutboundVideoTrackReport[];
|
|
57
|
-
};
|
|
58
|
-
'sfu-event': {
|
|
59
|
-
reports: SfuEventReport[];
|
|
60
|
-
};
|
|
61
|
-
'sfu-extension': {
|
|
62
|
-
reports: SfuExtensionReport[];
|
|
63
|
-
};
|
|
64
|
-
'sfu-inbound-rtp-pad': {
|
|
65
|
-
reports: SfuInboundRtpPadReport[];
|
|
66
|
-
};
|
|
67
|
-
'sfu-outbound-rtp-pad': {
|
|
68
|
-
reports: SfuOutboundRtpPadReport[];
|
|
69
|
-
};
|
|
70
|
-
'sfu-sctp-stream': {
|
|
71
|
-
reports: SfuSctpStreamReport[];
|
|
72
|
-
};
|
|
73
|
-
'sfu-transport': {
|
|
74
|
-
reports: SFUTransportReport[];
|
|
75
|
-
};
|
|
76
|
-
'sfu-meta': {
|
|
77
|
-
reports: SfuMetaReport[];
|
|
78
|
-
};
|
|
79
|
-
'reports': ObserverSinkContext;
|
|
80
|
-
'newreport': number;
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
export type ObserverSinkProcess = (observerSinkContext: ObserverSinkContext) => Promise<void>;
|
|
84
|
-
|
|
85
|
-
export class ReportsCollector {
|
|
86
|
-
private _collectedReports = 0;
|
|
87
|
-
private _emitter = new EventEmitter();
|
|
88
|
-
private _callEventReports: CallEventReport[] = [];
|
|
89
|
-
private _callMetaReports: CallMetaReport[] = [];
|
|
90
|
-
private _clientDataChannelReports: ClientDataChannelReport[] = [];
|
|
91
|
-
private _clientExtensionReports: ClientExtensionReport[] = [];
|
|
92
|
-
private _iceCandidatePairReports: IceCandidatePairReport[] = [];
|
|
93
|
-
private _inboundAudioTrackReports: InboundAudioTrackReport[] = [];
|
|
94
|
-
private _inboundVideoTrackReports: InboundVideoTrackReport[] = [];
|
|
95
|
-
private _peerConnectionTransportReports: PeerConnectionTransportReport[] = [];
|
|
96
|
-
private _observerEventReports: ObserverEventReport[] = [];
|
|
97
|
-
private _outboundAudioTrackReports: OutboundAudioTrackReport[] = [];
|
|
98
|
-
private _outboundVideoTrackReports: OutboundVideoTrackReport[] = [];
|
|
99
|
-
private _sfuEventReports: SfuEventReport[] = [];
|
|
100
|
-
private _sfuExtensionReports: SfuExtensionReport[] = [];
|
|
101
|
-
private _sfuInboundRtpPadReports: SfuInboundRtpPadReport[] = [];
|
|
102
|
-
private _sfuOutboundRtpPadReports: SfuOutboundRtpPadReport[] = [];
|
|
103
|
-
private _sfuSctpStreamReports: SfuSctpStreamReport[] = [];
|
|
104
|
-
private _sfuTransportReports: SFUTransportReport[] = [];
|
|
105
|
-
private _sfuMetaReports: SfuMetaReport[] = [];
|
|
106
|
-
|
|
107
|
-
public constructor() {
|
|
108
|
-
// empty
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
public on<K extends keyof SinkEventsMap>(event: K, listener: (reports: SinkEventsMap[K]) => void): this {
|
|
112
|
-
this._emitter.addListener(event, listener);
|
|
113
|
-
|
|
114
|
-
return this;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
public off<K extends keyof SinkEventsMap>(event: K, listener: (reports: SinkEventsMap[K]) => void): this {
|
|
118
|
-
this._emitter.removeListener(event, listener);
|
|
119
|
-
|
|
120
|
-
return this;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
public once<K extends keyof SinkEventsMap>(event: K, listener: (reports: SinkEventsMap[K]) => void): this {
|
|
124
|
-
this._emitter.once(event, listener);
|
|
125
|
-
|
|
126
|
-
return this;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
public addCallEventReport(report: CallEventReport) {
|
|
130
|
-
this._callEventReports.push(report);
|
|
131
|
-
this._emit('newreport', ++this._collectedReports);
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
public addCallMetaReport(report: CallMetaReport) {
|
|
135
|
-
this._callMetaReports.push(report);
|
|
136
|
-
this._emit('newreport', ++this._collectedReports);
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
public addClientDataChannelReport(report: ClientDataChannelReport) {
|
|
140
|
-
this._clientDataChannelReports.push(report);
|
|
141
|
-
this._emit('newreport', ++this._collectedReports);
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
public addClientExtensionReport(report: ClientExtensionReport) {
|
|
145
|
-
this._clientExtensionReports.push(report);
|
|
146
|
-
this._emit('newreport', ++this._collectedReports);
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
public addIceCandidatePairReport(report: IceCandidatePairReport) {
|
|
150
|
-
this._iceCandidatePairReports.push(report);
|
|
151
|
-
this._emit('newreport', ++this._collectedReports);
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
public addInboundAudioTrackReport(report: InboundAudioTrackReport) {
|
|
155
|
-
this._inboundAudioTrackReports.push(report);
|
|
156
|
-
this._emit('newreport', ++this._collectedReports);
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
public addInboundVideoTrackReport(report: InboundVideoTrackReport) {
|
|
160
|
-
this._inboundVideoTrackReports.push(report);
|
|
161
|
-
this._emit('newreport', ++this._collectedReports);
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
public addPeerConnectionTransportReports(report: PeerConnectionTransportReport) {
|
|
165
|
-
this._peerConnectionTransportReports.push(report);
|
|
166
|
-
this._emit('newreport', ++this._collectedReports);
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
public addObserverEventReport(report: ObserverEventReport) {
|
|
170
|
-
this._observerEventReports.push(report);
|
|
171
|
-
this._emit('newreport', ++this._collectedReports);
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
public addOutboundAudioTrackReport(report: OutboundAudioTrackReport) {
|
|
175
|
-
this._outboundAudioTrackReports.push(report);
|
|
176
|
-
this._emit('newreport', ++this._collectedReports);
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
public addOutboundVideoTrackReport(report: OutboundVideoTrackReport) {
|
|
180
|
-
this._outboundVideoTrackReports.push(report);
|
|
181
|
-
this._emit('newreport', ++this._collectedReports);
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
public addSfuEventReport(report: SfuEventReport) {
|
|
185
|
-
this._sfuEventReports.push(report);
|
|
186
|
-
this._emit('newreport', ++this._collectedReports);
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
public addSfuExtensionReport(report: SfuExtensionReport) {
|
|
190
|
-
this._sfuExtensionReports.push(report);
|
|
191
|
-
this._emit('newreport', ++this._collectedReports);
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
public addSfuInboundRtpPadReport(report: SfuInboundRtpPadReport) {
|
|
195
|
-
this._sfuInboundRtpPadReports.push(report);
|
|
196
|
-
this._emit('newreport', ++this._collectedReports);
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
public addSfuOutboundRtpPadReport(report: SfuOutboundRtpPadReport) {
|
|
200
|
-
this._sfuOutboundRtpPadReports.push(report);
|
|
201
|
-
this._emit('newreport', ++this._collectedReports);
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
public addSfuSctpStreamReport(report: SfuSctpStreamReport) {
|
|
205
|
-
this._sfuSctpStreamReports.push(report);
|
|
206
|
-
this._emit('newreport', ++this._collectedReports);
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
public addSfuTransportReport(report: SFUTransportReport) {
|
|
210
|
-
this._sfuTransportReports.push(report);
|
|
211
|
-
this._emit('newreport', ++this._collectedReports);
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
public addSfuMetaReport(report: SfuMetaReport) {
|
|
215
|
-
this._sfuMetaReports.push(report);
|
|
216
|
-
this._emit('newreport', ++this._collectedReports);
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
public emit(): number {
|
|
220
|
-
let result = 0;
|
|
221
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
222
|
-
const checkAndEmit = (eventName: keyof SinkEventsMap, reports: any[]) => {
|
|
223
|
-
if (0 < reports.length) {
|
|
224
|
-
this._emit(eventName, { reports });
|
|
225
|
-
result += reports.length;
|
|
226
|
-
}
|
|
227
|
-
};
|
|
228
|
-
|
|
229
|
-
const context = this._createObserverSinkContext();
|
|
230
|
-
|
|
231
|
-
checkAndEmit('call-event', this._callEventReports);
|
|
232
|
-
this._callEventReports = [];
|
|
233
|
-
|
|
234
|
-
checkAndEmit('call-meta', this._callMetaReports);
|
|
235
|
-
this._callMetaReports = [];
|
|
236
|
-
|
|
237
|
-
checkAndEmit('client-data-channel', this._clientDataChannelReports);
|
|
238
|
-
this._clientDataChannelReports = [];
|
|
239
|
-
|
|
240
|
-
checkAndEmit('client-extension', this._clientExtensionReports);
|
|
241
|
-
this._clientExtensionReports = [];
|
|
242
|
-
|
|
243
|
-
checkAndEmit('ice-candidate-pair', this._iceCandidatePairReports);
|
|
244
|
-
this._iceCandidatePairReports = [];
|
|
245
|
-
|
|
246
|
-
checkAndEmit('inbound-audio-track', this._inboundAudioTrackReports);
|
|
247
|
-
this._inboundAudioTrackReports = [];
|
|
248
|
-
|
|
249
|
-
checkAndEmit('inbound-video-track', this._inboundVideoTrackReports);
|
|
250
|
-
this._inboundVideoTrackReports = [];
|
|
251
|
-
|
|
252
|
-
checkAndEmit('peer-connection-transport', this._peerConnectionTransportReports);
|
|
253
|
-
this._peerConnectionTransportReports = [];
|
|
254
|
-
|
|
255
|
-
checkAndEmit('observer-event', this._observerEventReports);
|
|
256
|
-
this._observerEventReports = [];
|
|
257
|
-
|
|
258
|
-
checkAndEmit('outbound-audio-track', this._outboundAudioTrackReports);
|
|
259
|
-
this._outboundAudioTrackReports = [];
|
|
260
|
-
|
|
261
|
-
checkAndEmit('outbound-video-track', this._outboundVideoTrackReports);
|
|
262
|
-
this._outboundVideoTrackReports = [];
|
|
263
|
-
|
|
264
|
-
checkAndEmit('sfu-event', this._sfuEventReports);
|
|
265
|
-
this._sfuEventReports = [];
|
|
266
|
-
|
|
267
|
-
checkAndEmit('sfu-extension', this._sfuExtensionReports);
|
|
268
|
-
this._sfuExtensionReports = [];
|
|
269
|
-
|
|
270
|
-
checkAndEmit('sfu-inbound-rtp-pad', this._sfuInboundRtpPadReports);
|
|
271
|
-
this._sfuInboundRtpPadReports = [];
|
|
272
|
-
|
|
273
|
-
checkAndEmit('sfu-outbound-rtp-pad', this._sfuOutboundRtpPadReports);
|
|
274
|
-
this._sfuOutboundRtpPadReports = [];
|
|
275
|
-
|
|
276
|
-
checkAndEmit('sfu-sctp-stream', this._sfuSctpStreamReports);
|
|
277
|
-
this._sfuSctpStreamReports = [];
|
|
278
|
-
|
|
279
|
-
checkAndEmit('sfu-transport', this._sfuTransportReports);
|
|
280
|
-
this._sfuTransportReports = [];
|
|
281
|
-
|
|
282
|
-
checkAndEmit('sfu-meta', this._sfuMetaReports);
|
|
283
|
-
this._sfuMetaReports = [];
|
|
284
|
-
|
|
285
|
-
this._emit('reports', context);
|
|
286
|
-
this._collectedReports = 0;
|
|
287
|
-
|
|
288
|
-
return result;
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
private _emit<K extends keyof SinkEventsMap>(event: K, reports: SinkEventsMap[K]): boolean {
|
|
292
|
-
return this._emitter.emit(event, reports);
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
private _createObserverSinkContext(): ObserverSinkContext {
|
|
296
|
-
const callEventReports = [ ...this._callEventReports ];
|
|
297
|
-
const callMetaReports = [ ...this._callMetaReports ];
|
|
298
|
-
const clientDataChannelReports = [ ...this._clientDataChannelReports ];
|
|
299
|
-
const clientExtensionReports = [ ...this._clientExtensionReports ];
|
|
300
|
-
const iceCandidatePairReports = [ ...this._iceCandidatePairReports ];
|
|
301
|
-
const inboundAudioTrackReports = [ ...this._inboundAudioTrackReports ];
|
|
302
|
-
const inboundVideoTrackReports = [ ...this._inboundVideoTrackReports ];
|
|
303
|
-
const peerConnectionTransportReports = [ ...this._peerConnectionTransportReports ];
|
|
304
|
-
const observerEventReports = [ ...this._observerEventReports ];
|
|
305
|
-
const outboundAudioTrackReports = [ ...this._outboundAudioTrackReports ];
|
|
306
|
-
const outboundVideoTrackReports = [ ...this._outboundVideoTrackReports ];
|
|
307
|
-
const sfuEventReports = [ ...this._sfuEventReports ];
|
|
308
|
-
const sfuExtensionReports = [ ...this._sfuExtensionReports ];
|
|
309
|
-
const sfuInboundRtpPadReports = [ ...this._sfuInboundRtpPadReports ];
|
|
310
|
-
const sfuOutboundRtpPadReports = [ ...this._sfuOutboundRtpPadReports ];
|
|
311
|
-
const sfuSctpStreamReports = [ ...this._sfuSctpStreamReports ];
|
|
312
|
-
const sfuTransportReports = [ ...this._sfuTransportReports ];
|
|
313
|
-
const sfuMetaReports = [ ...this._sfuMetaReports ];
|
|
314
|
-
|
|
315
|
-
return {
|
|
316
|
-
callEventReports,
|
|
317
|
-
callMetaReports,
|
|
318
|
-
clientDataChannelReports,
|
|
319
|
-
clientExtensionReports,
|
|
320
|
-
iceCandidatePairReports,
|
|
321
|
-
inboundAudioTrackReports,
|
|
322
|
-
inboundVideoTrackReports,
|
|
323
|
-
peerConnectionTransportReports,
|
|
324
|
-
observerEventReports,
|
|
325
|
-
outboundAudioTrackReports,
|
|
326
|
-
outboundVideoTrackReports,
|
|
327
|
-
sfuEventReports,
|
|
328
|
-
sfuExtensionReports,
|
|
329
|
-
sfuInboundRtpPadReports,
|
|
330
|
-
sfuOutboundRtpPadReports,
|
|
331
|
-
sfuSctpStreamReports,
|
|
332
|
-
sfuTransportReports,
|
|
333
|
-
sfuMetaReports,
|
|
334
|
-
};
|
|
335
|
-
}
|
|
336
|
-
}
|
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
import { ClientIssue } from '../monitors/CallSummary';
|
|
2
|
-
import { ObservedInboundVideoTrack } from '../ObservedInboundVideoTrack';
|
|
3
|
-
import { ObservedInboundAudioTrack } from '../ObservedInboundAudioTrack';
|
|
4
|
-
import { ObservedOutboundVideoTrack } from '../ObservedOutboundVideoTrack';
|
|
5
|
-
import { ObservedOutboundAudioTrack } from '../ObservedOutboundAudioTrack';
|
|
6
|
-
|
|
7
|
-
export type CalculationRemark = {
|
|
8
|
-
severity: 'none' | 'minor' | 'major' | 'critical',
|
|
9
|
-
text: string,
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export type CalculatedScore = {
|
|
13
|
-
score: number,
|
|
14
|
-
timestamp: number,
|
|
15
|
-
remarks: CalculationRemark[],
|
|
16
|
-
debugText?: string,
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
// every track calculates its own score and stores
|
|
20
|
-
// the latest CalculatedScore in a score property also emits as an event 'score'
|
|
21
|
-
// every peer connection collects the scores and calculates its own score based on RTT, and stores it in the score property similar to track
|
|
22
|
-
// every client collects the scores and calculates its own score based on the peer connection scores, and stores it in the score property similar to track
|
|
23
|
-
// every call collects the scores and calculates its own score based on the client scores, and stores it in the score property similar to track, but
|
|
24
|
-
// but calls only recalculate it after a configured amount of time passed from the last recalculation, and it does not trigger automatically
|
|
25
|
-
|
|
26
|
-
/*
|
|
27
|
-
Recommended bpp Ranges for Good Quality
|
|
28
|
-
|
|
29
|
-
| Content Type | H.264 (AVC) bpp Range | H.265 (HEVC) bpp Range | VP8 bpp Range | VP9 bpp Range |
|
|
30
|
-
|--------------------|-----------------------|-----------------------|---------------|---------------|
|
|
31
|
-
| Low Motion | 0.1 - 0.2 | 0.05 - 0.15 | 0.1 - 0.2 | 0.05 - 0.15 |
|
|
32
|
-
| Standard Motion | 0.15 - 0.25 | 0.1 - 0.2 | 0.15 - 0.25 | 0.1 - 0.2 |
|
|
33
|
-
| High Motion | 0.25 - 0.4 | 0.15 - 0.3 | 0.25 - 0.4 | 0.15 - 0.3 |
|
|
34
|
-
|
|
35
|
-
*/
|
|
36
|
-
export const BPP_RANGES = {
|
|
37
|
-
'lowmotion': {
|
|
38
|
-
'h264': { low: 0.1, high: 0.2 },
|
|
39
|
-
'h265': { low: 0.05, high: 0.15 },
|
|
40
|
-
'vp8': { low: 0.1, high: 0.2 },
|
|
41
|
-
'vp9': { low: 0.05, high: 0.15 },
|
|
42
|
-
},
|
|
43
|
-
'standard': {
|
|
44
|
-
'h264': { low: 0.15, high: 0.25 },
|
|
45
|
-
'h265': { low: 0.1, high: 0.2 },
|
|
46
|
-
'vp8': { low: 0.15, high: 0.25 },
|
|
47
|
-
'vp9': { low: 0.1, high: 0.2 },
|
|
48
|
-
},
|
|
49
|
-
'highmotion': {
|
|
50
|
-
'h264': { low: 0.25, high: 0.4 },
|
|
51
|
-
'h265': { low: 0.15, high: 0.3 },
|
|
52
|
-
'vp8': { low: 0.25, high: 0.4 },
|
|
53
|
-
'vp9': { low: 0.15, high: 0.3 },
|
|
54
|
-
},
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
export function calculateBaseVideoScore(track: ObservedInboundVideoTrack | ObservedOutboundVideoTrack, newIssues: ClientIssue[]): CalculatedScore | undefined {
|
|
58
|
-
if (!track.highestLayer) {
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
const {
|
|
62
|
-
frameHeight,
|
|
63
|
-
frameWidth,
|
|
64
|
-
framesPerSecond,
|
|
65
|
-
bitrate,
|
|
66
|
-
} = track.highestLayer;
|
|
67
|
-
const score: CalculatedScore = {
|
|
68
|
-
remarks: [],
|
|
69
|
-
score: 0.0,
|
|
70
|
-
timestamp: track.statsTimestamp,
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
if (!frameHeight || !frameWidth || !bitrate || !framesPerSecond) {
|
|
74
|
-
score.score = 0.0;
|
|
75
|
-
score.remarks.push({
|
|
76
|
-
severity: 'major',
|
|
77
|
-
text: 'Missing data for score calculation',
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
return score;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
const bpp = bitrate / (frameHeight * frameWidth * framesPerSecond);
|
|
84
|
-
// let's assume vp8 for now
|
|
85
|
-
const bppRange = BPP_RANGES[track.contentType][track.codec ?? 'vp8'];
|
|
86
|
-
|
|
87
|
-
if (bpp / 2 < bppRange.low) {
|
|
88
|
-
score.score = 0.5;
|
|
89
|
-
score.remarks.push({
|
|
90
|
-
severity: 'major',
|
|
91
|
-
text: `Bitrate per pixel is too low for ${track.contentType} content`,
|
|
92
|
-
});
|
|
93
|
-
} else if (bppRange.low < bpp) {
|
|
94
|
-
score.score = 0.8;
|
|
95
|
-
score.remarks.push({
|
|
96
|
-
severity: 'minor',
|
|
97
|
-
text: `Bitrate per pixel is good for ${track.contentType} content`,
|
|
98
|
-
});
|
|
99
|
-
} else {
|
|
100
|
-
score.score = Math.min(1.0, ((bpp - bppRange.low) / (bppRange.high - bppRange.low)));
|
|
101
|
-
score.remarks.push({
|
|
102
|
-
severity: 'none',
|
|
103
|
-
text: `Bitrate per pixel is good for ${track.contentType} content`,
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
for (const issue of newIssues) {
|
|
108
|
-
if (issue.severity === 'critical') {
|
|
109
|
-
score.score = 0.0;
|
|
110
|
-
} else if (issue.severity === 'major') {
|
|
111
|
-
score.score *= 0.5;
|
|
112
|
-
} else if (issue.severity === 'minor') {
|
|
113
|
-
score.score *= 0.8;
|
|
114
|
-
}
|
|
115
|
-
score.remarks.push({
|
|
116
|
-
severity: issue.severity,
|
|
117
|
-
text: issue.description ?? 'Issue occurred',
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
return score;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
export function calculateBaseAudioScore(track: ObservedInboundAudioTrack | ObservedOutboundAudioTrack, newIssues: ClientIssue[]): CalculatedScore | undefined {
|
|
125
|
-
const score: CalculatedScore = {
|
|
126
|
-
remarks: [],
|
|
127
|
-
score: 0.0,
|
|
128
|
-
timestamp: track.statsTimestamp,
|
|
129
|
-
};
|
|
130
|
-
|
|
131
|
-
if (track.bitrate < 8000) {
|
|
132
|
-
score.score = 0.2;
|
|
133
|
-
score.remarks.push({
|
|
134
|
-
severity: 'none',
|
|
135
|
-
text: 'Bitrate is too low for good quality audio',
|
|
136
|
-
});
|
|
137
|
-
} else if (track.bitrate < 16000) {
|
|
138
|
-
score.score = 0.5;
|
|
139
|
-
score.remarks.push({
|
|
140
|
-
severity: 'none',
|
|
141
|
-
text: 'Bitrate is low for audio',
|
|
142
|
-
});
|
|
143
|
-
} else {
|
|
144
|
-
score.score = 1.0;
|
|
145
|
-
score.remarks.push({
|
|
146
|
-
severity: 'none',
|
|
147
|
-
text: 'Bitrate is good for audio',
|
|
148
|
-
});
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
for (const issues of newIssues) {
|
|
152
|
-
if (issues.severity === 'critical') {
|
|
153
|
-
score.score = 0.0;
|
|
154
|
-
} else if (issues.severity === 'major') {
|
|
155
|
-
score.score *= 0.5;
|
|
156
|
-
} else if (issues.severity === 'minor') {
|
|
157
|
-
score.score *= 0.8;
|
|
158
|
-
}
|
|
159
|
-
score.remarks.push({
|
|
160
|
-
severity: issues.severity,
|
|
161
|
-
text: issues.description ?? 'Issue occurred',
|
|
162
|
-
});
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
return score;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
export function calculateLatencyMOS(
|
|
169
|
-
{ avgJitter, rttInMs, packetsLoss }:
|
|
170
|
-
{ avgJitter: number, rttInMs: number, packetsLoss: number },
|
|
171
|
-
): number {
|
|
172
|
-
const effectiveLatency = rttInMs + (avgJitter * 2) + 10;
|
|
173
|
-
let rFactor = effectiveLatency < 160
|
|
174
|
-
? 93.2 - (effectiveLatency / 40)
|
|
175
|
-
: 93.2 - (effectiveLatency / 120) - 10;
|
|
176
|
-
|
|
177
|
-
rFactor -= (packetsLoss * 2.5);
|
|
178
|
-
|
|
179
|
-
return 1 + ((0.035) * rFactor) + ((0.000007) * rFactor * (rFactor - 60) * (100 - rFactor));
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
export function getRttScore(x: number): number {
|
|
183
|
-
// logarithmic version: 1.0 at 150 and 0.1 at 300
|
|
184
|
-
return (-1.2984 * Math.log(x)) + 7.5059;
|
|
185
|
-
|
|
186
|
-
// exponential version: 1.0 at 150 and 0.1 at 300
|
|
187
|
-
// return Math.exp(-0.01536 * x);
|
|
188
|
-
}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
// eslint-disable-next-line no-shadow
|
|
2
|
-
export enum CallEventType {
|
|
3
|
-
CALL_STARTED = 'CALL_STARTED',
|
|
4
|
-
CALL_ENDED = 'CALL_ENDED',
|
|
5
|
-
CLIENT_JOINED = 'CLIENT_JOINED',
|
|
6
|
-
CLIENT_LEFT = 'CLIENT_LEFT',
|
|
7
|
-
PEER_CONNECTION_OPENED = 'PEER_CONNECTION_OPENED',
|
|
8
|
-
PEER_CONNECTION_CLOSED = 'PEER_CONNECTION_CLOSED',
|
|
9
|
-
MEDIA_TRACK_ADDED = 'MEDIA_TRACK_ADDED',
|
|
10
|
-
MEDIA_TRACK_REMOVED = 'MEDIA_TRACK_REMOVED',
|
|
11
|
-
MEDIA_TRACK_RESUMED = 'MEDIA_TRACK_RESUMED',
|
|
12
|
-
MEDIA_TRACK_MUTED = 'MEDIA_TRACK_MUTED',
|
|
13
|
-
MEDIA_TRACK_UNMUTED = 'MEDIA_TRACK_UNMUTED',
|
|
14
|
-
ICE_GATHERING_STATE_CHANGED = 'ICE_GATHERING_STATE_CHANGED',
|
|
15
|
-
PEER_CONNECTION_STATE_CHANGED = 'PEER_CONNECTION_STATE_CHANGED',
|
|
16
|
-
ICE_CONNECTION_STATE_CHANGED = 'ICE_CONNECTION_STATE_CHANGED',
|
|
17
|
-
DATA_CHANNEL_OPEN = 'DATA_CHANNEL_OPEN',
|
|
18
|
-
DATA_CHANNEL_CLOSED = 'DATA_CHANNEL_CLOSED',
|
|
19
|
-
DATA_CHANNEL_ERROR = 'DATA_CHANNEL_ERROR',
|
|
20
|
-
NEGOTIATION_NEEDED = 'NEGOTIATION_NEEDED',
|
|
21
|
-
SIGNALING_STATE_CHANGE = 'SIGNALING_STATE_CHANGE',
|
|
22
|
-
CLIENT_ISSUE = 'CLIENT_ISSUE',
|
|
23
|
-
|
|
24
|
-
PRODUCER_ADDED = 'PRODUCER_ADDED',
|
|
25
|
-
PRODUCER_PAUSED = 'PRODUCER_PAUSED',
|
|
26
|
-
PRODUCER_RESUMED = 'PRODUCER_RESUMED',
|
|
27
|
-
PRODUCER_REMOVED = 'PRODUCER_REMOVED',
|
|
28
|
-
CONSUMER_ADDED = 'CONSUMER_ADDED',
|
|
29
|
-
CONSUMER_PAUSED = 'CONSUMER_PAUSED',
|
|
30
|
-
CONSUMER_RESUMED = 'CONSUMER_RESUMED',
|
|
31
|
-
CONSUMER_REMOVED = 'CONSUMER_REMOVED',
|
|
32
|
-
DATA_PRODUCER_OPENED = 'DATA_PRODUCER_OPENED',
|
|
33
|
-
DATA_PRODUCER_CLOSED = 'DATA_PRODUCER_CLOSED',
|
|
34
|
-
DATA_CONSUMER_OPENED = 'DATA_CONSUMER_OPENED',
|
|
35
|
-
DATA_CONSUMER_CLOSED = 'DATA_CONSUMER_CLOSED',
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export type CallEventReportType = {
|
|
39
|
-
name: CallEventType.MEDIA_TRACK_ADDED,
|
|
40
|
-
attachment: MediaTrackAddedAttachment,
|
|
41
|
-
} | {
|
|
42
|
-
name: CallEventType.PEER_CONNECTION_STATE_CHANGED,
|
|
43
|
-
attachment: PeerConnectionStateChangedAttachment,
|
|
44
|
-
} | {
|
|
45
|
-
name: CallEventType.ICE_CONNECTION_STATE_CHANGED,
|
|
46
|
-
attachment: IceConnectionStateChangedAttachment,
|
|
47
|
-
} | {
|
|
48
|
-
name: CallEventType.ICE_GATHERING_STATE_CHANGED,
|
|
49
|
-
attachment: IceGatheringStateChangedAttachment,
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export type MediaTrackAddedAttachment = {
|
|
53
|
-
kind?: 'audio' | 'video',
|
|
54
|
-
direction?: 'inbound' | 'outbound',
|
|
55
|
-
sfuStreamId?: string,
|
|
56
|
-
sfuSinkId?: string,
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
export type PeerConnectionStateChangedAttachment = {
|
|
60
|
-
iceConnectionState?: 'closed' | 'connected' | 'connecting' | 'disconnected' | 'failed' | 'new',
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export type IceConnectionStateChangedAttachment = {
|
|
64
|
-
iceConnectionState?: 'new' | 'connected' | 'disconnected' | 'failed' | 'closed' | 'checking' | 'completed',
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
export type IceGatheringStateChangedAttachment = {
|
|
68
|
-
iceGatheringState?: 'new' | 'gathering' | 'complete',
|
|
69
|
-
}
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { CallMetaReport } from '@observertc/report-schemas-js';
|
|
2
|
-
import {
|
|
3
|
-
Browser,
|
|
4
|
-
Certificate,
|
|
5
|
-
Engine,
|
|
6
|
-
IceLocalCandidate,
|
|
7
|
-
IceRemoteCandidate,
|
|
8
|
-
MediaCodecStats,
|
|
9
|
-
MediaDevice,
|
|
10
|
-
MediaSourceStat,
|
|
11
|
-
OperationSystem,
|
|
12
|
-
Platform,
|
|
13
|
-
} from '@observertc/sample-schemas-js';
|
|
14
|
-
|
|
15
|
-
// eslint-disable-next-line no-shadow
|
|
16
|
-
export enum CallMetaType {
|
|
17
|
-
CERTIFICATE = 'CERTIFICATE',
|
|
18
|
-
CODEC = 'CODEC',
|
|
19
|
-
ICE_LOCAL_CANDIDATE = 'ICE_LOCAL_CANDIDATE',
|
|
20
|
-
ICE_REMOTE_CANDIDATE = 'ICE_REMOTE_CANDIDATE',
|
|
21
|
-
ICE_SERVER = 'ICE_SERVER',
|
|
22
|
-
MEDIA_CONSTRAINT = 'MEDIA_CONSTRAINT',
|
|
23
|
-
MEDIA_DEVICE = 'MEDIA_DEVICE',
|
|
24
|
-
MEDIA_SOURCE = 'MEDIA_SOURCE',
|
|
25
|
-
USER_MEDIA_ERROR = 'USER_MEDIA_ERROR',
|
|
26
|
-
LOCAL_SDP = 'LOCAL_SDP',
|
|
27
|
-
|
|
28
|
-
OPERATION_SYSTEM = 'OPERATION_SYSTEM',
|
|
29
|
-
ENGINE = 'ENGINE',
|
|
30
|
-
PLATFORM = 'PLATFORM',
|
|
31
|
-
BROWSER = 'BROWSER',
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export type CallMetaReportPayloads = {
|
|
35
|
-
[CallMetaType.CERTIFICATE]: Certificate;
|
|
36
|
-
[CallMetaType.CODEC]: MediaCodecStats;
|
|
37
|
-
[CallMetaType.ICE_LOCAL_CANDIDATE]: IceLocalCandidate;
|
|
38
|
-
[CallMetaType.ICE_REMOTE_CANDIDATE]: IceRemoteCandidate;
|
|
39
|
-
[CallMetaType.ICE_SERVER]: string;
|
|
40
|
-
[CallMetaType.MEDIA_CONSTRAINT]: string;
|
|
41
|
-
[CallMetaType.MEDIA_DEVICE]: MediaDevice;
|
|
42
|
-
[CallMetaType.MEDIA_SOURCE]: MediaSourceStat;
|
|
43
|
-
[CallMetaType.USER_MEDIA_ERROR]: string;
|
|
44
|
-
[CallMetaType.OPERATION_SYSTEM]: OperationSystem;
|
|
45
|
-
[CallMetaType.PLATFORM]: Platform;
|
|
46
|
-
[CallMetaType.ENGINE]: Engine;
|
|
47
|
-
[CallMetaType.LOCAL_SDP]: string;
|
|
48
|
-
[CallMetaType.BROWSER]: Browser;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export type CallMetaReportType ={
|
|
52
|
-
[k in keyof CallMetaReportPayloads]: {
|
|
53
|
-
type: k;
|
|
54
|
-
payload: CallMetaReportPayloads[k]
|
|
55
|
-
};
|
|
56
|
-
}[keyof CallMetaReportPayloads];
|
|
57
|
-
|
|
58
|
-
export function createCallMetaReport(
|
|
59
|
-
serviceId: string,
|
|
60
|
-
mediaUnitId: string,
|
|
61
|
-
roomId: string,
|
|
62
|
-
callId: string,
|
|
63
|
-
clientId: string,
|
|
64
|
-
reportType: CallMetaReportType,
|
|
65
|
-
userId?: string,
|
|
66
|
-
peerConnectionId?: string,
|
|
67
|
-
timestamp?: number
|
|
68
|
-
) {
|
|
69
|
-
const report: CallMetaReport = {
|
|
70
|
-
type: reportType.type,
|
|
71
|
-
serviceId,
|
|
72
|
-
mediaUnitId,
|
|
73
|
-
roomId,
|
|
74
|
-
callId,
|
|
75
|
-
clientId,
|
|
76
|
-
userId,
|
|
77
|
-
payload: JSON.stringify(reportType.payload),
|
|
78
|
-
timestamp: timestamp ?? Date.now(),
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
return report;
|
|
82
|
-
}
|
|
File without changes
|