@observertc/observer-js 0.9.20-beta → 0.9.22-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/.eslintrc.json +143 -0
- package/lib/Evaluator.d.ts.map +1 -1
- package/lib/Evaluator.js +54 -47
- package/lib/Observer.d.ts +1408 -38
- package/lib/Observer.d.ts.map +1 -1
- package/lib/Observer.js +484 -180
- package/lib/common/Semaphore.d.ts.map +1 -1
- package/lib/common/callMetaReports.d.ts.map +1 -1
- package/lib/common/callMetaReports.js +1 -0
- package/lib/common/logger.d.ts.map +1 -1
- package/lib/common/logger.js +15 -15
- package/lib/common/utils.d.ts +1 -0
- package/lib/common/utils.d.ts.map +1 -1
- package/lib/common/utils.js +12 -1
- package/lib/entries/CallEntry.d.ts +611 -0
- package/lib/entries/CallEntry.d.ts.map +1 -0
- package/lib/entries/CallEntry.js +75 -0
- package/lib/entries/ClientEntry.d.ts +474 -0
- package/lib/entries/ClientEntry.d.ts.map +1 -0
- package/lib/entries/ClientEntry.js +101 -0
- package/lib/entries/InboundTrackEntry.d.ts +670 -0
- package/lib/entries/InboundTrackEntry.d.ts.map +1 -0
- package/lib/entries/InboundTrackEntry.js +76 -0
- package/lib/entries/OutboundTrackEntry.d.ts +670 -0
- package/lib/entries/OutboundTrackEntry.d.ts.map +1 -0
- package/lib/entries/OutboundTrackEntry.js +73 -0
- package/lib/entries/PeerConnectionEntry.d.ts +469 -0
- package/lib/entries/PeerConnectionEntry.d.ts.map +1 -0
- package/lib/entries/PeerConnectionEntry.js +144 -0
- package/lib/entries/SfuEntry.d.ts +150 -0
- package/lib/entries/SfuEntry.d.ts.map +1 -0
- package/lib/entries/SfuEntry.js +77 -0
- package/lib/entries/SfuInboundRtpPadEntry.d.ts +14 -0
- package/lib/entries/SfuInboundRtpPadEntry.d.ts.map +1 -0
- package/lib/entries/SfuInboundRtpPadEntry.js +49 -0
- package/lib/entries/SfuOutboundRtpPadEntry.d.ts +14 -0
- package/lib/entries/SfuOutboundRtpPadEntry.d.ts.map +1 -0
- package/lib/entries/SfuOutboundRtpPadEntry.js +47 -0
- package/lib/entries/SfuSctpChannelEntry.d.ts +12 -0
- package/lib/entries/SfuSctpChannelEntry.d.ts.map +1 -0
- package/lib/entries/SfuSctpChannelEntry.js +43 -0
- package/lib/entries/SfuTransportEntry.d.ts +82 -0
- package/lib/entries/SfuTransportEntry.d.ts.map +1 -0
- package/lib/entries/SfuTransportEntry.js +122 -0
- package/lib/index.d.ts +10 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/middlewares/CallOperationsContext.d.ts.map +1 -1
- package/lib/middlewares/CallOperationsContext.js +2 -6
- package/lib/middlewares/CallProcessor.d.ts.map +1 -1
- package/lib/middlewares/CallProcessor.js +15 -6
- package/lib/middlewares/CommitTransactionMiddleware.d.ts.map +1 -1
- package/lib/middlewares/CommitTransactionMiddleware.js +22 -26
- package/lib/middlewares/DeleteOutdatedCallEntries.d.ts.map +1 -1
- package/lib/middlewares/DeleteOutdatedCallEntries.js +29 -20
- package/lib/middlewares/DeleteOutdatedSfuEntries.d.ts.map +1 -1
- package/lib/middlewares/DeleteOutdatedSfuEntries.js +27 -18
- package/lib/middlewares/Middleware.d.ts.map +1 -1
- package/lib/middlewares/Middleware.js +13 -4
- package/lib/middlewares/Processor.d.ts.map +1 -1
- package/lib/middlewares/Processor.js +18 -9
- package/lib/middlewares/TransactionContext.d.ts.map +1 -1
- package/lib/middlewares/TransactionContext.js +84 -73
- package/lib/middlewares/VisitObservedCallsMiddleware.d.ts.map +1 -1
- package/lib/middlewares/VisitObservedCallsMiddleware.js +16 -7
- package/lib/middlewares/VisitObservedSfusMiddleware.d.ts.map +1 -1
- package/lib/middlewares/VisitObservedSfusMiddleware.js +15 -6
- package/lib/middlewares/visitors/visitClient.d.ts.map +1 -1
- package/lib/middlewares/visitors/visitClient.js +6 -18
- package/lib/middlewares/visitors/visitInboundAudioTrack.d.ts.map +1 -1
- package/lib/middlewares/visitors/visitInboundAudioTrack.js +17 -20
- package/lib/middlewares/visitors/visitInboundVideoTrack.d.ts.map +1 -1
- package/lib/middlewares/visitors/visitInboundVideoTrack.js +16 -21
- package/lib/middlewares/visitors/visitOutboundAudioTrack.d.ts.map +1 -1
- package/lib/middlewares/visitors/visitOutboundAudioTrack.js +16 -16
- package/lib/middlewares/visitors/visitOutboundVideoTarck.d.ts.map +1 -1
- package/lib/middlewares/visitors/visitOutboundVideoTarck.js +16 -17
- package/lib/middlewares/visitors/visitPeerConnection.d.ts.map +1 -1
- package/lib/middlewares/visitors/visitPeerConnection.js +24 -40
- package/lib/middlewares/visitors/visitSfu.d.ts.map +1 -1
- package/lib/middlewares/visitors/visitSfu.js +6 -7
- package/lib/middlewares/visitors/visitSfuInboundRtpPad.d.ts.map +1 -1
- package/lib/middlewares/visitors/visitSfuInboundRtpPad.js +3 -7
- package/lib/middlewares/visitors/visitSfuOutboundRtpPad.d.ts.map +1 -1
- package/lib/middlewares/visitors/visitSfuOutboundRtpPad.js +3 -8
- package/lib/middlewares/visitors/visitSfuSctpChannel.d.ts.map +1 -1
- package/lib/middlewares/visitors/visitSfuSctpChannel.js +3 -6
- package/lib/middlewares/visitors/visitSfuTransport.d.ts.map +1 -1
- package/lib/middlewares/visitors/visitSfuTransport.js +3 -6
- package/lib/processes/closePeerConnectionProcess.d.ts.map +1 -1
- package/lib/processes/closePeerConnectionProcess.js +14 -5
- package/lib/processes/detachClientProcess.d.ts.map +1 -1
- package/lib/processes/detachClientProcess.js +20 -17
- package/lib/processes/findRemoteMatches.d.ts +2 -2
- package/lib/processes/findRemoteMatches.d.ts.map +1 -1
- package/lib/processes/findRemoteMatches.js +70 -56
- package/lib/processes/inboundTrackRemoved.d.ts.map +1 -1
- package/lib/processes/inboundTrackRemoved.js +12 -3
- package/lib/processes/joinClientProcess.d.ts.map +1 -1
- package/lib/processes/joinClientProcess.js +15 -6
- package/lib/processes/outboundTrackRemoved.d.ts.map +1 -1
- package/lib/processes/outboundTrackRemoved.js +12 -3
- package/lib/samples/ObservedCall.d.ts.map +1 -1
- package/lib/samples/ObservedCall.js +1 -5
- package/lib/samples/ObservedCalls.d.ts.map +1 -1
- package/lib/samples/ObservedClient.d.ts.map +1 -1
- package/lib/samples/ObservedClient.js +1 -9
- package/lib/samples/ObservedInboundAudioTrack.d.ts.map +1 -1
- package/lib/samples/ObservedInboundAudioTrack.js +1 -5
- package/lib/samples/ObservedInboundVideoTrack.d.ts.map +1 -1
- package/lib/samples/ObservedInboundVideoTrack.js +1 -5
- package/lib/samples/ObservedOutboundAudioTrack.d.ts.map +1 -1
- package/lib/samples/ObservedOutboundAudioTrack.js +1 -5
- package/lib/samples/ObservedOutboundVideoTrack.d.ts.map +1 -1
- package/lib/samples/ObservedOutboundVideoTrack.js +1 -5
- package/lib/samples/ObservedPeerConnection.d.ts.map +1 -1
- package/lib/samples/ObservedPeerConnection.js +1 -12
- package/lib/samples/ObservedSfu.d.ts.map +1 -1
- package/lib/samples/ObservedSfu.js +1 -8
- package/lib/samples/ObservedSfuInboundRtpPad.d.ts.map +1 -1
- package/lib/samples/ObservedSfuInboundRtpPad.js +1 -5
- package/lib/samples/ObservedSfuOutboundRtpPad.d.ts.map +1 -1
- package/lib/samples/ObservedSfuOutboundRtpPad.js +1 -5
- package/lib/samples/ObservedSfuSctpChannel.d.ts.map +1 -1
- package/lib/samples/ObservedSfuSctpChannel.js +1 -5
- package/lib/samples/ObservedSfuTransport.d.ts.map +1 -1
- package/lib/samples/ObservedSfuTransport.js +1 -8
- package/lib/samples/ObservedSfus.d.ts.map +1 -1
- package/lib/sinks/ObserverSink.d.ts.map +1 -1
- package/lib/sinks/ObserverSink.js +42 -31
- package/lib/sinks/callEventReports.js +1 -0
- package/lib/sources/ObservedCallSource.d.ts +5 -3
- package/lib/sources/ObservedCallSource.d.ts.map +1 -1
- package/lib/sources/ObservedClientSource.d.ts +3 -2
- package/lib/sources/ObservedClientSource.d.ts.map +1 -1
- package/lib/sources/ObservedSfuSource.d.ts +3 -2
- package/lib/sources/ObservedSfuSource.d.ts.map +1 -1
- package/lib/sources/Sources.d.ts +8 -4
- package/lib/sources/Sources.d.ts.map +1 -1
- package/lib/sources/Sources.js +71 -46
- package/lib/storages/ObserverStorage.d.ts.map +1 -1
- package/lib/storages/SimpleStorage.d.ts.map +1 -1
- package/lib/storages/SimpleStorage.js +40 -23
- package/package.json +2 -1
- package/src/Evaluator.ts +17 -9
- package/src/Observer.ts +239 -171
- package/src/common/Semaphore.ts +2 -0
- package/src/common/callMetaReports.ts +30 -28
- package/src/common/logger.ts +140 -132
- package/src/common/types.ts +1 -1
- package/src/common/utils.ts +12 -1
- package/src/entries/CallEntry.ts +62 -0
- package/src/entries/ClientEntry.ts +90 -0
- package/src/entries/InboundTrackEntry.ts +74 -0
- package/src/entries/OutboundTrackEntry.ts +72 -0
- package/src/entries/PeerConnectionEntry.ts +133 -0
- package/src/entries/SfuEntry.ts +62 -0
- package/src/entries/SfuInboundRtpPadEntry.ts +46 -0
- package/src/entries/SfuOutboundRtpPadEntry.ts +44 -0
- package/src/entries/SfuSctpChannelEntry.ts +39 -0
- package/src/entries/SfuTransportEntry.ts +109 -0
- package/src/index.ts +11 -0
- package/src/middlewares/CallOperationsContext.ts +9 -5
- package/src/middlewares/CallProcessor.ts +4 -2
- package/src/middlewares/CommitTransactionMiddleware.ts +8 -5
- package/src/middlewares/DeleteOutdatedCallEntries.ts +24 -16
- package/src/middlewares/DeleteOutdatedSfuEntries.ts +24 -15
- package/src/middlewares/Middleware.ts +1 -0
- package/src/middlewares/Processor.ts +10 -5
- package/src/middlewares/TransactionContext.ts +1 -2
- package/src/middlewares/VisitObservedCallsMiddleware.ts +5 -2
- package/src/middlewares/VisitObservedSfusMiddleware.ts +8 -7
- package/src/middlewares/visitors/visitClient.ts +15 -1
- package/src/middlewares/visitors/visitInboundAudioTrack.ts +4 -1
- package/src/middlewares/visitors/visitInboundVideoTrack.ts +5 -1
- package/src/middlewares/visitors/visitOutboundAudioTrack.ts +5 -1
- package/src/middlewares/visitors/visitOutboundVideoTarck.ts +5 -1
- package/src/middlewares/visitors/visitPeerConnection.ts +15 -2
- package/src/middlewares/visitors/visitSfu.ts +7 -1
- package/src/middlewares/visitors/visitSfuInboundRtpPad.ts +4 -2
- package/src/middlewares/visitors/visitSfuOutboundRtpPad.ts +3 -1
- package/src/middlewares/visitors/visitSfuSctpChannel.ts +23 -21
- package/src/middlewares/visitors/visitSfuTransport.ts +3 -1
- package/src/processes/closePeerConnectionProcess.ts +3 -0
- package/src/processes/detachClientProcess.ts +13 -4
- package/src/processes/findRemoteMatches.ts +32 -21
- package/src/processes/inboundTrackRemoved.ts +2 -0
- package/src/processes/joinClientProcess.ts +8 -2
- package/src/processes/outboundTrackRemoved.ts +2 -0
- package/src/samples/ObservedCall.ts +6 -0
- package/src/samples/ObservedCalls.ts +13 -7
- package/src/samples/ObservedClient.ts +24 -8
- package/src/samples/ObservedInboundAudioTrack.ts +3 -2
- package/src/samples/ObservedInboundVideoTrack.ts +3 -2
- package/src/samples/ObservedOutboundAudioTrack.ts +3 -2
- package/src/samples/ObservedOutboundVideoTrack.ts +3 -2
- package/src/samples/ObservedPeerConnection.ts +27 -11
- package/src/samples/ObservedSfu.ts +17 -10
- package/src/samples/ObservedSfuInboundRtpPad.ts +5 -4
- package/src/samples/ObservedSfuOutboundRtpPad.ts +5 -4
- package/src/samples/ObservedSfuSctpChannel.ts +13 -13
- package/src/samples/ObservedSfuTransport.ts +19 -7
- package/src/samples/ObservedSfus.ts +10 -5
- package/src/sinks/ObserverSink.ts +51 -44
- package/src/sinks/callEventReports.ts +1 -1
- package/src/sources/ObservedCallSource.ts +6 -5
- package/src/sources/ObservedClientSource.ts +3 -2
- package/src/sources/ObservedSfuSource.ts +4 -8
- package/src/sources/Sources.ts +96 -22
- package/src/storages/ObserverStorage.ts +1 -0
- package/src/storages/SimpleStorage.ts +44 -21
- package/tsconfig.json +7 -5
- package/.eslintrc.js +0 -27
|
@@ -32,19 +32,21 @@ export function createDeleteOutdatedCallEntries(
|
|
|
32
32
|
} = transaction;
|
|
33
33
|
|
|
34
34
|
const now = BigInt(Date.now());
|
|
35
|
-
const deletedCallIds = new Set(evaluatorContext.endedCalls.map(c => c.callId).filter(id =>
|
|
36
|
-
const deletedClientIds = new Set(evaluatorContext.detachedClients.map(c => c.clientId).filter(id =>
|
|
37
|
-
|
|
35
|
+
const deletedCallIds = new Set(evaluatorContext.endedCalls.map((c) => c.callId).filter((id) => Boolean(id)));
|
|
36
|
+
const deletedClientIds = new Set(evaluatorContext.detachedClients.map((c) => c.clientId).filter((id) => Boolean(id)));
|
|
37
|
+
|
|
38
|
+
for (const [ peerConnectionId, peerConnection ] of storages.peerConnectionStorage.localEntries()) {
|
|
38
39
|
if (updatedPeerConnections.has(peerConnectionId)) {
|
|
39
40
|
continue;
|
|
40
41
|
}
|
|
41
42
|
|
|
42
43
|
const { touched, clientId, callId } = peerConnection;
|
|
44
|
+
|
|
43
45
|
if (touched && now - touched < maxIdleTimeInMs) {
|
|
44
46
|
if (
|
|
45
|
-
!deletedCallIds.has(callId ??
|
|
46
|
-
!deletedClientIds.has(clientId ??
|
|
47
|
-
){
|
|
47
|
+
!deletedCallIds.has(callId ?? 'not exists') &&
|
|
48
|
+
!deletedClientIds.has(clientId ?? 'not exists')
|
|
49
|
+
) {
|
|
48
50
|
continue;
|
|
49
51
|
}
|
|
50
52
|
}
|
|
@@ -53,6 +55,7 @@ export function createDeleteOutdatedCallEntries(
|
|
|
53
55
|
|
|
54
56
|
if (clientId) {
|
|
55
57
|
let storedClient = clients.get(clientId);
|
|
58
|
+
|
|
56
59
|
if (storedClient) {
|
|
57
60
|
storedClient.peerConnectionIds = storedClient.peerConnectionIds.filter((pcId) => pcId !== peerConnectionId);
|
|
58
61
|
} else {
|
|
@@ -65,18 +68,19 @@ export function createDeleteOutdatedCallEntries(
|
|
|
65
68
|
}
|
|
66
69
|
}
|
|
67
70
|
|
|
68
|
-
for (const [trackId, inboundTrack] of storages.inboundTrackStorage.localEntries()) {
|
|
71
|
+
for (const [ trackId, inboundTrack ] of storages.inboundTrackStorage.localEntries()) {
|
|
69
72
|
if (updatedInboundAudioTracks.has(trackId) || updatedInboundVideoTracks.has(trackId)) {
|
|
70
73
|
continue;
|
|
71
74
|
}
|
|
72
75
|
|
|
73
76
|
const { touched, clientId, callId, peerConnectionId } = inboundTrack;
|
|
77
|
+
|
|
74
78
|
if (touched && now - touched < maxIdleTimeInMs) {
|
|
75
79
|
if (
|
|
76
|
-
!deletedCallIds.has(callId ??
|
|
77
|
-
!deletedClientIds.has(clientId ??
|
|
78
|
-
!deletedPeerConnections.has(peerConnectionId ??
|
|
79
|
-
){
|
|
80
|
+
!deletedCallIds.has(callId ?? 'not exists') &&
|
|
81
|
+
!deletedClientIds.has(clientId ?? 'not exists') &&
|
|
82
|
+
!deletedPeerConnections.has(peerConnectionId ?? 'not exists')
|
|
83
|
+
) {
|
|
80
84
|
continue;
|
|
81
85
|
}
|
|
82
86
|
}
|
|
@@ -91,6 +95,7 @@ export function createDeleteOutdatedCallEntries(
|
|
|
91
95
|
|
|
92
96
|
if (peerConnectionId) {
|
|
93
97
|
let storedPeerConnection = updatedPeerConnections.get(peerConnectionId);
|
|
98
|
+
|
|
94
99
|
if (!storedPeerConnection) {
|
|
95
100
|
storedPeerConnection = await storages.peerConnectionStorage.get(peerConnectionId);
|
|
96
101
|
if (storedPeerConnection) {
|
|
@@ -104,19 +109,20 @@ export function createDeleteOutdatedCallEntries(
|
|
|
104
109
|
}
|
|
105
110
|
|
|
106
111
|
// console.warn("auodiaussdoi", updatedOutboundAudioTracks, updatedOutboundVideoTracks);
|
|
107
|
-
for (const [trackId, outboundTrack] of storages.outboundTrackStorage.localEntries()) {
|
|
112
|
+
for (const [ trackId, outboundTrack ] of storages.outboundTrackStorage.localEntries()) {
|
|
108
113
|
if (updatedOutboundAudioTracks.has(trackId) || updatedOutboundVideoTracks.has(trackId)) {
|
|
109
114
|
continue;
|
|
110
115
|
}
|
|
111
116
|
|
|
112
117
|
const { touched, clientId, callId, peerConnectionId } = outboundTrack;
|
|
113
118
|
// console.warn("deprecated outb tracks", outboundTrack, now, touched, maxIdleTimeInMs, touched && now - touched < maxIdleTimeInMs, callId)
|
|
119
|
+
|
|
114
120
|
if (touched && now - touched < maxIdleTimeInMs) {
|
|
115
121
|
if (
|
|
116
|
-
!deletedCallIds.has(callId ??
|
|
117
|
-
!deletedClientIds.has(clientId ??
|
|
118
|
-
!deletedPeerConnections.has(peerConnectionId ??
|
|
119
|
-
){
|
|
122
|
+
!deletedCallIds.has(callId ?? 'not exists') &&
|
|
123
|
+
!deletedClientIds.has(clientId ?? 'not exists') &&
|
|
124
|
+
!deletedPeerConnections.has(peerConnectionId ?? 'not exists')
|
|
125
|
+
) {
|
|
120
126
|
continue;
|
|
121
127
|
}
|
|
122
128
|
}
|
|
@@ -131,6 +137,7 @@ export function createDeleteOutdatedCallEntries(
|
|
|
131
137
|
|
|
132
138
|
if (peerConnectionId) {
|
|
133
139
|
let storedPeerConnection = updatedPeerConnections.get(peerConnectionId);
|
|
140
|
+
|
|
134
141
|
if (!storedPeerConnection) {
|
|
135
142
|
storedPeerConnection = await storages.peerConnectionStorage.get(peerConnectionId);
|
|
136
143
|
if (storedPeerConnection) {
|
|
@@ -147,5 +154,6 @@ export function createDeleteOutdatedCallEntries(
|
|
|
147
154
|
await process(context);
|
|
148
155
|
if (next) await next(context);
|
|
149
156
|
};
|
|
157
|
+
|
|
150
158
|
return result;
|
|
151
159
|
}
|
|
@@ -29,14 +29,16 @@ export function createDeleteOutdatedSfuEntries(
|
|
|
29
29
|
} = transaction;
|
|
30
30
|
|
|
31
31
|
const now = BigInt(Date.now());
|
|
32
|
-
|
|
32
|
+
|
|
33
|
+
for (const [ sfuTransportId, sfuTransport ] of storages.sfuTransportStorage.localEntries()) {
|
|
33
34
|
if (updatedSfuTransports.has(sfuTransportId)) {
|
|
34
35
|
continue;
|
|
35
36
|
}
|
|
36
37
|
|
|
37
38
|
const { touched, sfuId } = sfuTransport;
|
|
39
|
+
|
|
38
40
|
if (touched && now - touched < maxIdleTimeInMs) {
|
|
39
|
-
if (!deletedSfus.has(sfuId ??
|
|
41
|
+
if (!deletedSfus.has(sfuId ?? 'not exists')) {
|
|
40
42
|
continue;
|
|
41
43
|
}
|
|
42
44
|
}
|
|
@@ -45,6 +47,7 @@ export function createDeleteOutdatedSfuEntries(
|
|
|
45
47
|
|
|
46
48
|
if (sfuId) {
|
|
47
49
|
let storedSfu = updatedSfus.get(sfuId);
|
|
50
|
+
|
|
48
51
|
if (storedSfu) {
|
|
49
52
|
storedSfu.sfuTransportIds = storedSfu.sfuTransportIds.filter((transportId) => transportId !== sfuTransportId);
|
|
50
53
|
} else {
|
|
@@ -57,17 +60,18 @@ export function createDeleteOutdatedSfuEntries(
|
|
|
57
60
|
}
|
|
58
61
|
}
|
|
59
62
|
|
|
60
|
-
for (const [sfuInboundPadId, sfuInboundPad] of storages.sfuInboundRtpPadStorage.localEntries()) {
|
|
63
|
+
for (const [ sfuInboundPadId, sfuInboundPad ] of storages.sfuInboundRtpPadStorage.localEntries()) {
|
|
61
64
|
if (updatedSfuInboundRtpPads.has(sfuInboundPadId)) {
|
|
62
65
|
continue;
|
|
63
66
|
}
|
|
64
67
|
|
|
65
68
|
const { touched, sfuTransportId, sfuId } = sfuInboundPad;
|
|
69
|
+
|
|
66
70
|
if (touched && now - touched < maxIdleTimeInMs) {
|
|
67
71
|
if (
|
|
68
|
-
!deletedSfuTransports.has(sfuTransportId ??
|
|
69
|
-
!deletedSfus.has(sfuId ??
|
|
70
|
-
){
|
|
72
|
+
!deletedSfuTransports.has(sfuTransportId ?? 'not exists') &&
|
|
73
|
+
!deletedSfus.has(sfuId ?? 'not exists')
|
|
74
|
+
) {
|
|
71
75
|
continue;
|
|
72
76
|
}
|
|
73
77
|
}
|
|
@@ -76,6 +80,7 @@ export function createDeleteOutdatedSfuEntries(
|
|
|
76
80
|
|
|
77
81
|
if (sfuTransportId) {
|
|
78
82
|
let storedSfuTransport = updatedSfuTransports.get(sfuTransportId);
|
|
83
|
+
|
|
79
84
|
if (!storedSfuTransport) {
|
|
80
85
|
storedSfuTransport = await storages.sfuTransportStorage.get(sfuTransportId);
|
|
81
86
|
if (storedSfuTransport) {
|
|
@@ -88,18 +93,18 @@ export function createDeleteOutdatedSfuEntries(
|
|
|
88
93
|
}
|
|
89
94
|
}
|
|
90
95
|
|
|
91
|
-
|
|
92
|
-
for (const [sfuOutboundPadId, sfuOutboundPad] of storages.sfuOutboundRtpPadStorage.localEntries()) {
|
|
96
|
+
for (const [ sfuOutboundPadId, sfuOutboundPad ] of storages.sfuOutboundRtpPadStorage.localEntries()) {
|
|
93
97
|
if (updatedSfuOutboundRtpPads.has(sfuOutboundPadId)) {
|
|
94
98
|
continue;
|
|
95
99
|
}
|
|
96
100
|
|
|
97
101
|
const { touched, sfuTransportId, sfuId } = sfuOutboundPad;
|
|
102
|
+
|
|
98
103
|
if (touched && now - touched < maxIdleTimeInMs) {
|
|
99
104
|
if (
|
|
100
|
-
!deletedSfuTransports.has(sfuTransportId ??
|
|
101
|
-
!deletedSfus.has(sfuId ??
|
|
102
|
-
){
|
|
105
|
+
!deletedSfuTransports.has(sfuTransportId ?? 'not exists') &&
|
|
106
|
+
!deletedSfus.has(sfuId ?? 'not exists')
|
|
107
|
+
) {
|
|
103
108
|
continue;
|
|
104
109
|
}
|
|
105
110
|
}
|
|
@@ -108,6 +113,7 @@ export function createDeleteOutdatedSfuEntries(
|
|
|
108
113
|
|
|
109
114
|
if (sfuTransportId) {
|
|
110
115
|
let storedSfuTransport = updatedSfuTransports.get(sfuTransportId);
|
|
116
|
+
|
|
111
117
|
if (!storedSfuTransport) {
|
|
112
118
|
storedSfuTransport = await storages.sfuTransportStorage.get(sfuTransportId);
|
|
113
119
|
if (storedSfuTransport) {
|
|
@@ -120,17 +126,18 @@ export function createDeleteOutdatedSfuEntries(
|
|
|
120
126
|
}
|
|
121
127
|
}
|
|
122
128
|
|
|
123
|
-
for (const [sctpChannelId, sctpChannel] of storages.sfuSctpChannelStorage.localEntries()) {
|
|
129
|
+
for (const [ sctpChannelId, sctpChannel ] of storages.sfuSctpChannelStorage.localEntries()) {
|
|
124
130
|
if (updatedSfuSctpChannels.has(sctpChannelId)) {
|
|
125
131
|
continue;
|
|
126
132
|
}
|
|
127
133
|
|
|
128
134
|
const { touched, sfuTransportId, sfuId } = sctpChannel;
|
|
135
|
+
|
|
129
136
|
if (touched && now - touched < maxIdleTimeInMs) {
|
|
130
137
|
if (
|
|
131
|
-
!deletedSfuTransports.has(sfuTransportId ??
|
|
132
|
-
!deletedSfus.has(sfuId ??
|
|
133
|
-
){
|
|
138
|
+
!deletedSfuTransports.has(sfuTransportId ?? 'not exists') &&
|
|
139
|
+
!deletedSfus.has(sfuId ?? 'not exists')
|
|
140
|
+
) {
|
|
134
141
|
continue;
|
|
135
142
|
}
|
|
136
143
|
}
|
|
@@ -139,6 +146,7 @@ export function createDeleteOutdatedSfuEntries(
|
|
|
139
146
|
|
|
140
147
|
if (sfuTransportId) {
|
|
141
148
|
let storedSfuTransport = updatedSfuTransports.get(sfuTransportId);
|
|
149
|
+
|
|
142
150
|
if (!storedSfuTransport) {
|
|
143
151
|
storedSfuTransport = await storages.sfuTransportStorage.get(sfuTransportId);
|
|
144
152
|
if (storedSfuTransport) {
|
|
@@ -155,5 +163,6 @@ export function createDeleteOutdatedSfuEntries(
|
|
|
155
163
|
await process(context);
|
|
156
164
|
if (next) await next(context);
|
|
157
165
|
};
|
|
166
|
+
|
|
158
167
|
return result;
|
|
159
168
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createLogger } from '../common/logger';
|
|
2
2
|
import { Middleware } from './Middleware';
|
|
3
3
|
|
|
4
|
-
const logger = createLogger(
|
|
4
|
+
const logger = createLogger('Middleware');
|
|
5
5
|
|
|
6
6
|
export interface Processor<T> {
|
|
7
7
|
use(value: T): Promise<void | T>;
|
|
@@ -11,12 +11,13 @@ export interface Processor<T> {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
export function createProcessor<T>(...processes: Middleware<T>[]): Processor<T> {
|
|
14
|
-
const stack: Middleware<T>[] = [...processes];
|
|
14
|
+
const stack: Middleware<T>[] = [ ...processes ];
|
|
15
15
|
const result: Processor<T> = {
|
|
16
|
-
addMiddleware: (...
|
|
17
|
-
if (
|
|
18
|
-
stack.push(...
|
|
16
|
+
addMiddleware: (...middlewares: Middleware<T>[]) => {
|
|
17
|
+
if (middlewares && 0 < middlewares.length) {
|
|
18
|
+
stack.push(...middlewares);
|
|
19
19
|
}
|
|
20
|
+
|
|
20
21
|
return result;
|
|
21
22
|
},
|
|
22
23
|
|
|
@@ -24,9 +25,11 @@ export function createProcessor<T>(...processes: Middleware<T>[]): Processor<T>
|
|
|
24
25
|
if (middlewares && 0 < middlewares.length) {
|
|
25
26
|
for (const middleware of middlewares) {
|
|
26
27
|
const index = stack.indexOf(middleware);
|
|
28
|
+
|
|
27
29
|
if (0 < index) stack.splice(index, 1);
|
|
28
30
|
}
|
|
29
31
|
}
|
|
32
|
+
|
|
30
33
|
return result;
|
|
31
34
|
},
|
|
32
35
|
use: async (value: T): Promise<void> => {
|
|
@@ -37,8 +40,10 @@ export function createProcessor<T>(...processes: Middleware<T>[]): Processor<T>
|
|
|
37
40
|
|
|
38
41
|
const process = stack[index];
|
|
39
42
|
const next = async (nextInput: T) => await executeMiddleware(nextInput, index + 1);
|
|
43
|
+
|
|
40
44
|
return process(input, next).catch((err) => {
|
|
41
45
|
logger.error(`Error occurred executing process ${process.name}`, err);
|
|
46
|
+
|
|
42
47
|
return;
|
|
43
48
|
});
|
|
44
49
|
};
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { StorageProvider } from '../storages/StorageProvider';
|
|
2
|
-
import { createProcessor, Processor } from './Processor';
|
|
3
2
|
import * as Models from '../models/Models';
|
|
4
3
|
import { ObservedCalls } from '../samples/ObservedCalls';
|
|
5
|
-
import { ReportsCollector } from '../common/ReportsCollector';
|
|
6
4
|
import { v4 as uuid } from 'uuid';
|
|
7
5
|
import { EvaluatorContext } from '../common/types';
|
|
8
6
|
import { Writable } from '../common/utils';
|
|
@@ -173,5 +171,6 @@ export async function createTransactionContext(
|
|
|
173
171
|
|
|
174
172
|
evaluatorContext,
|
|
175
173
|
};
|
|
174
|
+
|
|
176
175
|
return transactionContext;
|
|
177
176
|
}
|
|
@@ -50,8 +50,8 @@ export function createVisitObservedCallsMiddleware(
|
|
|
50
50
|
} : await findRemoteMatchFunc(
|
|
51
51
|
storages,
|
|
52
52
|
clients,
|
|
53
|
-
new Map<string, InboundTrack>([...updatedInboundAudioTracks, ...updatedInboundVideoTracks])
|
|
54
|
-
)
|
|
53
|
+
new Map<string, InboundTrack>([ ...updatedInboundAudioTracks, ...updatedInboundVideoTracks ])
|
|
54
|
+
);
|
|
55
55
|
|
|
56
56
|
const now = BigInt(Date.now());
|
|
57
57
|
const fakeTouched = { touched: BigInt(0) };
|
|
@@ -82,6 +82,7 @@ export function createVisitObservedCallsMiddleware(
|
|
|
82
82
|
visitPeerConnection(observedPeerConnection, storedClient, updatedPeerConnections, reports, fetchSamples);
|
|
83
83
|
|
|
84
84
|
const storedPeerConnection = updatedPeerConnections.get(peerConnectionId);
|
|
85
|
+
|
|
85
86
|
if (!storedPeerConnection) {
|
|
86
87
|
// should not happen, as the visit function should add the peer connection if it does not exists
|
|
87
88
|
logger.warn(
|
|
@@ -95,6 +96,7 @@ export function createVisitObservedCallsMiddleware(
|
|
|
95
96
|
|
|
96
97
|
for (const observedInboundAudioTrack of observedPeerConnection.inboundAudioTracks()) {
|
|
97
98
|
const { trackId } = observedInboundAudioTrack;
|
|
99
|
+
|
|
98
100
|
visitInboundAudioTrack(
|
|
99
101
|
observedInboundAudioTrack,
|
|
100
102
|
storedPeerConnection,
|
|
@@ -165,5 +167,6 @@ export function createVisitObservedCallsMiddleware(
|
|
|
165
167
|
await process(context);
|
|
166
168
|
if (next) await next(context);
|
|
167
169
|
};
|
|
170
|
+
|
|
168
171
|
return result;
|
|
169
172
|
}
|
|
@@ -14,7 +14,7 @@ export function createVisitObservedSfusMiddleware(
|
|
|
14
14
|
reports: ReportsCollector,
|
|
15
15
|
fetchSamples: boolean
|
|
16
16
|
): Middleware<TransactionContext> {
|
|
17
|
-
const process =
|
|
17
|
+
const process = (transaction: TransactionContext) => {
|
|
18
18
|
const {
|
|
19
19
|
observedSfus,
|
|
20
20
|
updatedSfus,
|
|
@@ -84,7 +84,7 @@ export function createVisitObservedSfusMiddleware(
|
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
for (const [sfuId, sfu] of Array.from(updatedSfus.entries())) {
|
|
87
|
+
for (const [ sfuId, sfu ] of Array.from(updatedSfus.entries())) {
|
|
88
88
|
|
|
89
89
|
if (visitedSfuIds.has(sfuId)) {
|
|
90
90
|
continue;
|
|
@@ -95,7 +95,7 @@ export function createVisitObservedSfusMiddleware(
|
|
|
95
95
|
reports.addSfuEventReport({
|
|
96
96
|
serviceId: sfu.serviceId,
|
|
97
97
|
mediaUnitId: sfu.mediaUnitId,
|
|
98
|
-
name:
|
|
98
|
+
name: 'SFU_LEFT',
|
|
99
99
|
sfuId,
|
|
100
100
|
timestamp: Date.now(),
|
|
101
101
|
marker: sfu.marker,
|
|
@@ -104,7 +104,7 @@ export function createVisitObservedSfusMiddleware(
|
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
106
|
|
|
107
|
-
for (const [sfuTransportId, sfuTransport] of Array.from(updatedSfuTransports.entries())) {
|
|
107
|
+
for (const [ sfuTransportId, sfuTransport ] of Array.from(updatedSfuTransports.entries())) {
|
|
108
108
|
if (visitedSfuTransportIds.has(sfuTransportId)) {
|
|
109
109
|
continue;
|
|
110
110
|
}
|
|
@@ -126,7 +126,7 @@ export function createVisitObservedSfusMiddleware(
|
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
-
for (const [padId, sfuInboundRtpPad] of Array.from(updatedSfuInboundRtpPads.entries())) {
|
|
129
|
+
for (const [ padId, sfuInboundRtpPad ] of Array.from(updatedSfuInboundRtpPads.entries())) {
|
|
130
130
|
if (visitedSfuInboundRtpPadIds.has(padId)) {
|
|
131
131
|
continue;
|
|
132
132
|
}
|
|
@@ -148,7 +148,7 @@ export function createVisitObservedSfusMiddleware(
|
|
|
148
148
|
}
|
|
149
149
|
}
|
|
150
150
|
|
|
151
|
-
for (const [padId, sfuOutboundRtpPad] of Array.from(updatedSfuOutboundRtpPads.entries())) {
|
|
151
|
+
for (const [ padId, sfuOutboundRtpPad ] of Array.from(updatedSfuOutboundRtpPads.entries())) {
|
|
152
152
|
if (visitedSfuOutboundRtpPadIds.has(padId)) {
|
|
153
153
|
continue;
|
|
154
154
|
}
|
|
@@ -171,7 +171,7 @@ export function createVisitObservedSfusMiddleware(
|
|
|
171
171
|
}
|
|
172
172
|
}
|
|
173
173
|
|
|
174
|
-
for (const [channelId, sfuSctpChannel] of Array.from(updatedSfuSctpChannels.entries())) {
|
|
174
|
+
for (const [ channelId, sfuSctpChannel ] of Array.from(updatedSfuSctpChannels.entries())) {
|
|
175
175
|
if (visitedSfuSctpChannels.has(channelId)) {
|
|
176
176
|
continue;
|
|
177
177
|
}
|
|
@@ -198,5 +198,6 @@ export function createVisitObservedSfusMiddleware(
|
|
|
198
198
|
await process(context);
|
|
199
199
|
if (next) await next(context);
|
|
200
200
|
};
|
|
201
|
+
|
|
201
202
|
return result;
|
|
202
203
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable camelcase */
|
|
1
2
|
import { ObservedClient } from '../../samples/ObservedClient';
|
|
2
3
|
import * as Models from '../../models/Models';
|
|
3
4
|
import { ReportsCollector } from '../../common/ReportsCollector';
|
|
@@ -35,6 +36,7 @@ export function visitClient(
|
|
|
35
36
|
type: CallMetaType.OPERATION_SYSTEM,
|
|
36
37
|
payload: clientSample.os,
|
|
37
38
|
}, userId);
|
|
39
|
+
|
|
38
40
|
reports.addCallMetaReport(callMetaReport);
|
|
39
41
|
}
|
|
40
42
|
|
|
@@ -52,6 +54,7 @@ export function visitClient(
|
|
|
52
54
|
type: CallMetaType.ENGINE,
|
|
53
55
|
payload: clientSample.engine,
|
|
54
56
|
}, userId);
|
|
57
|
+
|
|
55
58
|
reports.addCallMetaReport(callMetaReport);
|
|
56
59
|
}
|
|
57
60
|
|
|
@@ -70,6 +73,7 @@ export function visitClient(
|
|
|
70
73
|
type: CallMetaType.PLATFORM,
|
|
71
74
|
payload: clientSample.platform,
|
|
72
75
|
}, userId);
|
|
76
|
+
|
|
73
77
|
reports.addCallMetaReport(callMetaReport);
|
|
74
78
|
}
|
|
75
79
|
|
|
@@ -87,6 +91,7 @@ export function visitClient(
|
|
|
87
91
|
type: CallMetaType.BROWSER,
|
|
88
92
|
payload: clientSample.browser,
|
|
89
93
|
}, userId);
|
|
94
|
+
|
|
90
95
|
reports.addCallMetaReport(callMetaReport);
|
|
91
96
|
}
|
|
92
97
|
|
|
@@ -96,10 +101,10 @@ export function visitClient(
|
|
|
96
101
|
type: CallMetaType.MEDIA_CONSTRAINT,
|
|
97
102
|
payload: mediaConstraint,
|
|
98
103
|
}, userId);
|
|
104
|
+
|
|
99
105
|
reports.addCallMetaReport(callMetaReport);
|
|
100
106
|
}
|
|
101
107
|
}
|
|
102
|
-
|
|
103
108
|
|
|
104
109
|
if (clientSample.localSDPs && 0 < clientSample.localSDPs.length) {
|
|
105
110
|
for (const localSDP of clientSample.localSDPs) {
|
|
@@ -107,6 +112,7 @@ export function visitClient(
|
|
|
107
112
|
type: CallMetaType.LOCAL_SDP,
|
|
108
113
|
payload: localSDP,
|
|
109
114
|
}, userId);
|
|
115
|
+
|
|
110
116
|
reports.addCallMetaReport(callMetaReport);
|
|
111
117
|
}
|
|
112
118
|
}
|
|
@@ -148,6 +154,7 @@ export function visitClient(
|
|
|
148
154
|
type: CallMetaType.USER_MEDIA_ERROR,
|
|
149
155
|
payload: userMediaError,
|
|
150
156
|
}, userId);
|
|
157
|
+
|
|
151
158
|
reports.addCallMetaReport(callMetaReport);
|
|
152
159
|
}
|
|
153
160
|
}
|
|
@@ -158,6 +165,7 @@ export function visitClient(
|
|
|
158
165
|
type: CallMetaType.CERTIFICATE,
|
|
159
166
|
payload: certificate,
|
|
160
167
|
}, userId);
|
|
168
|
+
|
|
161
169
|
reports.addCallMetaReport(callMetaReport);
|
|
162
170
|
}
|
|
163
171
|
}
|
|
@@ -168,6 +176,7 @@ export function visitClient(
|
|
|
168
176
|
type: CallMetaType.CODEC,
|
|
169
177
|
payload: codec,
|
|
170
178
|
}, userId);
|
|
179
|
+
|
|
171
180
|
reports.addCallMetaReport(callMetaReport);
|
|
172
181
|
}
|
|
173
182
|
}
|
|
@@ -178,6 +187,7 @@ export function visitClient(
|
|
|
178
187
|
type: CallMetaType.ICE_SERVER,
|
|
179
188
|
payload: iceServer,
|
|
180
189
|
}, userId);
|
|
190
|
+
|
|
181
191
|
reports.addCallMetaReport(callMetaReport);
|
|
182
192
|
}
|
|
183
193
|
}
|
|
@@ -188,6 +198,7 @@ export function visitClient(
|
|
|
188
198
|
type: CallMetaType.MEDIA_DEVICE,
|
|
189
199
|
payload: mediaDevice,
|
|
190
200
|
}, userId);
|
|
201
|
+
|
|
191
202
|
reports.addCallMetaReport(callMetaReport);
|
|
192
203
|
}
|
|
193
204
|
}
|
|
@@ -198,6 +209,7 @@ export function visitClient(
|
|
|
198
209
|
type: CallMetaType.MEDIA_SOURCE,
|
|
199
210
|
payload: mediaSource,
|
|
200
211
|
}, userId);
|
|
212
|
+
|
|
201
213
|
reports.addCallMetaReport(callMetaReport);
|
|
202
214
|
}
|
|
203
215
|
}
|
|
@@ -208,6 +220,7 @@ export function visitClient(
|
|
|
208
220
|
type: CallMetaType.ICE_LOCAL_CANDIDATE,
|
|
209
221
|
payload: iceLocalCandidate,
|
|
210
222
|
}, userId);
|
|
223
|
+
|
|
211
224
|
reports.addCallMetaReport(callMetaReport);
|
|
212
225
|
}
|
|
213
226
|
}
|
|
@@ -218,6 +231,7 @@ export function visitClient(
|
|
|
218
231
|
type: CallMetaType.ICE_REMOTE_CANDIDATE,
|
|
219
232
|
payload: iceRemoteCandidate,
|
|
220
233
|
}, userId);
|
|
234
|
+
|
|
221
235
|
reports.addCallMetaReport(callMetaReport);
|
|
222
236
|
}
|
|
223
237
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable camelcase */
|
|
1
2
|
import * as Models from '../../models/Models';
|
|
2
3
|
import { ReportsCollector } from '../../common/ReportsCollector';
|
|
3
4
|
import { ObservedInboundAudioTrack } from '../../samples/ObservedInboundAudioTrack';
|
|
@@ -30,6 +31,7 @@ export function visitInboundAudioTrack(
|
|
|
30
31
|
const { serviceId, roomId, callId } = observedInboundAudioTrack.peerConnection.client.call;
|
|
31
32
|
|
|
32
33
|
let storedInboundAudioTrack = storedInboundTracks.get(trackId);
|
|
34
|
+
|
|
33
35
|
if (!storedInboundAudioTrack) {
|
|
34
36
|
storedInboundAudioTrack = new Models.InboundTrack({
|
|
35
37
|
serviceId,
|
|
@@ -74,6 +76,7 @@ export function visitInboundAudioTrack(
|
|
|
74
76
|
remotePeerConnectionId,
|
|
75
77
|
remoteTrackId,
|
|
76
78
|
};
|
|
79
|
+
|
|
77
80
|
reports.addInboundAudioTrackReport(report);
|
|
78
81
|
|
|
79
82
|
if (fetchSamples) {
|
|
@@ -103,6 +106,6 @@ export function visitInboundAudioTrack(
|
|
|
103
106
|
statsMap.set(ssrc, videoStats);
|
|
104
107
|
}
|
|
105
108
|
}
|
|
106
|
-
storedInboundAudioTrack.ssrc = [...statsMap.keys()];
|
|
109
|
+
storedInboundAudioTrack.ssrc = [ ...statsMap.keys() ];
|
|
107
110
|
storedInboundAudioTrack.videoStats = Array.from(statsMap.values());
|
|
108
111
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable camelcase */
|
|
1
2
|
import { InboundVideoTrackReport } from '@observertc/report-schemas-js';
|
|
2
3
|
import { ReportsCollector } from '../../common/ReportsCollector';
|
|
3
4
|
import { ObservedInboundVideoTrack } from '../../samples/ObservedInboundVideoTrack';
|
|
@@ -32,6 +33,7 @@ export function visitInboundVideoTrack(
|
|
|
32
33
|
const { serviceId, roomId, callId } = observedInboundVideoTrack.peerConnection.client.call;
|
|
33
34
|
|
|
34
35
|
let storedInboundVideoTrack = storedInboundTracks.get(trackId);
|
|
36
|
+
|
|
35
37
|
if (!storedInboundVideoTrack) {
|
|
36
38
|
storedInboundVideoTrack = new Models.InboundTrack({
|
|
37
39
|
serviceId,
|
|
@@ -60,6 +62,7 @@ export function visitInboundVideoTrack(
|
|
|
60
62
|
}
|
|
61
63
|
|
|
62
64
|
const statsMap = new Map<bigint, Samples_ClientSample_InboundVideoTrack>();
|
|
65
|
+
|
|
63
66
|
for (const inboundVideoSample of observedInboundVideoTrack.samples()) {
|
|
64
67
|
const report: InboundVideoTrackReport = {
|
|
65
68
|
serviceId,
|
|
@@ -76,6 +79,7 @@ export function visitInboundVideoTrack(
|
|
|
76
79
|
remotePeerConnectionId,
|
|
77
80
|
remoteTrackId,
|
|
78
81
|
};
|
|
82
|
+
|
|
79
83
|
reports.addInboundVideoTrackReport(report);
|
|
80
84
|
|
|
81
85
|
if (fetchSamples) {
|
|
@@ -107,6 +111,6 @@ export function visitInboundVideoTrack(
|
|
|
107
111
|
statsMap.set(ssrc, videoStats);
|
|
108
112
|
}
|
|
109
113
|
}
|
|
110
|
-
storedInboundVideoTrack.ssrc = [...statsMap.keys()];
|
|
114
|
+
storedInboundVideoTrack.ssrc = [ ...statsMap.keys() ];
|
|
111
115
|
storedInboundVideoTrack.videoStats = Array.from(statsMap.values());
|
|
112
116
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable camelcase */
|
|
1
2
|
import * as Models from '../../models/Models';
|
|
2
3
|
import { ReportsCollector } from '../../common/ReportsCollector';
|
|
3
4
|
import { ObservedOutboundAudioTrack } from '../../samples/ObservedOutboundAudioTrack';
|
|
@@ -27,6 +28,7 @@ export function visitOutboundAudioTrack(
|
|
|
27
28
|
const { serviceId, roomId, callId } = observedOutboundAudioTrack.peerConnection.client.call;
|
|
28
29
|
|
|
29
30
|
let storedOutboundAudioTrack = storedOutboundTracks.get(trackId);
|
|
31
|
+
|
|
30
32
|
if (!storedOutboundAudioTrack) {
|
|
31
33
|
storedOutboundAudioTrack = new Models.OutboundTrack({
|
|
32
34
|
serviceId,
|
|
@@ -53,6 +55,7 @@ export function visitOutboundAudioTrack(
|
|
|
53
55
|
}
|
|
54
56
|
|
|
55
57
|
const statsMap = new Map<bigint, Samples_ClientSample_OutboundAudioTrack>();
|
|
58
|
+
|
|
56
59
|
for (const outboundAudioSample of observedOutboundAudioTrack.samples()) {
|
|
57
60
|
const report: OutboundAudioTrackReport = {
|
|
58
61
|
serviceId,
|
|
@@ -66,6 +69,7 @@ export function visitOutboundAudioTrack(
|
|
|
66
69
|
timestamp,
|
|
67
70
|
sampleSeq: -1,
|
|
68
71
|
};
|
|
72
|
+
|
|
69
73
|
reports.addOutboundAudioTrackReport(report);
|
|
70
74
|
|
|
71
75
|
if (fetchSamples) {
|
|
@@ -91,6 +95,6 @@ export function visitOutboundAudioTrack(
|
|
|
91
95
|
statsMap.set(ssrc, audioStats);
|
|
92
96
|
}
|
|
93
97
|
}
|
|
94
|
-
storedOutboundAudioTrack.ssrc = [...statsMap.keys()];
|
|
98
|
+
storedOutboundAudioTrack.ssrc = [ ...statsMap.keys() ];
|
|
95
99
|
storedOutboundAudioTrack.audioStats = Array.from(statsMap.values());
|
|
96
100
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable camelcase */
|
|
1
2
|
import * as Models from '../../models/Models';
|
|
2
3
|
import { ReportsCollector } from '../../common/ReportsCollector';
|
|
3
4
|
import { ObservedOutboundVideoTrack } from '../../samples/ObservedOutboundVideoTrack';
|
|
@@ -27,6 +28,7 @@ export function visitOutboundVideoTrack(
|
|
|
27
28
|
const { serviceId, roomId, callId } = observedOutboundVideoTrack.peerConnection.client.call;
|
|
28
29
|
|
|
29
30
|
let storedOutboundVideoTrack = storedOutboundTracks.get(trackId);
|
|
31
|
+
|
|
30
32
|
if (!storedOutboundVideoTrack) {
|
|
31
33
|
storedOutboundVideoTrack = new Models.OutboundTrack({
|
|
32
34
|
serviceId,
|
|
@@ -53,6 +55,7 @@ export function visitOutboundVideoTrack(
|
|
|
53
55
|
}
|
|
54
56
|
|
|
55
57
|
const statsMap = new Map<bigint, Samples_ClientSample_OutboundVideoTrack>();
|
|
58
|
+
|
|
56
59
|
for (const outboundVideoSample of observedOutboundVideoTrack.samples()) {
|
|
57
60
|
const report: OutboundVideoTrackReport = {
|
|
58
61
|
serviceId,
|
|
@@ -66,6 +69,7 @@ export function visitOutboundVideoTrack(
|
|
|
66
69
|
timestamp,
|
|
67
70
|
sampleSeq: -1,
|
|
68
71
|
};
|
|
72
|
+
|
|
69
73
|
reports.addOutboundVideoTrackReport(report);
|
|
70
74
|
|
|
71
75
|
if (fetchSamples) {
|
|
@@ -93,6 +97,6 @@ export function visitOutboundVideoTrack(
|
|
|
93
97
|
statsMap.set(ssrc, videoStats);
|
|
94
98
|
}
|
|
95
99
|
}
|
|
96
|
-
storedOutboundVideoTrack.ssrc = [...statsMap.keys()];
|
|
100
|
+
storedOutboundVideoTrack.ssrc = [ ...statsMap.keys() ];
|
|
97
101
|
storedOutboundVideoTrack.videoStats = Array.from(statsMap.values());
|
|
98
102
|
}
|