@observertc/observer-js 0.9.27-beta → 0.30.0-e12fcb4.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/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 -49
- package/lib/sources/Sources.d.ts.map +0 -1
- package/lib/sources/Sources.js +0 -213
- 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 -301
- /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,203 +0,0 @@
|
|
|
1
|
-
import { Middleware } from './Middleware';
|
|
2
|
-
import { TransactionContext } from './TransactionContext';
|
|
3
|
-
import { ReportsCollector } from '../common/ReportsCollector';
|
|
4
|
-
import { createLogger } from '../common/logger';
|
|
5
|
-
import { visitSfu } from './visitors/visitSfu';
|
|
6
|
-
import { visitSfuTransport } from './visitors/visitSfuTransport';
|
|
7
|
-
import { visitSfuInboundRtpPad } from './visitors/visitSfuInboundRtpPad';
|
|
8
|
-
import { visitSfuOutboundRtpPad } from './visitors/visitSfuOutboundRtpPad';
|
|
9
|
-
import { visitSfuSctpChannel } from './visitors/visitSfuSctpChannel';
|
|
10
|
-
|
|
11
|
-
export const logger = createLogger('VisitObservedCallsMiddleware');
|
|
12
|
-
|
|
13
|
-
export function createVisitObservedSfusMiddleware(
|
|
14
|
-
reports: ReportsCollector,
|
|
15
|
-
fetchSamples: boolean
|
|
16
|
-
): Middleware<TransactionContext> {
|
|
17
|
-
const process = (transaction: TransactionContext) => {
|
|
18
|
-
const {
|
|
19
|
-
observedSfus,
|
|
20
|
-
updatedSfus,
|
|
21
|
-
deletedSfus,
|
|
22
|
-
|
|
23
|
-
updatedSfuTransports,
|
|
24
|
-
deletedSfuTransports,
|
|
25
|
-
|
|
26
|
-
updatedSfuInboundRtpPads,
|
|
27
|
-
deletedSfuInboundRtpPads,
|
|
28
|
-
|
|
29
|
-
updatedSfuOutboundRtpPads,
|
|
30
|
-
deletedSfuOutboundRtpPads,
|
|
31
|
-
|
|
32
|
-
updatedSfuSctpChannels,
|
|
33
|
-
deletedSfuSctpChannels
|
|
34
|
-
|
|
35
|
-
} = transaction;
|
|
36
|
-
|
|
37
|
-
const visitedSfuIds = new Set<string>();
|
|
38
|
-
const visitedSfuTransportIds = new Set<string>();
|
|
39
|
-
const visitedSfuInboundRtpPadIds = new Set<string>();
|
|
40
|
-
const visitedSfuOutboundRtpPadIds = new Set<string>();
|
|
41
|
-
const visitedSfuSctpChannels = new Set<string>();
|
|
42
|
-
|
|
43
|
-
for (const observedSfu of observedSfus.observedSfus()) {
|
|
44
|
-
const { sfuId } = observedSfu;
|
|
45
|
-
|
|
46
|
-
visitSfu(observedSfu, updatedSfus, reports, fetchSamples);
|
|
47
|
-
|
|
48
|
-
visitedSfuIds.add(sfuId);
|
|
49
|
-
const storedSfu = updatedSfus.get(sfuId);
|
|
50
|
-
|
|
51
|
-
if (!storedSfu) {
|
|
52
|
-
continue;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
for (const observedSfuTransport of observedSfu.observedSfuTransports()) {
|
|
56
|
-
const { transportId } = observedSfuTransport;
|
|
57
|
-
|
|
58
|
-
visitSfuTransport(observedSfuTransport, storedSfu, updatedSfuTransports, reports, fetchSamples);
|
|
59
|
-
|
|
60
|
-
visitedSfuTransportIds.add(transportId);
|
|
61
|
-
const storedSfuTransport = updatedSfuTransports.get(transportId);
|
|
62
|
-
|
|
63
|
-
if (!storedSfuTransport) {
|
|
64
|
-
continue;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
for (const sfuInboundRtpPad of observedSfuTransport.inboundRtpPads()) {
|
|
68
|
-
visitSfuInboundRtpPad(sfuInboundRtpPad, storedSfuTransport, updatedSfuInboundRtpPads, reports, fetchSamples);
|
|
69
|
-
|
|
70
|
-
visitedSfuInboundRtpPadIds.add(sfuInboundRtpPad.padId);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
for (const sfuOutboundRtpPad of observedSfuTransport.outboundRtpPads()) {
|
|
74
|
-
visitSfuOutboundRtpPad(sfuOutboundRtpPad, storedSfuTransport, updatedSfuOutboundRtpPads, reports, fetchSamples);
|
|
75
|
-
|
|
76
|
-
visitedSfuInboundRtpPadIds.add(sfuOutboundRtpPad.padId);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
for (const sfuSctpChannel of observedSfuTransport.sfuSctpChannels()) {
|
|
80
|
-
visitSfuSctpChannel(sfuSctpChannel, storedSfuTransport, updatedSfuSctpChannels, reports, fetchSamples);
|
|
81
|
-
|
|
82
|
-
visitedSfuSctpChannels.add(sfuSctpChannel.channelId);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
for (const [ sfuId, sfu ] of Array.from(updatedSfus.entries())) {
|
|
88
|
-
|
|
89
|
-
if (visitedSfuIds.has(sfuId)) {
|
|
90
|
-
continue;
|
|
91
|
-
}
|
|
92
|
-
deletedSfus.add(sfuId);
|
|
93
|
-
|
|
94
|
-
if (sfu.serviceId && sfu.mediaUnitId) {
|
|
95
|
-
reports.addSfuEventReport({
|
|
96
|
-
serviceId: sfu.serviceId,
|
|
97
|
-
mediaUnitId: sfu.mediaUnitId,
|
|
98
|
-
name: 'SFU_LEFT',
|
|
99
|
-
sfuId,
|
|
100
|
-
timestamp: Date.now(),
|
|
101
|
-
marker: sfu.marker,
|
|
102
|
-
message: 'SFU is detached',
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
for (const [ sfuTransportId, sfuTransport ] of Array.from(updatedSfuTransports.entries())) {
|
|
108
|
-
if (visitedSfuTransportIds.has(sfuTransportId)) {
|
|
109
|
-
continue;
|
|
110
|
-
}
|
|
111
|
-
// delete PeerConnection
|
|
112
|
-
const { serviceId, sfuId, transportId } = sfuTransport;
|
|
113
|
-
|
|
114
|
-
if (!serviceId || !sfuId || !transportId) {
|
|
115
|
-
continue;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
const storedSfu = updatedSfus.get(sfuId);
|
|
119
|
-
|
|
120
|
-
updatedSfuTransports.delete(transportId);
|
|
121
|
-
deletedSfuTransports.add(transportId);
|
|
122
|
-
|
|
123
|
-
// also update the peer connection model
|
|
124
|
-
if (storedSfu) {
|
|
125
|
-
storedSfu.sfuTransportIds = storedSfu.sfuTransportIds.filter((tId) => tId !== transportId);
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
for (const [ padId, sfuInboundRtpPad ] of Array.from(updatedSfuInboundRtpPads.entries())) {
|
|
130
|
-
if (visitedSfuInboundRtpPadIds.has(padId)) {
|
|
131
|
-
continue;
|
|
132
|
-
}
|
|
133
|
-
// delete Sfu Inbound Rtp Pad
|
|
134
|
-
const { serviceId, rtpPadId, sfuTransportId } = sfuInboundRtpPad;
|
|
135
|
-
|
|
136
|
-
if (!serviceId || !sfuTransportId || !rtpPadId) {
|
|
137
|
-
continue;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
const storedSfuTransport = updatedSfuTransports.get(sfuTransportId);
|
|
141
|
-
|
|
142
|
-
updatedSfuInboundRtpPads.delete(rtpPadId);
|
|
143
|
-
deletedSfuInboundRtpPads.add(rtpPadId);
|
|
144
|
-
|
|
145
|
-
// also update the sfu transport model
|
|
146
|
-
if (storedSfuTransport) {
|
|
147
|
-
storedSfuTransport.inboundRtpPadIds = storedSfuTransport.inboundRtpPadIds.filter((tId) => tId !== rtpPadId);
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
for (const [ padId, sfuOutboundRtpPad ] of Array.from(updatedSfuOutboundRtpPads.entries())) {
|
|
152
|
-
if (visitedSfuOutboundRtpPadIds.has(padId)) {
|
|
153
|
-
continue;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
// delete Sfu Outbound Rtp Pad
|
|
157
|
-
const { serviceId, rtpPadId, sfuTransportId } = sfuOutboundRtpPad;
|
|
158
|
-
|
|
159
|
-
if (!serviceId || !sfuTransportId || !rtpPadId) {
|
|
160
|
-
continue;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
const storedSfuTransport = updatedSfuTransports.get(sfuTransportId);
|
|
164
|
-
|
|
165
|
-
updatedSfuOutboundRtpPads.delete(rtpPadId);
|
|
166
|
-
deletedSfuOutboundRtpPads.add(rtpPadId);
|
|
167
|
-
|
|
168
|
-
// also update the sfu transport model
|
|
169
|
-
if (storedSfuTransport) {
|
|
170
|
-
storedSfuTransport.outboundRtpPadIds = storedSfuTransport.outboundRtpPadIds.filter((tId) => tId !== rtpPadId);
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
for (const [ channelId, sfuSctpChannel ] of Array.from(updatedSfuSctpChannels.entries())) {
|
|
175
|
-
if (visitedSfuSctpChannels.has(channelId)) {
|
|
176
|
-
continue;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
// delete Sfu Outbound Rtp Pad
|
|
180
|
-
const { serviceId, sfuSctpChannelId, sfuTransportId } = sfuSctpChannel;
|
|
181
|
-
|
|
182
|
-
if (!serviceId || !sfuTransportId || !sfuSctpChannelId) {
|
|
183
|
-
continue;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
const storedSfuTransport = updatedSfuTransports.get(sfuTransportId);
|
|
187
|
-
|
|
188
|
-
updatedSfuSctpChannels.delete(sfuSctpChannelId);
|
|
189
|
-
deletedSfuSctpChannels.add(sfuSctpChannelId);
|
|
190
|
-
|
|
191
|
-
// also update the sfu transport model
|
|
192
|
-
if (storedSfuTransport) {
|
|
193
|
-
storedSfuTransport.sctpChannelIds = storedSfuTransport.sctpChannelIds.filter((tId) => tId !== sfuSctpChannelId);
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
};
|
|
197
|
-
const result = async (context: TransactionContext, next?: Middleware<TransactionContext>) => {
|
|
198
|
-
await process(context);
|
|
199
|
-
if (next) await next(context);
|
|
200
|
-
};
|
|
201
|
-
|
|
202
|
-
return result;
|
|
203
|
-
}
|
|
@@ -1,239 +0,0 @@
|
|
|
1
|
-
/* eslint-disable camelcase */
|
|
2
|
-
import { ObservedClient } from '../../samples/ObservedClient';
|
|
3
|
-
import * as Models from '../../models/Models';
|
|
4
|
-
import { ReportsCollector } from '../../common/ReportsCollector';
|
|
5
|
-
import { CallMetaType, createCallMetaReport } from '../../common/callMetaReports';
|
|
6
|
-
import {
|
|
7
|
-
Samples_ClientSample_Browser,
|
|
8
|
-
Samples_ClientSample_Engine,
|
|
9
|
-
Samples_ClientSample_OperationSystem,
|
|
10
|
-
Samples_ClientSample_Platform,
|
|
11
|
-
} from '../../models/samples_pb';
|
|
12
|
-
|
|
13
|
-
export function visitClient(
|
|
14
|
-
observedClient: ObservedClient,
|
|
15
|
-
client: Models.Client,
|
|
16
|
-
reports: ReportsCollector,
|
|
17
|
-
fetchSamples: boolean
|
|
18
|
-
) {
|
|
19
|
-
const { mediaUnitId, clientId, userId } = observedClient;
|
|
20
|
-
|
|
21
|
-
const { callId, serviceId, roomId } = observedClient.call;
|
|
22
|
-
|
|
23
|
-
for (const clientSample of observedClient.samples()) {
|
|
24
|
-
if (clientSample.os && (
|
|
25
|
-
client.operationSystem?.name !== clientSample.os.name ||
|
|
26
|
-
client.operationSystem?.version !== clientSample.os.version ||
|
|
27
|
-
client.operationSystem?.versionName !== clientSample.os.versionName
|
|
28
|
-
)) {
|
|
29
|
-
if (fetchSamples) {
|
|
30
|
-
client.operationSystem = new Samples_ClientSample_OperationSystem({
|
|
31
|
-
...clientSample.os,
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const callMetaReport = createCallMetaReport(serviceId, mediaUnitId, roomId, callId, clientId, {
|
|
36
|
-
type: CallMetaType.OPERATION_SYSTEM,
|
|
37
|
-
payload: clientSample.os,
|
|
38
|
-
}, userId);
|
|
39
|
-
|
|
40
|
-
reports.addCallMetaReport(callMetaReport);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
if (clientSample.engine && (
|
|
44
|
-
client.engine?.name !== clientSample.engine.name ||
|
|
45
|
-
client.engine?.version !== clientSample.engine.version
|
|
46
|
-
)) {
|
|
47
|
-
if (fetchSamples) {
|
|
48
|
-
client.engine = new Samples_ClientSample_Engine({
|
|
49
|
-
...clientSample.engine,
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
const callMetaReport = createCallMetaReport(serviceId, mediaUnitId, roomId, callId, clientId, {
|
|
54
|
-
type: CallMetaType.ENGINE,
|
|
55
|
-
payload: clientSample.engine,
|
|
56
|
-
}, userId);
|
|
57
|
-
|
|
58
|
-
reports.addCallMetaReport(callMetaReport);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
if (clientSample.platform && (
|
|
62
|
-
client.platform?.model !== clientSample.platform.model ||
|
|
63
|
-
client.platform?.type !== clientSample.platform.type ||
|
|
64
|
-
client.platform?.vendor !== clientSample.platform.vendor
|
|
65
|
-
)) {
|
|
66
|
-
if (fetchSamples) {
|
|
67
|
-
client.platform = new Samples_ClientSample_Platform({
|
|
68
|
-
...clientSample.platform,
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
const callMetaReport = createCallMetaReport(serviceId, mediaUnitId, roomId, callId, clientId, {
|
|
73
|
-
type: CallMetaType.PLATFORM,
|
|
74
|
-
payload: clientSample.platform,
|
|
75
|
-
}, userId);
|
|
76
|
-
|
|
77
|
-
reports.addCallMetaReport(callMetaReport);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
if (clientSample.browser && (
|
|
81
|
-
client.browser?.name !== clientSample.browser.name ||
|
|
82
|
-
client.browser?.version !== clientSample.browser.version
|
|
83
|
-
)) {
|
|
84
|
-
if (fetchSamples) {
|
|
85
|
-
client.browser = new Samples_ClientSample_Browser({
|
|
86
|
-
...clientSample.browser,
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
const callMetaReport = createCallMetaReport(serviceId, mediaUnitId, roomId, callId, clientId, {
|
|
91
|
-
type: CallMetaType.BROWSER,
|
|
92
|
-
payload: clientSample.browser,
|
|
93
|
-
}, userId);
|
|
94
|
-
|
|
95
|
-
reports.addCallMetaReport(callMetaReport);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
if (clientSample.mediaConstraints && 0 < clientSample.mediaConstraints.length) {
|
|
99
|
-
for (const mediaConstraint of clientSample.mediaConstraints) {
|
|
100
|
-
const callMetaReport = createCallMetaReport(serviceId, mediaUnitId, roomId, callId, clientId, {
|
|
101
|
-
type: CallMetaType.MEDIA_CONSTRAINT,
|
|
102
|
-
payload: mediaConstraint,
|
|
103
|
-
}, userId);
|
|
104
|
-
|
|
105
|
-
reports.addCallMetaReport(callMetaReport);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
if (clientSample.localSDPs && 0 < clientSample.localSDPs.length) {
|
|
110
|
-
for (const localSDP of clientSample.localSDPs) {
|
|
111
|
-
const callMetaReport = createCallMetaReport(serviceId, mediaUnitId, roomId, callId, clientId, {
|
|
112
|
-
type: CallMetaType.LOCAL_SDP,
|
|
113
|
-
payload: localSDP,
|
|
114
|
-
}, userId);
|
|
115
|
-
|
|
116
|
-
reports.addCallMetaReport(callMetaReport);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
if (clientSample.extensionStats && 0 < clientSample.extensionStats.length) {
|
|
121
|
-
for (const extensionStats of clientSample.extensionStats) {
|
|
122
|
-
reports.addClientExtensionReport({
|
|
123
|
-
serviceId,
|
|
124
|
-
mediaUnitId,
|
|
125
|
-
roomId,
|
|
126
|
-
callId,
|
|
127
|
-
clientId,
|
|
128
|
-
userId,
|
|
129
|
-
timestamp: Date.now(),
|
|
130
|
-
payload: extensionStats.payload,
|
|
131
|
-
extensionType: extensionStats.type,
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
if (clientSample.customCallEvents && 0 < clientSample.customCallEvents.length) {
|
|
137
|
-
for (const callEvent of clientSample.customCallEvents) {
|
|
138
|
-
reports.addCallEventReport({
|
|
139
|
-
serviceId,
|
|
140
|
-
mediaUnitId,
|
|
141
|
-
roomId,
|
|
142
|
-
callId,
|
|
143
|
-
clientId,
|
|
144
|
-
userId,
|
|
145
|
-
...callEvent,
|
|
146
|
-
timestamp: callEvent.timestamp ?? Date.now(),
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
if (clientSample.userMediaErrors && 0 < clientSample.userMediaErrors.length) {
|
|
152
|
-
for (const userMediaError of clientSample.userMediaErrors) {
|
|
153
|
-
const callMetaReport = createCallMetaReport(serviceId, mediaUnitId, roomId, callId, clientId, {
|
|
154
|
-
type: CallMetaType.USER_MEDIA_ERROR,
|
|
155
|
-
payload: userMediaError,
|
|
156
|
-
}, userId);
|
|
157
|
-
|
|
158
|
-
reports.addCallMetaReport(callMetaReport);
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
if (clientSample.certificates && 0 < clientSample.certificates.length) {
|
|
163
|
-
for (const certificate of clientSample.certificates) {
|
|
164
|
-
const callMetaReport = createCallMetaReport(serviceId, mediaUnitId, roomId, callId, clientId, {
|
|
165
|
-
type: CallMetaType.CERTIFICATE,
|
|
166
|
-
payload: certificate,
|
|
167
|
-
}, userId);
|
|
168
|
-
|
|
169
|
-
reports.addCallMetaReport(callMetaReport);
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
if (clientSample.codecs && 0 < clientSample.codecs.length) {
|
|
174
|
-
for (const codec of clientSample.codecs) {
|
|
175
|
-
const callMetaReport = createCallMetaReport(serviceId, mediaUnitId, roomId, callId, clientId, {
|
|
176
|
-
type: CallMetaType.CODEC,
|
|
177
|
-
payload: codec,
|
|
178
|
-
}, userId);
|
|
179
|
-
|
|
180
|
-
reports.addCallMetaReport(callMetaReport);
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
if (clientSample.iceServers && 0 < clientSample.iceServers.length) {
|
|
185
|
-
for (const iceServer of clientSample.iceServers) {
|
|
186
|
-
const callMetaReport = createCallMetaReport(serviceId, mediaUnitId, roomId, callId, clientId, {
|
|
187
|
-
type: CallMetaType.ICE_SERVER,
|
|
188
|
-
payload: iceServer,
|
|
189
|
-
}, userId);
|
|
190
|
-
|
|
191
|
-
reports.addCallMetaReport(callMetaReport);
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
if (clientSample.mediaDevices && 0 < clientSample.mediaDevices.length) {
|
|
196
|
-
for (const mediaDevice of clientSample.mediaDevices) {
|
|
197
|
-
const callMetaReport = createCallMetaReport(serviceId, mediaUnitId, roomId, callId, clientId, {
|
|
198
|
-
type: CallMetaType.MEDIA_DEVICE,
|
|
199
|
-
payload: mediaDevice,
|
|
200
|
-
}, userId);
|
|
201
|
-
|
|
202
|
-
reports.addCallMetaReport(callMetaReport);
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
if (clientSample.mediaSources && 0 < clientSample.mediaSources.length) {
|
|
207
|
-
for (const mediaSource of clientSample.mediaSources) {
|
|
208
|
-
const callMetaReport = createCallMetaReport(serviceId, mediaUnitId, roomId, callId, clientId, {
|
|
209
|
-
type: CallMetaType.MEDIA_SOURCE,
|
|
210
|
-
payload: mediaSource,
|
|
211
|
-
}, userId);
|
|
212
|
-
|
|
213
|
-
reports.addCallMetaReport(callMetaReport);
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
if (clientSample.iceLocalCandidates && 0 < clientSample.iceLocalCandidates.length) {
|
|
218
|
-
for (const iceLocalCandidate of clientSample.iceLocalCandidates) {
|
|
219
|
-
const callMetaReport = createCallMetaReport(serviceId, mediaUnitId, roomId, callId, clientId, {
|
|
220
|
-
type: CallMetaType.ICE_LOCAL_CANDIDATE,
|
|
221
|
-
payload: iceLocalCandidate,
|
|
222
|
-
}, userId);
|
|
223
|
-
|
|
224
|
-
reports.addCallMetaReport(callMetaReport);
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
if (clientSample.iceRemoteCandidates && 0 < clientSample.iceRemoteCandidates.length) {
|
|
229
|
-
for (const iceRemoteCandidate of clientSample.iceRemoteCandidates) {
|
|
230
|
-
const callMetaReport = createCallMetaReport(serviceId, mediaUnitId, roomId, callId, clientId, {
|
|
231
|
-
type: CallMetaType.ICE_REMOTE_CANDIDATE,
|
|
232
|
-
payload: iceRemoteCandidate,
|
|
233
|
-
}, userId);
|
|
234
|
-
|
|
235
|
-
reports.addCallMetaReport(callMetaReport);
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
}
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
/* eslint-disable camelcase */
|
|
2
|
-
import * as Models from '../../models/Models';
|
|
3
|
-
import { ReportsCollector } from '../../common/ReportsCollector';
|
|
4
|
-
import { ObservedInboundAudioTrack } from '../../samples/ObservedInboundAudioTrack';
|
|
5
|
-
import { InboundAudioTrackReport } from '@observertc/report-schemas-js';
|
|
6
|
-
import { logger } from '../VisitObservedCallsMiddleware';
|
|
7
|
-
import { Samples_ClientSample_InboundAudioTrack } from '../../models/samples_pb';
|
|
8
|
-
|
|
9
|
-
export function visitInboundAudioTrack(
|
|
10
|
-
observedInboundAudioTrack: ObservedInboundAudioTrack,
|
|
11
|
-
storedPeerConnection: Models.PeerConnection,
|
|
12
|
-
storedInboundTracks: Map<string, Models.InboundTrack>,
|
|
13
|
-
reports: ReportsCollector,
|
|
14
|
-
fetchSamples: boolean,
|
|
15
|
-
remoteTrackId?: string,
|
|
16
|
-
remotePeerConnectionId?: string,
|
|
17
|
-
remoteClientId?: string,
|
|
18
|
-
) {
|
|
19
|
-
const { trackId, sfuStreamId, sfuSinkId } = observedInboundAudioTrack;
|
|
20
|
-
|
|
21
|
-
const { peerConnectionId } = observedInboundAudioTrack.peerConnection;
|
|
22
|
-
|
|
23
|
-
const {
|
|
24
|
-
mediaUnitId,
|
|
25
|
-
clientId,
|
|
26
|
-
userId,
|
|
27
|
-
marker,
|
|
28
|
-
minTimestamp: timestamp,
|
|
29
|
-
} = observedInboundAudioTrack.peerConnection.client;
|
|
30
|
-
|
|
31
|
-
const { serviceId, roomId, callId } = observedInboundAudioTrack.peerConnection.client.call;
|
|
32
|
-
|
|
33
|
-
let storedInboundAudioTrack = storedInboundTracks.get(trackId);
|
|
34
|
-
|
|
35
|
-
if (!storedInboundAudioTrack) {
|
|
36
|
-
storedInboundAudioTrack = new Models.InboundTrack({
|
|
37
|
-
serviceId,
|
|
38
|
-
roomId,
|
|
39
|
-
callId,
|
|
40
|
-
clientId,
|
|
41
|
-
kind: 'audio',
|
|
42
|
-
peerConnectionId,
|
|
43
|
-
mediaUnitId,
|
|
44
|
-
trackId,
|
|
45
|
-
sfuSinkId,
|
|
46
|
-
sfuStreamId,
|
|
47
|
-
|
|
48
|
-
userId,
|
|
49
|
-
marker,
|
|
50
|
-
});
|
|
51
|
-
storedInboundTracks.set(trackId, storedInboundAudioTrack);
|
|
52
|
-
if (!storedPeerConnection.inboundTrackIds.find((tId) => tId === trackId)) {
|
|
53
|
-
storedPeerConnection.inboundTrackIds.push(trackId);
|
|
54
|
-
} else {
|
|
55
|
-
logger.warn(
|
|
56
|
-
`Attempted to add trackId to storedPeerConnection twice. serviceId: ${serviceId}, callId: ${callId}, clientId: ${clientId}, pcId: ${peerConnectionId}`
|
|
57
|
-
);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
const statsMap = new Map<bigint, Samples_ClientSample_InboundAudioTrack>();
|
|
62
|
-
|
|
63
|
-
for (const inboundAudioSample of observedInboundAudioTrack.samples()) {
|
|
64
|
-
const report: InboundAudioTrackReport = {
|
|
65
|
-
serviceId,
|
|
66
|
-
roomId,
|
|
67
|
-
callId,
|
|
68
|
-
clientId,
|
|
69
|
-
userId,
|
|
70
|
-
mediaUnitId,
|
|
71
|
-
peerConnectionId,
|
|
72
|
-
...inboundAudioSample,
|
|
73
|
-
timestamp,
|
|
74
|
-
sampleSeq: -1,
|
|
75
|
-
remoteClientId,
|
|
76
|
-
remotePeerConnectionId,
|
|
77
|
-
remoteTrackId,
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
reports.addInboundAudioTrackReport(report);
|
|
81
|
-
|
|
82
|
-
if (fetchSamples) {
|
|
83
|
-
const {
|
|
84
|
-
ssrc: sample_ssrc,
|
|
85
|
-
bytesReceived: sample_bytesReceived,
|
|
86
|
-
bytesSent: sample_bytesSent,
|
|
87
|
-
estimatedPlayoutTimestamp: samples_estimatedPlayoutTimestamp,
|
|
88
|
-
headerBytesReceived: samples_headerBytesReceived,
|
|
89
|
-
lastPacketReceivedTimestamp: samples_lastPacketReceivedTimestamp,
|
|
90
|
-
remoteTimestamp: samples_remoteTimestamp,
|
|
91
|
-
...sample
|
|
92
|
-
} = inboundAudioSample;
|
|
93
|
-
|
|
94
|
-
const ssrc = BigInt(sample_ssrc);
|
|
95
|
-
const audioStats = new Samples_ClientSample_InboundAudioTrack({
|
|
96
|
-
ssrc,
|
|
97
|
-
bytesReceived: BigInt(sample_bytesReceived ?? -1),
|
|
98
|
-
bytesSent: BigInt(sample_bytesSent ?? -1),
|
|
99
|
-
estimatedPlayoutTimestamp: BigInt(samples_estimatedPlayoutTimestamp ?? -1),
|
|
100
|
-
headerBytesReceived: BigInt(samples_headerBytesReceived ?? -1),
|
|
101
|
-
lastPacketReceivedTimestamp: BigInt(samples_lastPacketReceivedTimestamp ?? -1),
|
|
102
|
-
remoteTimestamp: BigInt(samples_remoteTimestamp ?? -1),
|
|
103
|
-
...sample,
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
statsMap.set(ssrc, audioStats);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
storedInboundAudioTrack.ssrc = [ ...statsMap.keys() ];
|
|
110
|
-
storedInboundAudioTrack.videoStats = Array.from(statsMap.values());
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
}
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
/* eslint-disable camelcase */
|
|
2
|
-
import { InboundVideoTrackReport } from '@observertc/report-schemas-js';
|
|
3
|
-
import { ReportsCollector } from '../../common/ReportsCollector';
|
|
4
|
-
import { ObservedInboundVideoTrack } from '../../samples/ObservedInboundVideoTrack';
|
|
5
|
-
import { logger } from '../VisitObservedCallsMiddleware';
|
|
6
|
-
import * as Models from '../../models/Models';
|
|
7
|
-
import { Samples_ClientSample_InboundVideoTrack } from '../../models/samples_pb';
|
|
8
|
-
|
|
9
|
-
// InboundVideoTrack visitor
|
|
10
|
-
|
|
11
|
-
export function visitInboundVideoTrack(
|
|
12
|
-
observedInboundVideoTrack: ObservedInboundVideoTrack,
|
|
13
|
-
storedPeerConnection: Models.PeerConnection,
|
|
14
|
-
storedInboundTracks: Map<string, Models.InboundTrack>,
|
|
15
|
-
reports: ReportsCollector,
|
|
16
|
-
fetchSamples: boolean,
|
|
17
|
-
remoteTrackId?: string,
|
|
18
|
-
remotePeerConnectionId?: string,
|
|
19
|
-
remoteClientId?: string,
|
|
20
|
-
) {
|
|
21
|
-
const { trackId, sfuStreamId, sfuSinkId } = observedInboundVideoTrack;
|
|
22
|
-
|
|
23
|
-
const { peerConnectionId } = observedInboundVideoTrack.peerConnection;
|
|
24
|
-
|
|
25
|
-
const {
|
|
26
|
-
mediaUnitId,
|
|
27
|
-
clientId,
|
|
28
|
-
userId,
|
|
29
|
-
marker,
|
|
30
|
-
minTimestamp: timestamp,
|
|
31
|
-
} = observedInboundVideoTrack.peerConnection.client;
|
|
32
|
-
|
|
33
|
-
const { serviceId, roomId, callId } = observedInboundVideoTrack.peerConnection.client.call;
|
|
34
|
-
|
|
35
|
-
let storedInboundVideoTrack = storedInboundTracks.get(trackId);
|
|
36
|
-
|
|
37
|
-
if (!storedInboundVideoTrack) {
|
|
38
|
-
storedInboundVideoTrack = new Models.InboundTrack({
|
|
39
|
-
serviceId,
|
|
40
|
-
roomId,
|
|
41
|
-
callId,
|
|
42
|
-
clientId,
|
|
43
|
-
kind: 'video',
|
|
44
|
-
peerConnectionId,
|
|
45
|
-
mediaUnitId,
|
|
46
|
-
trackId,
|
|
47
|
-
|
|
48
|
-
sfuStreamId,
|
|
49
|
-
sfuSinkId,
|
|
50
|
-
|
|
51
|
-
userId,
|
|
52
|
-
marker,
|
|
53
|
-
});
|
|
54
|
-
storedInboundTracks.set(trackId, storedInboundVideoTrack);
|
|
55
|
-
if (!storedPeerConnection.inboundTrackIds.find((tId) => tId === trackId)) {
|
|
56
|
-
storedPeerConnection.inboundTrackIds.push(trackId);
|
|
57
|
-
} else {
|
|
58
|
-
logger.warn(
|
|
59
|
-
`Attempted to add trackId to storedPeerConnection twice. serviceId: ${serviceId}, callId: ${callId}, clientId: ${clientId}, pcId: ${peerConnectionId}`
|
|
60
|
-
);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
const statsMap = new Map<bigint, Samples_ClientSample_InboundVideoTrack>();
|
|
65
|
-
|
|
66
|
-
for (const inboundVideoSample of observedInboundVideoTrack.samples()) {
|
|
67
|
-
const report: InboundVideoTrackReport = {
|
|
68
|
-
serviceId,
|
|
69
|
-
roomId,
|
|
70
|
-
callId,
|
|
71
|
-
clientId,
|
|
72
|
-
userId,
|
|
73
|
-
mediaUnitId,
|
|
74
|
-
peerConnectionId,
|
|
75
|
-
...inboundVideoSample,
|
|
76
|
-
timestamp,
|
|
77
|
-
sampleSeq: -1,
|
|
78
|
-
remoteClientId,
|
|
79
|
-
remotePeerConnectionId,
|
|
80
|
-
remoteTrackId,
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
reports.addInboundVideoTrackReport(report);
|
|
84
|
-
|
|
85
|
-
if (fetchSamples) {
|
|
86
|
-
const {
|
|
87
|
-
ssrc: sample_ssrc,
|
|
88
|
-
bytesReceived: sample_bytesReceived,
|
|
89
|
-
bytesSent: sample_bytesSent,
|
|
90
|
-
estimatedPlayoutTimestamp: samples_estimatedPlayoutTimestamp,
|
|
91
|
-
headerBytesReceived: samples_headerBytesReceived,
|
|
92
|
-
lastPacketReceivedTimestamp: samples_lastPacketReceivedTimestamp,
|
|
93
|
-
remoteTimestamp: samples_remoteTimestamp,
|
|
94
|
-
qpSum: bytes_qpSum,
|
|
95
|
-
...sample
|
|
96
|
-
} = inboundVideoSample;
|
|
97
|
-
|
|
98
|
-
const ssrc = BigInt(sample_ssrc);
|
|
99
|
-
// const lastVideoStats = storedInboundVideoTrack.videoStats.find((stats) => stats.ssrc === ssrc);
|
|
100
|
-
const videoStats = new Samples_ClientSample_InboundVideoTrack({
|
|
101
|
-
ssrc,
|
|
102
|
-
bytesReceived: BigInt(sample_bytesReceived ?? -1),
|
|
103
|
-
bytesSent: BigInt(sample_bytesSent ?? -1),
|
|
104
|
-
estimatedPlayoutTimestamp: BigInt(samples_estimatedPlayoutTimestamp ?? -1),
|
|
105
|
-
headerBytesReceived: BigInt(samples_headerBytesReceived ?? -1),
|
|
106
|
-
lastPacketReceivedTimestamp: BigInt(samples_lastPacketReceivedTimestamp ?? -1),
|
|
107
|
-
remoteTimestamp: BigInt(samples_remoteTimestamp ?? -1),
|
|
108
|
-
qpSum: BigInt(bytes_qpSum ?? -1),
|
|
109
|
-
...sample,
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
statsMap.set(ssrc, videoStats);
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
storedInboundVideoTrack.ssrc = [ ...statsMap.keys() ];
|
|
116
|
-
storedInboundVideoTrack.videoStats = Array.from(statsMap.values());
|
|
117
|
-
}
|