@observertc/observer-js 0.9.26-beta → 0.30.0-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/ObservedCall.d.ts +54 -0
- package/lib/ObservedCall.d.ts.map +1 -0
- package/lib/ObservedCall.js +166 -0
- package/lib/ObservedClient.d.ts +73 -0
- package/lib/ObservedClient.d.ts.map +1 -0
- package/lib/ObservedClient.js +487 -0
- package/lib/ObservedInboundTrack.d.ts +65 -0
- package/lib/ObservedInboundTrack.d.ts.map +1 -0
- package/lib/ObservedInboundTrack.js +192 -0
- package/lib/ObservedOutboundTrack.d.ts +55 -0
- package/lib/ObservedOutboundTrack.d.ts.map +1 -0
- package/lib/ObservedOutboundTrack.js +166 -0
- package/lib/ObservedPeerConnection.d.ts +57 -0
- package/lib/ObservedPeerConnection.d.ts.map +1 -0
- package/lib/ObservedPeerConnection.js +217 -0
- package/lib/Observer.d.ts +26 -1465
- package/lib/Observer.d.ts.map +1 -1
- package/lib/Observer.js +53 -605
- package/lib/{sinks/ObserverSink.d.ts → ReportsCollector.d.ts} +7 -23
- package/lib/ReportsCollector.d.ts.map +1 -0
- package/lib/{sinks/ObserverSink.js → ReportsCollector.js} +27 -85
- package/lib/common/ReportsCollector.d.ts +21 -24
- package/lib/common/ReportsCollector.d.ts.map +1 -1
- package/lib/common/ReportsCollector.js +24 -0
- package/lib/common/SingleExecutor.d.ts +3 -0
- package/lib/common/SingleExecutor.d.ts.map +1 -0
- package/lib/common/SingleExecutor.js +31 -0
- package/lib/common/TypedEventEmitter.d.ts +22 -0
- package/lib/common/TypedEventEmitter.d.ts.map +1 -0
- package/lib/common/TypedEventEmitter.js +11 -0
- package/lib/common/callEventReports.d.ts.map +1 -0
- package/lib/common/logger.d.ts +3 -9
- package/lib/common/logger.d.ts.map +1 -1
- package/lib/common/logger.js +58 -141
- package/lib/common/types.d.ts +2 -14
- package/lib/common/types.d.ts.map +1 -1
- package/lib/common/utils.d.ts +1 -0
- package/lib/common/utils.d.ts.map +1 -1
- package/lib/common/utils.js +6 -1
- package/lib/index.d.ts +8 -19
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +7 -2
- package/package.json +1 -1
- package/src/ObservedCall.ts +201 -0
- package/src/ObservedClient.ts +681 -0
- package/src/ObservedInboundTrack.ts +238 -0
- package/src/ObservedOutboundTrack.ts +205 -0
- package/src/ObservedPeerConnection.ts +249 -0
- package/src/Observer.ts +86 -442
- package/src/{sinks/ObserverSink.ts → ReportsCollector.ts} +29 -94
- package/src/common/ReportsCollector.ts +48 -23
- package/src/common/SingleExecutor.ts +36 -0
- package/src/common/TypedEventEmitter.ts +32 -0
- package/src/common/logger.ts +58 -161
- package/src/common/types.ts +4 -24
- package/src/common/utils.ts +6 -0
- package/src/index.ts +12 -23
- package/lib/Evaluator.d.ts +0 -43
- package/lib/Evaluator.d.ts.map +0 -1
- package/lib/Evaluator.js +0 -171
- package/lib/common/Semaphore.d.ts +0 -31
- package/lib/common/Semaphore.d.ts.map +0 -1
- package/lib/common/Semaphore.js +0 -16
- package/lib/entries/CallEntry.d.ts +0 -619
- package/lib/entries/CallEntry.d.ts.map +0 -1
- package/lib/entries/CallEntry.js +0 -75
- package/lib/entries/ClientEntry.d.ts +0 -478
- package/lib/entries/ClientEntry.d.ts.map +0 -1
- package/lib/entries/ClientEntry.js +0 -114
- package/lib/entries/InboundTrackEntry.d.ts +0 -682
- package/lib/entries/InboundTrackEntry.d.ts.map +0 -1
- package/lib/entries/InboundTrackEntry.js +0 -76
- package/lib/entries/OutboundTrackEntry.d.ts +0 -682
- package/lib/entries/OutboundTrackEntry.d.ts.map +0 -1
- package/lib/entries/OutboundTrackEntry.js +0 -73
- package/lib/entries/PeerConnectionEntry.d.ts +0 -505
- package/lib/entries/PeerConnectionEntry.d.ts.map +0 -1
- package/lib/entries/PeerConnectionEntry.js +0 -144
- package/lib/entries/SfuEntry.d.ts +0 -150
- package/lib/entries/SfuEntry.d.ts.map +0 -1
- package/lib/entries/SfuEntry.js +0 -77
- package/lib/entries/SfuInboundRtpPadEntry.d.ts +0 -14
- package/lib/entries/SfuInboundRtpPadEntry.d.ts.map +0 -1
- package/lib/entries/SfuInboundRtpPadEntry.js +0 -49
- package/lib/entries/SfuOutboundRtpPadEntry.d.ts +0 -14
- package/lib/entries/SfuOutboundRtpPadEntry.d.ts.map +0 -1
- package/lib/entries/SfuOutboundRtpPadEntry.js +0 -47
- package/lib/entries/SfuSctpChannelEntry.d.ts +0 -12
- package/lib/entries/SfuSctpChannelEntry.d.ts.map +0 -1
- package/lib/entries/SfuSctpChannelEntry.js +0 -43
- package/lib/entries/SfuTransportEntry.d.ts +0 -82
- package/lib/entries/SfuTransportEntry.d.ts.map +0 -1
- package/lib/entries/SfuTransportEntry.js +0 -122
- package/lib/evaluators/SetClientsCoordinateEvaluator.d.ts +0 -9
- package/lib/evaluators/SetClientsCoordinateEvaluator.d.ts.map +0 -1
- package/lib/evaluators/SetClientsCoordinateEvaluator.js +0 -95
- package/lib/middlewares/CallOperationsContext.d.ts +0 -18
- package/lib/middlewares/CallOperationsContext.d.ts.map +0 -1
- package/lib/middlewares/CallOperationsContext.js +0 -27
- package/lib/middlewares/CallProcessor.d.ts +0 -6
- package/lib/middlewares/CallProcessor.d.ts.map +0 -1
- package/lib/middlewares/CallProcessor.js +0 -36
- package/lib/middlewares/CommitTransactionMiddleware.d.ts +0 -6
- package/lib/middlewares/CommitTransactionMiddleware.d.ts.map +0 -1
- package/lib/middlewares/CommitTransactionMiddleware.js +0 -179
- package/lib/middlewares/DeleteOutdatedCallEntries.d.ts +0 -6
- package/lib/middlewares/DeleteOutdatedCallEntries.d.ts.map +0 -1
- package/lib/middlewares/DeleteOutdatedCallEntries.js +0 -121
- package/lib/middlewares/DeleteOutdatedSfuEntries.d.ts +0 -6
- package/lib/middlewares/DeleteOutdatedSfuEntries.d.ts.map +0 -1
- package/lib/middlewares/DeleteOutdatedSfuEntries.js +0 -127
- package/lib/middlewares/Middleware.d.ts +0 -3
- package/lib/middlewares/Middleware.d.ts.map +0 -1
- package/lib/middlewares/Middleware.js +0 -21
- package/lib/middlewares/Processor.d.ts +0 -9
- package/lib/middlewares/Processor.d.ts.map +0 -1
- package/lib/middlewares/Processor.js +0 -54
- package/lib/middlewares/TransactionContext.d.ts +0 -35
- package/lib/middlewares/TransactionContext.d.ts.map +0 -1
- package/lib/middlewares/TransactionContext.js +0 -90
- package/lib/middlewares/TransactoinProcessor.d.ts +0 -6
- package/lib/middlewares/TransactoinProcessor.d.ts.map +0 -1
- package/lib/middlewares/TransactoinProcessor.js +0 -17
- package/lib/middlewares/VisitObservedCallsMiddleware.d.ts +0 -7
- package/lib/middlewares/VisitObservedCallsMiddleware.d.ts.map +0 -1
- package/lib/middlewares/VisitObservedCallsMiddleware.js +0 -96
- package/lib/middlewares/VisitObservedSfusMiddleware.d.ts +0 -6
- package/lib/middlewares/VisitObservedSfusMiddleware.d.ts.map +0 -1
- package/lib/middlewares/VisitObservedSfusMiddleware.js +0 -151
- package/lib/middlewares/visitors/visitClient.d.ts +0 -5
- package/lib/middlewares/visitors/visitClient.d.ts.map +0 -1
- package/lib/middlewares/visitors/visitClient.js +0 -174
- package/lib/middlewares/visitors/visitInboundAudioTrack.d.ts +0 -5
- package/lib/middlewares/visitors/visitInboundAudioTrack.d.ts.map +0 -1
- package/lib/middlewares/visitors/visitInboundAudioTrack.js +0 -93
- package/lib/middlewares/visitors/visitInboundVideoTrack.d.ts +0 -5
- package/lib/middlewares/visitors/visitInboundVideoTrack.d.ts.map +0 -1
- package/lib/middlewares/visitors/visitInboundVideoTrack.js +0 -94
- package/lib/middlewares/visitors/visitOutboundAudioTrack.d.ts +0 -5
- package/lib/middlewares/visitors/visitOutboundAudioTrack.d.ts.map +0 -1
- package/lib/middlewares/visitors/visitOutboundAudioTrack.js +0 -90
- package/lib/middlewares/visitors/visitOutboundVideoTarck.d.ts +0 -5
- package/lib/middlewares/visitors/visitOutboundVideoTarck.d.ts.map +0 -1
- package/lib/middlewares/visitors/visitOutboundVideoTarck.js +0 -90
- package/lib/middlewares/visitors/visitPeerConnection.d.ts +0 -5
- package/lib/middlewares/visitors/visitPeerConnection.d.ts.map +0 -1
- package/lib/middlewares/visitors/visitPeerConnection.js +0 -111
- package/lib/middlewares/visitors/visitSfu.d.ts +0 -5
- package/lib/middlewares/visitors/visitSfu.d.ts.map +0 -1
- package/lib/middlewares/visitors/visitSfu.js +0 -78
- package/lib/middlewares/visitors/visitSfuInboundRtpPad.d.ts +0 -5
- package/lib/middlewares/visitors/visitSfuInboundRtpPad.d.ts.map +0 -1
- package/lib/middlewares/visitors/visitSfuInboundRtpPad.js +0 -56
- package/lib/middlewares/visitors/visitSfuOutboundRtpPad.d.ts +0 -5
- package/lib/middlewares/visitors/visitSfuOutboundRtpPad.d.ts.map +0 -1
- package/lib/middlewares/visitors/visitSfuOutboundRtpPad.js +0 -56
- package/lib/middlewares/visitors/visitSfuSctpChannel.d.ts +0 -5
- package/lib/middlewares/visitors/visitSfuSctpChannel.d.ts.map +0 -1
- package/lib/middlewares/visitors/visitSfuSctpChannel.js +0 -55
- package/lib/middlewares/visitors/visitSfuTransport.d.ts +0 -5
- package/lib/middlewares/visitors/visitSfuTransport.d.ts.map +0 -1
- package/lib/middlewares/visitors/visitSfuTransport.js +0 -56
- package/lib/processes/closePeerConnectionProcess.d.ts +0 -10
- package/lib/processes/closePeerConnectionProcess.d.ts.map +0 -1
- package/lib/processes/closePeerConnectionProcess.js +0 -51
- package/lib/processes/detachClientProcess.d.ts +0 -14
- package/lib/processes/detachClientProcess.d.ts.map +0 -1
- package/lib/processes/detachClientProcess.js +0 -106
- package/lib/processes/findRemoteMatches.d.ts +0 -9
- package/lib/processes/findRemoteMatches.d.ts.map +0 -1
- package/lib/processes/findRemoteMatches.js +0 -96
- package/lib/processes/inboundTrackRemoved.d.ts +0 -9
- package/lib/processes/inboundTrackRemoved.d.ts.map +0 -1
- package/lib/processes/inboundTrackRemoved.js +0 -22
- package/lib/processes/joinClientProcess.d.ts +0 -11
- package/lib/processes/joinClientProcess.d.ts.map +0 -1
- package/lib/processes/joinClientProcess.js +0 -120
- package/lib/processes/outboundTrackRemoved.d.ts +0 -9
- package/lib/processes/outboundTrackRemoved.d.ts.map +0 -1
- package/lib/processes/outboundTrackRemoved.js +0 -22
- package/lib/samples/ObservedCall.d.ts +0 -17
- package/lib/samples/ObservedCall.d.ts.map +0 -1
- package/lib/samples/ObservedCall.js +0 -29
- package/lib/samples/ObservedCalls.d.ts +0 -19
- package/lib/samples/ObservedCalls.d.ts.map +0 -1
- package/lib/samples/ObservedCalls.js +0 -113
- package/lib/samples/ObservedClient.d.ts +0 -28
- package/lib/samples/ObservedClient.d.ts.map +0 -1
- package/lib/samples/ObservedClient.js +0 -110
- package/lib/samples/ObservedInboundAudioTrack.d.ts +0 -17
- package/lib/samples/ObservedInboundAudioTrack.d.ts.map +0 -1
- package/lib/samples/ObservedInboundAudioTrack.js +0 -17
- package/lib/samples/ObservedInboundVideoTrack.d.ts +0 -17
- package/lib/samples/ObservedInboundVideoTrack.d.ts.map +0 -1
- package/lib/samples/ObservedInboundVideoTrack.js +0 -17
- package/lib/samples/ObservedOutboundAudioTrack.d.ts +0 -16
- package/lib/samples/ObservedOutboundAudioTrack.d.ts.map +0 -1
- package/lib/samples/ObservedOutboundAudioTrack.js +0 -17
- package/lib/samples/ObservedOutboundVideoTrack.d.ts +0 -16
- package/lib/samples/ObservedOutboundVideoTrack.d.ts.map +0 -1
- package/lib/samples/ObservedOutboundVideoTrack.js +0 -17
- package/lib/samples/ObservedPeerConnection.d.ts +0 -47
- package/lib/samples/ObservedPeerConnection.d.ts.map +0 -1
- package/lib/samples/ObservedPeerConnection.js +0 -130
- package/lib/samples/ObservedSfu.d.ts +0 -27
- package/lib/samples/ObservedSfu.d.ts.map +0 -1
- package/lib/samples/ObservedSfu.js +0 -65
- package/lib/samples/ObservedSfuInboundRtpPad.d.ts +0 -15
- package/lib/samples/ObservedSfuInboundRtpPad.d.ts.map +0 -1
- package/lib/samples/ObservedSfuInboundRtpPad.js +0 -17
- package/lib/samples/ObservedSfuOutboundRtpPad.d.ts +0 -15
- package/lib/samples/ObservedSfuOutboundRtpPad.d.ts.map +0 -1
- package/lib/samples/ObservedSfuOutboundRtpPad.js +0 -17
- package/lib/samples/ObservedSfuSctpChannel.d.ts +0 -15
- package/lib/samples/ObservedSfuSctpChannel.d.ts.map +0 -1
- package/lib/samples/ObservedSfuSctpChannel.js +0 -17
- package/lib/samples/ObservedSfuTransport.d.ts +0 -30
- package/lib/samples/ObservedSfuTransport.d.ts.map +0 -1
- package/lib/samples/ObservedSfuTransport.js +0 -86
- package/lib/samples/ObservedSfus.d.ts +0 -16
- package/lib/samples/ObservedSfus.d.ts.map +0 -1
- package/lib/samples/ObservedSfus.js +0 -72
- package/lib/sinks/ObserverSink.d.ts.map +0 -1
- package/lib/sinks/callEventReports.d.ts.map +0 -1
- package/lib/sources/ObservedCallSource.d.ts +0 -18
- package/lib/sources/ObservedCallSource.d.ts.map +0 -1
- package/lib/sources/ObservedCallSource.js +0 -2
- package/lib/sources/ObservedClientSource.d.ts +0 -19
- package/lib/sources/ObservedClientSource.d.ts.map +0 -1
- package/lib/sources/ObservedClientSource.js +0 -2
- package/lib/sources/ObservedSfuSource.d.ts +0 -15
- package/lib/sources/ObservedSfuSource.d.ts.map +0 -1
- package/lib/sources/ObservedSfuSource.js +0 -2
- package/lib/sources/Sources.d.ts +0 -47
- package/lib/sources/Sources.d.ts.map +0 -1
- package/lib/sources/Sources.js +0 -211
- package/src/Evaluator.ts +0 -229
- package/src/common/Semaphore.ts +0 -45
- package/src/entries/CallEntry.ts +0 -62
- package/src/entries/ClientEntry.ts +0 -106
- package/src/entries/InboundTrackEntry.ts +0 -74
- package/src/entries/OutboundTrackEntry.ts +0 -72
- package/src/entries/PeerConnectionEntry.ts +0 -133
- package/src/entries/SfuEntry.ts +0 -62
- package/src/entries/SfuInboundRtpPadEntry.ts +0 -46
- package/src/entries/SfuOutboundRtpPadEntry.ts +0 -44
- package/src/entries/SfuSctpChannelEntry.ts +0 -39
- package/src/entries/SfuTransportEntry.ts +0 -109
- package/src/evaluators/SetClientsCoordinateEvaluator.ts +0 -78
- package/src/middlewares/CallOperationsContext.ts +0 -56
- package/src/middlewares/CallProcessor.ts +0 -38
- package/src/middlewares/CommitTransactionMiddleware.ts +0 -328
- package/src/middlewares/DeleteOutdatedCallEntries.ts +0 -159
- package/src/middlewares/DeleteOutdatedSfuEntries.ts +0 -168
- package/src/middlewares/Middleware.ts +0 -10
- package/src/middlewares/Processor.ts +0 -59
- package/src/middlewares/TransactionContext.ts +0 -176
- package/src/middlewares/TransactoinProcessor.ts +0 -28
- package/src/middlewares/VisitObservedCallsMiddleware.ts +0 -172
- package/src/middlewares/VisitObservedSfusMiddleware.ts +0 -203
- package/src/middlewares/visitors/visitClient.ts +0 -239
- package/src/middlewares/visitors/visitInboundAudioTrack.ts +0 -113
- package/src/middlewares/visitors/visitInboundVideoTrack.ts +0 -117
- package/src/middlewares/visitors/visitOutboundAudioTrack.ts +0 -100
- package/src/middlewares/visitors/visitOutboundVideoTarck.ts +0 -102
- package/src/middlewares/visitors/visitPeerConnection.ts +0 -151
- package/src/middlewares/visitors/visitSfu.ts +0 -70
- package/src/middlewares/visitors/visitSfuInboundRtpPad.ts +0 -52
- package/src/middlewares/visitors/visitSfuOutboundRtpPad.ts +0 -53
- package/src/middlewares/visitors/visitSfuSctpChannel.ts +0 -50
- package/src/middlewares/visitors/visitSfuTransport.ts +0 -50
- package/src/processes/closePeerConnectionProcess.ts +0 -54
- package/src/processes/detachClientProcess.ts +0 -136
- package/src/processes/findRemoteMatches.ts +0 -104
- package/src/processes/inboundTrackRemoved.ts +0 -22
- package/src/processes/joinClientProcess.ts +0 -138
- package/src/processes/outboundTrackRemoved.ts +0 -22
- package/src/samples/ObservedCall.ts +0 -49
- package/src/samples/ObservedCalls.ts +0 -143
- package/src/samples/ObservedClient.ts +0 -172
- package/src/samples/ObservedInboundAudioTrack.ts +0 -35
- package/src/samples/ObservedInboundVideoTrack.ts +0 -36
- package/src/samples/ObservedOutboundAudioTrack.ts +0 -35
- package/src/samples/ObservedOutboundVideoTrack.ts +0 -35
- package/src/samples/ObservedPeerConnection.ts +0 -227
- package/src/samples/ObservedSfu.ts +0 -115
- package/src/samples/ObservedSfuInboundRtpPad.ts +0 -35
- package/src/samples/ObservedSfuOutboundRtpPad.ts +0 -35
- package/src/samples/ObservedSfuSctpChannel.ts +0 -35
- package/src/samples/ObservedSfuTransport.ts +0 -142
- package/src/samples/ObservedSfus.ts +0 -95
- package/src/sources/ObservedCallSource.ts +0 -26
- package/src/sources/ObservedClientSource.ts +0 -28
- package/src/sources/ObservedSfuSource.ts +0 -19
- package/src/sources/Sources.ts +0 -294
- /package/lib/{sinks → common}/callEventReports.d.ts +0 -0
- /package/lib/{sinks → common}/callEventReports.js +0 -0
- /package/src/{sinks → common}/callEventReports.ts +0 -0
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
import { ClientSample } from '@observertc/sample-schemas-js';
|
|
2
|
-
import { ObservedPeerConnection, ObservedPeerConnectionBuilder } from './ObservedPeerConnection';
|
|
3
|
-
import { ObservedCall } from './ObservedCall';
|
|
4
|
-
|
|
5
|
-
export interface ObservedClient {
|
|
6
|
-
readonly call: ObservedCall;
|
|
7
|
-
|
|
8
|
-
readonly clientId: string;
|
|
9
|
-
readonly mediaUnitId: string;
|
|
10
|
-
|
|
11
|
-
observedPeerConnections(): IterableIterator<ObservedPeerConnection>;
|
|
12
|
-
getObservedPeerConnection(peerConnectionid: string): ObservedPeerConnection | undefined;
|
|
13
|
-
samples(): IterableIterator<ClientSample>;
|
|
14
|
-
|
|
15
|
-
readonly marker?: string;
|
|
16
|
-
readonly userId?: string;
|
|
17
|
-
readonly timeZoneId?: string;
|
|
18
|
-
|
|
19
|
-
minTimestamp: number;
|
|
20
|
-
maxTimestamp: number;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export class ObservedClientBuilder {
|
|
24
|
-
private _minTimestamp?: number;
|
|
25
|
-
private _maxTimestamp?: number;
|
|
26
|
-
private _peerConnections = new Map<string, ObservedPeerConnectionBuilder>();
|
|
27
|
-
private _clientSamples: ClientSample[] = [];
|
|
28
|
-
public constructor(
|
|
29
|
-
private _config: Omit<
|
|
30
|
-
ObservedClient,
|
|
31
|
-
| keyof IterableIterator<ObservedPeerConnection>
|
|
32
|
-
| 'samples'
|
|
33
|
-
| 'call'
|
|
34
|
-
| 'getObservedPeerConnection'
|
|
35
|
-
| 'observedPeerConnections'
|
|
36
|
-
| 'minTimestamp'
|
|
37
|
-
| 'maxTimestamp'
|
|
38
|
-
>
|
|
39
|
-
) {}
|
|
40
|
-
|
|
41
|
-
public addClientSample(clientSample: ClientSample) {
|
|
42
|
-
this._clientSamples.push(clientSample);
|
|
43
|
-
|
|
44
|
-
if (clientSample.pcTransports) {
|
|
45
|
-
for (const pcTransport of clientSample.pcTransports) {
|
|
46
|
-
const builder = this._getOrCreatePcBuilder(pcTransport.peerConnectionId);
|
|
47
|
-
|
|
48
|
-
builder.addTransportSample(pcTransport);
|
|
49
|
-
if (pcTransport.label) {
|
|
50
|
-
builder.peerConnectionLabel = pcTransport.label;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
if (clientSample.iceLocalCandidates) {
|
|
55
|
-
for (const iceLocalCandidate of clientSample.iceLocalCandidates) {
|
|
56
|
-
if (!iceLocalCandidate.peerConnectionId) {
|
|
57
|
-
continue;
|
|
58
|
-
}
|
|
59
|
-
const builder = this._getOrCreatePcBuilder(iceLocalCandidate.peerConnectionId);
|
|
60
|
-
|
|
61
|
-
builder.addIceLocalCandidate(iceLocalCandidate);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
if (clientSample.iceRemoteCandidates) {
|
|
65
|
-
for (const iceRemoteCandidate of clientSample.iceRemoteCandidates) {
|
|
66
|
-
if (!iceRemoteCandidate.peerConnectionId) {
|
|
67
|
-
continue;
|
|
68
|
-
}
|
|
69
|
-
const builder = this._getOrCreatePcBuilder(iceRemoteCandidate.peerConnectionId);
|
|
70
|
-
|
|
71
|
-
builder.addIceRemoveCandidate(iceRemoteCandidate);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
if (clientSample.iceCandidatePairs) {
|
|
75
|
-
for (const iceCandidatePair of clientSample.iceCandidatePairs) {
|
|
76
|
-
const builder = this._getOrCreatePcBuilder(iceCandidatePair.peerConnectionId);
|
|
77
|
-
|
|
78
|
-
builder.addIceCandidatePair(iceCandidatePair);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
if (clientSample.inboundAudioTracks) {
|
|
82
|
-
for (const trackSample of clientSample.inboundAudioTracks) {
|
|
83
|
-
const { trackId, peerConnectionId } = trackSample;
|
|
84
|
-
|
|
85
|
-
if (!trackId || !peerConnectionId) continue;
|
|
86
|
-
|
|
87
|
-
const builder = this._getOrCreatePcBuilder(peerConnectionId);
|
|
88
|
-
|
|
89
|
-
builder.addInboundAudioTrack(trackSample);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
if (clientSample.inboundVideoTracks) {
|
|
94
|
-
for (const trackSample of clientSample.inboundVideoTracks) {
|
|
95
|
-
const { trackId, peerConnectionId } = trackSample;
|
|
96
|
-
|
|
97
|
-
if (!trackId || !peerConnectionId) continue;
|
|
98
|
-
|
|
99
|
-
const builder = this._getOrCreatePcBuilder(peerConnectionId);
|
|
100
|
-
|
|
101
|
-
builder.addInboundVideoTrack(trackSample);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
if (clientSample.outboundAudioTracks) {
|
|
106
|
-
for (const trackSample of clientSample.outboundAudioTracks) {
|
|
107
|
-
const { trackId, peerConnectionId } = trackSample;
|
|
108
|
-
|
|
109
|
-
if (!trackId || !peerConnectionId) continue;
|
|
110
|
-
|
|
111
|
-
const builder = this._getOrCreatePcBuilder(peerConnectionId);
|
|
112
|
-
|
|
113
|
-
builder.addOutboundAudioTrack(trackSample);
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
if (clientSample.outboundVideoTracks) {
|
|
118
|
-
for (const trackSample of clientSample.outboundVideoTracks) {
|
|
119
|
-
const { trackId, peerConnectionId } = trackSample;
|
|
120
|
-
|
|
121
|
-
if (!trackId || !peerConnectionId) continue;
|
|
122
|
-
|
|
123
|
-
const builder = this._getOrCreatePcBuilder(peerConnectionId);
|
|
124
|
-
|
|
125
|
-
builder.addOutboundVideoTrack(trackSample);
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
if (this._minTimestamp === undefined || clientSample.timestamp < this._minTimestamp) {
|
|
130
|
-
this._minTimestamp = clientSample.timestamp;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
if (this._maxTimestamp === undefined || this._maxTimestamp < clientSample.timestamp) {
|
|
134
|
-
this._maxTimestamp = clientSample.timestamp;
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
private _getOrCreatePcBuilder(peerConnectionId: string): ObservedPeerConnectionBuilder {
|
|
139
|
-
let result = this._peerConnections.get(peerConnectionId);
|
|
140
|
-
|
|
141
|
-
if (!result) {
|
|
142
|
-
result = new ObservedPeerConnectionBuilder({
|
|
143
|
-
peerConnectionId,
|
|
144
|
-
});
|
|
145
|
-
this._peerConnections.set(peerConnectionId, result);
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
return result;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
public build(call: ObservedCall): ObservedClient {
|
|
152
|
-
const observedPeerConnections = new Map<string, ObservedPeerConnection>();
|
|
153
|
-
|
|
154
|
-
const result: ObservedClient = {
|
|
155
|
-
call,
|
|
156
|
-
...this._config,
|
|
157
|
-
minTimestamp: this._minTimestamp ?? Date.now(),
|
|
158
|
-
maxTimestamp: this._maxTimestamp ?? Date.now(),
|
|
159
|
-
samples: () => this._clientSamples.values(),
|
|
160
|
-
observedPeerConnections: () => observedPeerConnections.values(),
|
|
161
|
-
getObservedPeerConnection: (pcId: string) => observedPeerConnections.get(pcId),
|
|
162
|
-
};
|
|
163
|
-
|
|
164
|
-
for (const builder of this._peerConnections.values()) {
|
|
165
|
-
const observedPeerConnection = builder.build(result);
|
|
166
|
-
|
|
167
|
-
observedPeerConnections.set(observedPeerConnection.peerConnectionId, observedPeerConnection);
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
return result;
|
|
171
|
-
}
|
|
172
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { InboundAudioTrack } from '@observertc/sample-schemas-js';
|
|
2
|
-
import { ObservedPeerConnection } from './ObservedPeerConnection';
|
|
3
|
-
|
|
4
|
-
export interface ObservedInboundAudioTrack {
|
|
5
|
-
readonly peerConnection: ObservedPeerConnection;
|
|
6
|
-
readonly trackId: string;
|
|
7
|
-
readonly sfuStreamId?: string,
|
|
8
|
-
readonly sfuSinkId?: string,
|
|
9
|
-
|
|
10
|
-
samples(): IterableIterator<InboundAudioTrack>;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export class ObservedInboundAudioTrackBuilder {
|
|
14
|
-
private _trackSamples: InboundAudioTrack[] = [];
|
|
15
|
-
public constructor(
|
|
16
|
-
private _config: Omit<
|
|
17
|
-
ObservedInboundAudioTrack,
|
|
18
|
-
keyof IterableIterator<ObservedPeerConnection> | 'peerConnection' | 'samples'
|
|
19
|
-
>
|
|
20
|
-
) {}
|
|
21
|
-
|
|
22
|
-
public addSample(inboundAudioTrack: InboundAudioTrack) {
|
|
23
|
-
this._trackSamples.push(inboundAudioTrack);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
public build(peerConnection: ObservedPeerConnection): ObservedInboundAudioTrack {
|
|
27
|
-
const result: ObservedInboundAudioTrack = {
|
|
28
|
-
peerConnection,
|
|
29
|
-
...this._config,
|
|
30
|
-
samples: () => this._trackSamples.values(),
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
return result;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { InboundVideoTrack } from '@observertc/sample-schemas-js';
|
|
2
|
-
import { ObservedPeerConnection } from './ObservedPeerConnection';
|
|
3
|
-
|
|
4
|
-
export interface ObservedInboundVideoTrack {
|
|
5
|
-
readonly peerConnection: ObservedPeerConnection;
|
|
6
|
-
readonly trackId: string;
|
|
7
|
-
readonly sfuStreamId?: string,
|
|
8
|
-
readonly sfuSinkId?: string,
|
|
9
|
-
|
|
10
|
-
samples(): IterableIterator<InboundVideoTrack>;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export class ObservedInboundVideoTrackBuilder {
|
|
14
|
-
private _trackSamples: InboundVideoTrack[] = [];
|
|
15
|
-
|
|
16
|
-
public constructor(
|
|
17
|
-
private _config: Omit<
|
|
18
|
-
ObservedInboundVideoTrack,
|
|
19
|
-
keyof IterableIterator<ObservedPeerConnection> | 'peerConnection' | 'samples'
|
|
20
|
-
>
|
|
21
|
-
) {}
|
|
22
|
-
|
|
23
|
-
public addSample(inboundVideoTrack: InboundVideoTrack) {
|
|
24
|
-
this._trackSamples.push(inboundVideoTrack);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
public build(peerConnection: ObservedPeerConnection): ObservedInboundVideoTrack {
|
|
28
|
-
const result: ObservedInboundVideoTrack = {
|
|
29
|
-
peerConnection,
|
|
30
|
-
...this._config,
|
|
31
|
-
samples: () => this._trackSamples.values(),
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
return result;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { OutboundAudioTrack } from '@observertc/sample-schemas-js';
|
|
2
|
-
import { ObservedPeerConnection } from './ObservedPeerConnection';
|
|
3
|
-
|
|
4
|
-
export interface ObservedOutboundAudioTrack {
|
|
5
|
-
readonly peerConnection: ObservedPeerConnection;
|
|
6
|
-
readonly trackId: string;
|
|
7
|
-
readonly sfuStreamId?: string,
|
|
8
|
-
|
|
9
|
-
samples(): IterableIterator<OutboundAudioTrack>;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export class ObservedOutboundAudioTrackBuilder {
|
|
13
|
-
private _trackSamples: OutboundAudioTrack[] = [];
|
|
14
|
-
|
|
15
|
-
public constructor(
|
|
16
|
-
private _config: Omit<
|
|
17
|
-
ObservedOutboundAudioTrack,
|
|
18
|
-
keyof IterableIterator<ObservedPeerConnection> | 'peerConnection' | 'samples'
|
|
19
|
-
>
|
|
20
|
-
) {}
|
|
21
|
-
|
|
22
|
-
public addSample(outboundAudioTrack: OutboundAudioTrack) {
|
|
23
|
-
this._trackSamples.push(outboundAudioTrack);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
public build(peerConnection: ObservedPeerConnection): ObservedOutboundAudioTrack {
|
|
27
|
-
const result: ObservedOutboundAudioTrack = {
|
|
28
|
-
peerConnection,
|
|
29
|
-
...this._config,
|
|
30
|
-
samples: () => this._trackSamples.values(),
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
return result;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { OutboundVideoTrack } from '@observertc/sample-schemas-js';
|
|
2
|
-
import { ObservedPeerConnection } from './ObservedPeerConnection';
|
|
3
|
-
|
|
4
|
-
export interface ObservedOutboundVideoTrack {
|
|
5
|
-
readonly peerConnection: ObservedPeerConnection;
|
|
6
|
-
readonly trackId: string;
|
|
7
|
-
readonly sfuStreamId?: string,
|
|
8
|
-
|
|
9
|
-
samples(): IterableIterator<OutboundVideoTrack>;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export class ObservedOutboundVideoTrackBuilder {
|
|
13
|
-
private _trackSamples: OutboundVideoTrack[] = [];
|
|
14
|
-
|
|
15
|
-
public constructor(
|
|
16
|
-
private _config: Omit<
|
|
17
|
-
ObservedOutboundVideoTrack,
|
|
18
|
-
keyof IterableIterator<ObservedPeerConnection> | 'peerConnection' | 'samples'
|
|
19
|
-
>
|
|
20
|
-
) {}
|
|
21
|
-
|
|
22
|
-
public addSample(outboundVideoTrack: OutboundVideoTrack) {
|
|
23
|
-
this._trackSamples.push(outboundVideoTrack);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
public build(peerConnection: ObservedPeerConnection): ObservedOutboundVideoTrack {
|
|
27
|
-
const result: ObservedOutboundVideoTrack = {
|
|
28
|
-
peerConnection,
|
|
29
|
-
...this._config,
|
|
30
|
-
samples: () => this._trackSamples.values(),
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
return result;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
@@ -1,227 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
IceCandidatePair,
|
|
3
|
-
IceLocalCandidate,
|
|
4
|
-
IceRemoteCandidate,
|
|
5
|
-
InboundAudioTrack,
|
|
6
|
-
InboundVideoTrack,
|
|
7
|
-
OutboundAudioTrack,
|
|
8
|
-
OutboundVideoTrack,
|
|
9
|
-
PeerConnectionTransport,
|
|
10
|
-
} from '@observertc/sample-schemas-js';
|
|
11
|
-
import { ObservedClient } from './ObservedClient';
|
|
12
|
-
import { ObservedInboundAudioTrack, ObservedInboundAudioTrackBuilder } from './ObservedInboundAudioTrack';
|
|
13
|
-
import { ObservedInboundVideoTrack, ObservedInboundVideoTrackBuilder } from './ObservedInboundVideoTrack';
|
|
14
|
-
import { ObservedOutboundAudioTrack, ObservedOutboundAudioTrackBuilder } from './ObservedOutboundAudioTrack';
|
|
15
|
-
import { ObservedOutboundVideoTrack, ObservedOutboundVideoTrackBuilder } from './ObservedOutboundVideoTrack';
|
|
16
|
-
|
|
17
|
-
export interface ObservedPeerConnection {
|
|
18
|
-
readonly client: ObservedClient;
|
|
19
|
-
peerConnectionLabel?: string;
|
|
20
|
-
readonly peerConnectionId: string;
|
|
21
|
-
|
|
22
|
-
inboundAudioTracks(): IterableIterator<ObservedInboundAudioTrack>;
|
|
23
|
-
inboundVideoTracks(): IterableIterator<ObservedInboundVideoTrack>;
|
|
24
|
-
outboundAudioTracks(): IterableIterator<ObservedOutboundAudioTrack>;
|
|
25
|
-
outboundVideoTracks(): IterableIterator<ObservedOutboundVideoTrack>;
|
|
26
|
-
|
|
27
|
-
transportSamples(): IterableIterator<PeerConnectionTransport>;
|
|
28
|
-
iceCandidatePairs(): IterableIterator<IceCandidatePair>;
|
|
29
|
-
iceRemoteCandidates(): IterableIterator<IceRemoteCandidate>;
|
|
30
|
-
iceLocalCandidates(): IterableIterator<IceLocalCandidate>;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export class ObservedPeerConnectionBuilder {
|
|
34
|
-
private _inboundAudioTracks = new Map<string, ObservedInboundAudioTrackBuilder>();
|
|
35
|
-
private _inboundVideoTracks = new Map<string, ObservedInboundVideoTrackBuilder>();
|
|
36
|
-
private _outboundAudioTracks = new Map<string, ObservedOutboundAudioTrackBuilder>();
|
|
37
|
-
private _outboundVideoTracks = new Map<string, ObservedOutboundVideoTrackBuilder>();
|
|
38
|
-
private _transportSamples: PeerConnectionTransport[] = [];
|
|
39
|
-
private _iceCandidatePairs: IceCandidatePair[] = [];
|
|
40
|
-
private _iceRemoteCandidates: IceRemoteCandidate[] = [];
|
|
41
|
-
private _iceLocalCandidates: IceLocalCandidate[] = [];
|
|
42
|
-
private _peerConnectionLabel?: string;
|
|
43
|
-
public constructor(
|
|
44
|
-
private _config: Omit<
|
|
45
|
-
ObservedPeerConnection,
|
|
46
|
-
| keyof IterableIterator<ObservedPeerConnection>
|
|
47
|
-
| 'client'
|
|
48
|
-
| 'inboundAudioTracks'
|
|
49
|
-
| 'inboundVideoTracks'
|
|
50
|
-
| 'outboundAudioTracks'
|
|
51
|
-
| 'outboundVideoTracks'
|
|
52
|
-
| 'transportSamples'
|
|
53
|
-
| 'iceCandidatePairs'
|
|
54
|
-
| 'iceRemoteCandidates'
|
|
55
|
-
| 'iceLocalCandidates'
|
|
56
|
-
>
|
|
57
|
-
) {}
|
|
58
|
-
|
|
59
|
-
public set peerConnectionLabel(value: string) {
|
|
60
|
-
this._peerConnectionLabel = value;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
public addTransportSample(transportSample: PeerConnectionTransport) {
|
|
64
|
-
this._transportSamples.push(transportSample);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
public addInboundAudioTrack(inboundAudioTrackSample: InboundAudioTrack) {
|
|
68
|
-
if (inboundAudioTrackSample.trackId) {
|
|
69
|
-
const builder = this._getInboundAudioTrackBuilder(
|
|
70
|
-
inboundAudioTrackSample.trackId,
|
|
71
|
-
inboundAudioTrackSample.sfuStreamId,
|
|
72
|
-
inboundAudioTrackSample.sfuSinkId
|
|
73
|
-
);
|
|
74
|
-
|
|
75
|
-
builder.addSample(inboundAudioTrackSample);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
public addIceCandidatePair(iceCandidatePair: IceCandidatePair) {
|
|
80
|
-
this._iceCandidatePairs.push(iceCandidatePair);
|
|
81
|
-
}
|
|
82
|
-
public addIceRemoveCandidate(iceRemoteCandidate: IceRemoteCandidate) {
|
|
83
|
-
this._iceRemoteCandidates.push(iceRemoteCandidate);
|
|
84
|
-
}
|
|
85
|
-
public addIceLocalCandidate(iceLocalCandidate: IceLocalCandidate) {
|
|
86
|
-
this._iceLocalCandidates.push(iceLocalCandidate);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
private _getInboundAudioTrackBuilder(trackId: string, sfuStreamId?: string, sfuSinkId?: string): ObservedInboundAudioTrackBuilder {
|
|
90
|
-
let result = this._inboundAudioTracks.get(trackId);
|
|
91
|
-
|
|
92
|
-
if (!result) {
|
|
93
|
-
result = new ObservedInboundAudioTrackBuilder({
|
|
94
|
-
trackId,
|
|
95
|
-
sfuStreamId,
|
|
96
|
-
sfuSinkId,
|
|
97
|
-
});
|
|
98
|
-
this._inboundAudioTracks.set(trackId, result);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
return result;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
public addOutboundAudioTrack(outboundAudioTrackSample: OutboundAudioTrack) {
|
|
105
|
-
if (outboundAudioTrackSample.trackId) {
|
|
106
|
-
const builder = this._getOutboundAudioTrackBuilder(
|
|
107
|
-
outboundAudioTrackSample.trackId,
|
|
108
|
-
outboundAudioTrackSample.sfuStreamId,
|
|
109
|
-
);
|
|
110
|
-
|
|
111
|
-
builder.addSample(outboundAudioTrackSample);
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
private _getOutboundAudioTrackBuilder(trackId: string, sfuStreamId?: string): ObservedOutboundAudioTrackBuilder {
|
|
116
|
-
let result = this._outboundAudioTracks.get(trackId);
|
|
117
|
-
|
|
118
|
-
if (!result) {
|
|
119
|
-
result = new ObservedOutboundAudioTrackBuilder({
|
|
120
|
-
trackId,
|
|
121
|
-
sfuStreamId
|
|
122
|
-
});
|
|
123
|
-
this._outboundAudioTracks.set(trackId, result);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
return result;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
public addInboundVideoTrack(inboundVideoTrackSample: InboundVideoTrack) {
|
|
130
|
-
if (inboundVideoTrackSample.trackId) {
|
|
131
|
-
const builder = this._getInboundVideoTrackBuilder(
|
|
132
|
-
inboundVideoTrackSample.trackId,
|
|
133
|
-
inboundVideoTrackSample.sfuStreamId,
|
|
134
|
-
inboundVideoTrackSample.sfuSinkId,
|
|
135
|
-
);
|
|
136
|
-
|
|
137
|
-
builder.addSample(inboundVideoTrackSample);
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
private _getInboundVideoTrackBuilder(trackId: string, sfuStreamId?: string, sfuSinkId?: string): ObservedInboundVideoTrackBuilder {
|
|
142
|
-
let result = this._inboundVideoTracks.get(trackId);
|
|
143
|
-
|
|
144
|
-
if (!result) {
|
|
145
|
-
result = new ObservedInboundVideoTrackBuilder({
|
|
146
|
-
trackId,
|
|
147
|
-
sfuStreamId,
|
|
148
|
-
sfuSinkId,
|
|
149
|
-
});
|
|
150
|
-
this._inboundVideoTracks.set(trackId, result);
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
return result;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
public addOutboundVideoTrack(outboundVideoTrackSample: OutboundVideoTrack) {
|
|
157
|
-
if (outboundVideoTrackSample.trackId) {
|
|
158
|
-
const builder = this._getOutboundVideoTrackBuilder(
|
|
159
|
-
outboundVideoTrackSample.trackId,
|
|
160
|
-
outboundVideoTrackSample.sfuStreamId,
|
|
161
|
-
);
|
|
162
|
-
|
|
163
|
-
builder.addSample(outboundVideoTrackSample);
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
private _getOutboundVideoTrackBuilder(trackId: string, sfuStreamId?: string): ObservedOutboundVideoTrackBuilder {
|
|
168
|
-
let result = this._outboundVideoTracks.get(trackId);
|
|
169
|
-
|
|
170
|
-
if (!result) {
|
|
171
|
-
result = new ObservedOutboundVideoTrackBuilder({
|
|
172
|
-
trackId,
|
|
173
|
-
sfuStreamId,
|
|
174
|
-
});
|
|
175
|
-
this._outboundVideoTracks.set(trackId, result);
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
return result;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
public build(client: ObservedClient): ObservedPeerConnection {
|
|
182
|
-
const inboundAudioTracks = new Map<string, ObservedInboundAudioTrack>();
|
|
183
|
-
const outboundAudioTracks = new Map<string, ObservedOutboundAudioTrack>();
|
|
184
|
-
const inboundVideoTracks = new Map<string, ObservedInboundVideoTrack>();
|
|
185
|
-
const outboundVideoTracks = new Map<string, ObservedOutboundVideoTrack>();
|
|
186
|
-
|
|
187
|
-
const result: ObservedPeerConnection = {
|
|
188
|
-
client,
|
|
189
|
-
...this._config,
|
|
190
|
-
transportSamples: () => this._transportSamples.values(),
|
|
191
|
-
iceCandidatePairs: () => this._iceCandidatePairs.values(),
|
|
192
|
-
iceLocalCandidates: () => this._iceLocalCandidates.values(),
|
|
193
|
-
iceRemoteCandidates: () => this._iceRemoteCandidates.values(),
|
|
194
|
-
|
|
195
|
-
inboundAudioTracks: () => inboundAudioTracks.values(),
|
|
196
|
-
outboundAudioTracks: () => outboundAudioTracks.values(),
|
|
197
|
-
inboundVideoTracks: () => inboundVideoTracks.values(),
|
|
198
|
-
outboundVideoTracks: () => outboundVideoTracks.values(),
|
|
199
|
-
};
|
|
200
|
-
|
|
201
|
-
for (const builder of this._inboundAudioTracks.values()) {
|
|
202
|
-
const observedInboundAudioTrack = builder.build(result);
|
|
203
|
-
|
|
204
|
-
inboundAudioTracks.set(observedInboundAudioTrack.trackId, observedInboundAudioTrack);
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
for (const builder of this._outboundAudioTracks.values()) {
|
|
208
|
-
const observedOutboundAudioTrack = builder.build(result);
|
|
209
|
-
|
|
210
|
-
outboundAudioTracks.set(observedOutboundAudioTrack.trackId, observedOutboundAudioTrack);
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
for (const builder of this._inboundVideoTracks.values()) {
|
|
214
|
-
const observedInboundVideoTrack = builder.build(result);
|
|
215
|
-
|
|
216
|
-
inboundVideoTracks.set(observedInboundVideoTrack.trackId, observedInboundVideoTrack);
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
for (const builder of this._outboundVideoTracks.values()) {
|
|
220
|
-
const observedOutboundVideoTrack = builder.build(result);
|
|
221
|
-
|
|
222
|
-
outboundVideoTracks.set(observedOutboundVideoTrack.trackId, observedOutboundVideoTrack);
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
return result;
|
|
226
|
-
}
|
|
227
|
-
}
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
import { SfuSample } from '@observertc/sample-schemas-js';
|
|
2
|
-
import { ObservedPeerConnection } from './ObservedPeerConnection';
|
|
3
|
-
import { ObservedSfuTransport, ObservedSfuTransportBuilder } from './ObservedSfuTransport';
|
|
4
|
-
|
|
5
|
-
export interface ObservedSfu {
|
|
6
|
-
readonly serviceId: string;
|
|
7
|
-
readonly sfuId: string;
|
|
8
|
-
readonly mediaUnitId: string;
|
|
9
|
-
|
|
10
|
-
observedSfuTransports(): IterableIterator<ObservedSfuTransport>;
|
|
11
|
-
getObservedSfuTransport(sfuId: string): ObservedSfuTransport | undefined;
|
|
12
|
-
samples(): IterableIterator<SfuSample>;
|
|
13
|
-
|
|
14
|
-
readonly marker?: string;
|
|
15
|
-
readonly timeZoneId?: string;
|
|
16
|
-
|
|
17
|
-
minTimestamp: number;
|
|
18
|
-
maxTimestamp: number;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export class ObservedSfuBuilder {
|
|
22
|
-
private _minTimestamp?: number;
|
|
23
|
-
private _maxTimestamp?: number;
|
|
24
|
-
private _sfuTransports = new Map<string, ObservedSfuTransportBuilder>();
|
|
25
|
-
private _sfuSamples: SfuSample[] = [];
|
|
26
|
-
public constructor(
|
|
27
|
-
private _config: Omit<
|
|
28
|
-
ObservedSfu,
|
|
29
|
-
| keyof IterableIterator<ObservedPeerConnection>
|
|
30
|
-
| 'samples'
|
|
31
|
-
| 'observedSfuTransports'
|
|
32
|
-
| 'getObservedSfuTransport'
|
|
33
|
-
| 'minTimestamp'
|
|
34
|
-
| 'maxTimestamp'
|
|
35
|
-
>
|
|
36
|
-
) {}
|
|
37
|
-
|
|
38
|
-
public addSfuSample(sfuSample: SfuSample) {
|
|
39
|
-
this._sfuSamples.push(sfuSample);
|
|
40
|
-
|
|
41
|
-
if (sfuSample.transports) {
|
|
42
|
-
for (const sfuTransport of sfuSample.transports) {
|
|
43
|
-
const builder = this._getOrCreateSfuTransportBuilder(sfuTransport.transportId);
|
|
44
|
-
|
|
45
|
-
builder.addTransportSample(sfuTransport);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
if (sfuSample.inboundRtpPads) {
|
|
50
|
-
for (const inboundRtpPad of sfuSample.inboundRtpPads) {
|
|
51
|
-
const builder = this._getOrCreateSfuTransportBuilder(inboundRtpPad.transportId);
|
|
52
|
-
|
|
53
|
-
builder.addSfuInboundRtpPad(inboundRtpPad);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
if (sfuSample.outboundRtpPads) {
|
|
58
|
-
for (const outboundRtpPad of sfuSample.outboundRtpPads) {
|
|
59
|
-
const builder = this._getOrCreateSfuTransportBuilder(outboundRtpPad.transportId);
|
|
60
|
-
|
|
61
|
-
builder.addSfuOutboundRtpPad(outboundRtpPad);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
if (sfuSample.sctpChannels) {
|
|
66
|
-
for (const sctpChannel of sfuSample.sctpChannels) {
|
|
67
|
-
const builder = this._getOrCreateSfuTransportBuilder(sctpChannel.transportId);
|
|
68
|
-
|
|
69
|
-
builder.addSfuSctpChannel(sctpChannel);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
if (this._minTimestamp === undefined || sfuSample.timestamp < this._minTimestamp) {
|
|
74
|
-
this._minTimestamp = sfuSample.timestamp;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
if (this._maxTimestamp === undefined || this._maxTimestamp < sfuSample.timestamp) {
|
|
78
|
-
this._maxTimestamp = sfuSample.timestamp;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
private _getOrCreateSfuTransportBuilder(transportId: string): ObservedSfuTransportBuilder {
|
|
83
|
-
let result = this._sfuTransports.get(transportId);
|
|
84
|
-
|
|
85
|
-
if (!result) {
|
|
86
|
-
result = new ObservedSfuTransportBuilder({
|
|
87
|
-
transportId,
|
|
88
|
-
});
|
|
89
|
-
this._sfuTransports.set(transportId, result);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
return result;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
public build(): ObservedSfu {
|
|
96
|
-
const observedSfuTransports = new Map<string, ObservedSfuTransport>();
|
|
97
|
-
|
|
98
|
-
const result: ObservedSfu = {
|
|
99
|
-
...this._config,
|
|
100
|
-
minTimestamp: this._minTimestamp ?? Date.now(),
|
|
101
|
-
maxTimestamp: this._maxTimestamp ?? Date.now(),
|
|
102
|
-
samples: () => this._sfuSamples.values(),
|
|
103
|
-
observedSfuTransports: () => observedSfuTransports.values(),
|
|
104
|
-
getObservedSfuTransport: (transportId: string) => observedSfuTransports.get(transportId),
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
for (const builder of this._sfuTransports.values()) {
|
|
108
|
-
const observedSfuTransport = builder.build(result);
|
|
109
|
-
|
|
110
|
-
observedSfuTransports.set(observedSfuTransport.transportId, observedSfuTransport);
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
return result;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { SfuInboundRtpPad } from '@observertc/sample-schemas-js';
|
|
2
|
-
import { ObservedSfuTransport } from './ObservedSfuTransport';
|
|
3
|
-
|
|
4
|
-
export interface ObservedSfuInboundRtpPad {
|
|
5
|
-
readonly sfuTransport: ObservedSfuTransport;
|
|
6
|
-
readonly padId: string;
|
|
7
|
-
|
|
8
|
-
samples(): IterableIterator<SfuInboundRtpPad>;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export class ObservedSfuInboundRtpPadBuilder {
|
|
12
|
-
private _samples: SfuInboundRtpPad[] = [];
|
|
13
|
-
public constructor(
|
|
14
|
-
private _config: Omit<
|
|
15
|
-
ObservedSfuInboundRtpPad,
|
|
16
|
-
| keyof IterableIterator<SfuInboundRtpPad>
|
|
17
|
-
| 'sfuTransport'
|
|
18
|
-
| 'samples'
|
|
19
|
-
>
|
|
20
|
-
) {}
|
|
21
|
-
|
|
22
|
-
public addSample(sfuInboundRtpPad: SfuInboundRtpPad) {
|
|
23
|
-
this._samples.push(sfuInboundRtpPad);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
public build(sfuTransport: ObservedSfuTransport): ObservedSfuInboundRtpPad {
|
|
27
|
-
const result: ObservedSfuInboundRtpPad = {
|
|
28
|
-
sfuTransport,
|
|
29
|
-
...this._config,
|
|
30
|
-
samples: () => this._samples.values(),
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
return result;
|
|
34
|
-
}
|
|
35
|
-
}
|