@observertc/observer-js 0.9.11-beta → 0.9.12-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/Evaluator.d.ts +2 -0
- package/lib/Evaluator.d.ts.map +1 -1
- package/lib/Evaluator.js +2 -1
- package/lib/Observer.d.ts.map +1 -1
- package/lib/Observer.js +1 -0
- package/lib/common/callMetaReports.d.ts +1 -1
- package/lib/common/callMetaReports.d.ts.map +1 -1
- package/lib/common/callMetaReports.js +2 -1
- package/lib/common/utils.d.ts +1 -0
- package/lib/common/utils.d.ts.map +1 -1
- package/lib/common/utils.js +12 -0
- package/lib/middlewares/DeleteOutdatedCallEntries.d.ts +6 -0
- package/lib/middlewares/DeleteOutdatedCallEntries.d.ts.map +1 -0
- package/lib/middlewares/DeleteOutdatedCallEntries.js +112 -0
- package/lib/middlewares/DeleteOutdatedSfuEntries.d.ts +6 -0
- package/lib/middlewares/DeleteOutdatedSfuEntries.d.ts.map +1 -0
- package/lib/middlewares/DeleteOutdatedSfuEntries.js +118 -0
- package/lib/middlewares/TransactionContext.d.ts.map +1 -1
- package/lib/middlewares/TransactionContext.js +42 -26
- package/lib/middlewares/TransactoinProcessor.d.ts +1 -1
- package/lib/middlewares/TransactoinProcessor.d.ts.map +1 -1
- package/lib/middlewares/TransactoinProcessor.js +4 -2
- package/lib/middlewares/VisitObservedCallsMiddleware.d.ts +2 -1
- package/lib/middlewares/VisitObservedCallsMiddleware.d.ts.map +1 -1
- package/lib/middlewares/VisitObservedCallsMiddleware.js +19 -90
- package/lib/middlewares/visitors/visitClient.d.ts.map +1 -1
- package/lib/middlewares/visitors/visitClient.js +15 -13
- package/lib/middlewares/visitors/visitInboundAudioTrack.d.ts +1 -1
- package/lib/middlewares/visitors/visitInboundAudioTrack.d.ts.map +1 -1
- package/lib/middlewares/visitors/visitInboundAudioTrack.js +10 -2
- package/lib/middlewares/visitors/visitInboundVideoTrack.d.ts +1 -1
- package/lib/middlewares/visitors/visitInboundVideoTrack.d.ts.map +1 -1
- package/lib/middlewares/visitors/visitInboundVideoTrack.js +10 -2
- package/lib/middlewares/visitors/visitOutboundAudioTrack.d.ts.map +1 -1
- package/lib/middlewares/visitors/visitOutboundAudioTrack.js +5 -1
- package/lib/middlewares/visitors/visitOutboundVideoTarck.d.ts.map +1 -1
- package/lib/middlewares/visitors/visitOutboundVideoTarck.js +5 -1
- package/lib/middlewares/visitors/visitPeerConnection.d.ts.map +1 -1
- package/lib/middlewares/visitors/visitPeerConnection.js +15 -0
- package/lib/models/Models.d.ts +26 -22
- package/lib/models/Models.d.ts.map +1 -1
- package/lib/models/Models.js +16 -11
- package/lib/processes/findRemoteMatches.d.ts +9 -0
- package/lib/processes/findRemoteMatches.d.ts.map +1 -0
- package/lib/processes/findRemoteMatches.js +83 -0
- package/lib/samples/ObservedCalls.d.ts.map +1 -1
- package/lib/samples/ObservedCalls.js +16 -7
- package/lib/samples/ObservedInboundAudioTrack.d.ts +2 -0
- package/lib/samples/ObservedInboundAudioTrack.d.ts.map +1 -1
- package/lib/samples/ObservedInboundVideoTrack.d.ts +2 -0
- package/lib/samples/ObservedInboundVideoTrack.d.ts.map +1 -1
- package/lib/samples/ObservedOutboundAudioTrack.d.ts +1 -0
- package/lib/samples/ObservedOutboundAudioTrack.d.ts.map +1 -1
- package/lib/samples/ObservedOutboundVideoTrack.d.ts +1 -0
- package/lib/samples/ObservedOutboundVideoTrack.d.ts.map +1 -1
- package/lib/samples/ObservedPeerConnection.d.ts.map +1 -1
- package/lib/samples/ObservedPeerConnection.js +14 -8
- package/lib/samples/ObservedSfus.d.ts.map +1 -1
- package/lib/samples/ObservedSfus.js +10 -4
- package/lib/storages/ObserverStorage.d.ts +4 -0
- package/lib/storages/ObserverStorage.d.ts.map +1 -1
- package/lib/storages/SimpleStorage.d.ts +1 -0
- package/lib/storages/SimpleStorage.d.ts.map +1 -1
- package/lib/storages/SimpleStorage.js +3 -0
- package/package.json +1 -1
- package/src/Evaluator.ts +7 -3
- package/src/Observer.ts +1 -0
- package/src/common/callMetaReports.ts +2 -0
- package/src/common/utils.ts +11 -0
- package/src/middlewares/DeleteOutdatedCallEntries.ts +151 -0
- package/src/middlewares/DeleteOutdatedSfuEntries.ts +159 -0
- package/src/middlewares/TransactionContext.ts +61 -29
- package/src/middlewares/TransactoinProcessor.ts +8 -2
- package/src/middlewares/VisitObservedCallsMiddleware.ts +40 -125
- package/src/middlewares/visitors/visitClient.ts +15 -13
- package/src/middlewares/visitors/visitInboundAudioTrack.ts +15 -5
- package/src/middlewares/visitors/visitInboundVideoTrack.ts +14 -2
- package/src/middlewares/visitors/visitOutboundAudioTrack.ts +6 -2
- package/src/middlewares/visitors/visitOutboundVideoTarck.ts +5 -1
- package/src/middlewares/visitors/visitPeerConnection.ts +17 -1
- package/src/models/Models.ts +40 -34
- package/src/processes/findRemoteMatches.ts +94 -0
- package/src/samples/ObservedCalls.ts +17 -7
- package/src/samples/ObservedInboundAudioTrack.ts +2 -0
- package/src/samples/ObservedInboundVideoTrack.ts +3 -1
- package/src/samples/ObservedOutboundAudioTrack.ts +2 -1
- package/src/samples/ObservedOutboundVideoTrack.ts +2 -1
- package/src/samples/ObservedPeerConnection.ts +28 -8
- package/src/samples/ObservedSfus.ts +10 -5
- package/src/storages/ObserverStorage.ts +5 -0
- package/src/storages/SimpleStorage.ts +4 -0
|
@@ -8,31 +8,29 @@ import { visitInboundAudioTrack } from './visitors/visitInboundAudioTrack';
|
|
|
8
8
|
import { visitOutboundAudioTrack } from './visitors/visitOutboundAudioTrack';
|
|
9
9
|
import { visitOutboundVideoTrack } from './visitors/visitOutboundVideoTarck';
|
|
10
10
|
import { visitInboundVideoTrack } from './visitors/visitInboundVideoTrack';
|
|
11
|
+
import { InboundTrack } from '../models/Models';
|
|
12
|
+
import { StorageProvider } from '../storages/StorageProvider';
|
|
13
|
+
import { findRemoteMatches as findRemoteMatchFunc } from '../processes/findRemoteMatches';
|
|
11
14
|
|
|
12
15
|
export const logger = createLogger('VisitObservedCallsMiddleware');
|
|
13
16
|
|
|
17
|
+
const emptyMap = new Map();
|
|
18
|
+
|
|
14
19
|
export function createVisitObservedCallsMiddleware(
|
|
20
|
+
storages: StorageProvider,
|
|
15
21
|
reports: ReportsCollector,
|
|
16
|
-
fetchSamples: boolean
|
|
22
|
+
fetchSamples: boolean,
|
|
23
|
+
findRemoteMatches?: boolean,
|
|
17
24
|
): Middleware<TransactionContext> {
|
|
18
25
|
const process = async (transaction: TransactionContext) => {
|
|
19
26
|
const {
|
|
20
27
|
observedCalls,
|
|
21
28
|
clients,
|
|
22
29
|
updatedPeerConnections,
|
|
23
|
-
deletedPeerConnections,
|
|
24
|
-
|
|
25
30
|
updatedInboundAudioTracks,
|
|
26
|
-
deletedInboundAudioTracks,
|
|
27
|
-
|
|
28
31
|
updatedInboundVideoTracks,
|
|
29
|
-
deletedInboundVideoTracks,
|
|
30
|
-
|
|
31
32
|
updatedOutboundAudioTracks,
|
|
32
|
-
deletedOutboundAudioTracks,
|
|
33
|
-
|
|
34
33
|
updatedOutboundVideoTracks,
|
|
35
|
-
deletedOutboundVideoTracks,
|
|
36
34
|
} = transaction;
|
|
37
35
|
|
|
38
36
|
const visitedPeerConnectionIds = new Set<string>();
|
|
@@ -40,6 +38,23 @@ export function createVisitObservedCallsMiddleware(
|
|
|
40
38
|
const visitedInboundVideoTrackIds = new Set<string>();
|
|
41
39
|
const visitedOutboundAudioTrackIds = new Set<string>();
|
|
42
40
|
const visitedOutboundVideoTrackIds = new Set<string>();
|
|
41
|
+
|
|
42
|
+
const {
|
|
43
|
+
remoteTrackIds,
|
|
44
|
+
remotePeerConnectionIds,
|
|
45
|
+
remoteClientIds
|
|
46
|
+
} = !findRemoteMatches ? {
|
|
47
|
+
remoteTrackIds: emptyMap,
|
|
48
|
+
remotePeerConnectionIds: emptyMap,
|
|
49
|
+
remoteClientIds: emptyMap,
|
|
50
|
+
} : await findRemoteMatchFunc(
|
|
51
|
+
storages,
|
|
52
|
+
clients,
|
|
53
|
+
new Map<string, InboundTrack>([...updatedInboundAudioTracks, ...updatedInboundVideoTracks])
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
const now = BigInt(Date.now());
|
|
57
|
+
const fakeTouched = { touched: BigInt(0) };
|
|
43
58
|
|
|
44
59
|
for (const observedCall of observedCalls.observedCalls()) {
|
|
45
60
|
const { callId, serviceId, roomId } = observedCall;
|
|
@@ -48,7 +63,6 @@ export function createVisitObservedCallsMiddleware(
|
|
|
48
63
|
const { clientId } = observedClient;
|
|
49
64
|
const storedClient = clients.get(clientId);
|
|
50
65
|
|
|
51
|
-
// console.warn("dskfjhdkfhsdkf", observedClient, storedClient);
|
|
52
66
|
if (!storedClient) {
|
|
53
67
|
// should not happen as client joined must have run before this
|
|
54
68
|
logger.warn('Client has not been registered');
|
|
@@ -61,7 +75,7 @@ export function createVisitObservedCallsMiddleware(
|
|
|
61
75
|
reports,
|
|
62
76
|
fetchSamples
|
|
63
77
|
);
|
|
64
|
-
|
|
78
|
+
|
|
65
79
|
for (const observedPeerConnection of observedClient.observedPeerConnections()) {
|
|
66
80
|
const { peerConnectionId } = observedPeerConnection;
|
|
67
81
|
|
|
@@ -75,7 +89,8 @@ export function createVisitObservedCallsMiddleware(
|
|
|
75
89
|
);
|
|
76
90
|
continue;
|
|
77
91
|
}
|
|
78
|
-
|
|
92
|
+
|
|
93
|
+
storedPeerConnection.touched = now;
|
|
79
94
|
visitedPeerConnectionIds.add(peerConnectionId);
|
|
80
95
|
|
|
81
96
|
for (const observedInboundAudioTrack of observedPeerConnection.inboundAudioTracks()) {
|
|
@@ -85,10 +100,14 @@ export function createVisitObservedCallsMiddleware(
|
|
|
85
100
|
storedPeerConnection,
|
|
86
101
|
updatedInboundAudioTracks,
|
|
87
102
|
reports,
|
|
88
|
-
fetchSamples
|
|
103
|
+
fetchSamples,
|
|
104
|
+
remoteTrackIds.get(trackId),
|
|
105
|
+
remotePeerConnectionIds.get(trackId),
|
|
106
|
+
remoteClientIds.get(trackId),
|
|
89
107
|
);
|
|
90
108
|
|
|
91
109
|
visitedInboundAudioTrackIds.add(trackId);
|
|
110
|
+
(updatedInboundAudioTracks.get(trackId) ?? fakeTouched).touched = now;
|
|
92
111
|
}
|
|
93
112
|
|
|
94
113
|
for (const observedInboundVideoTrack of observedPeerConnection.inboundVideoTracks()) {
|
|
@@ -99,10 +118,14 @@ export function createVisitObservedCallsMiddleware(
|
|
|
99
118
|
storedPeerConnection,
|
|
100
119
|
updatedInboundVideoTracks,
|
|
101
120
|
reports,
|
|
102
|
-
fetchSamples
|
|
121
|
+
fetchSamples,
|
|
122
|
+
remoteTrackIds.get(trackId),
|
|
123
|
+
remotePeerConnectionIds.get(trackId),
|
|
124
|
+
remoteClientIds.get(trackId),
|
|
103
125
|
);
|
|
104
126
|
|
|
105
127
|
visitedInboundVideoTrackIds.add(trackId);
|
|
128
|
+
(updatedInboundVideoTracks.get(trackId) ?? fakeTouched).touched = now;
|
|
106
129
|
}
|
|
107
130
|
|
|
108
131
|
for (const observedOutboundAudioTrack of observedPeerConnection.outboundAudioTracks()) {
|
|
@@ -117,6 +140,7 @@ export function createVisitObservedCallsMiddleware(
|
|
|
117
140
|
);
|
|
118
141
|
|
|
119
142
|
visitedOutboundAudioTrackIds.add(trackId);
|
|
143
|
+
(updatedOutboundAudioTracks.get(trackId) ?? fakeTouched).touched = now;
|
|
120
144
|
}
|
|
121
145
|
|
|
122
146
|
for (const observedOutboundVideoTrack of observedPeerConnection.outboundVideoTracks()) {
|
|
@@ -131,120 +155,11 @@ export function createVisitObservedCallsMiddleware(
|
|
|
131
155
|
);
|
|
132
156
|
|
|
133
157
|
visitedOutboundVideoTrackIds.add(trackId);
|
|
158
|
+
(updatedOutboundVideoTracks.get(trackId) ?? fakeTouched).touched = now;
|
|
134
159
|
}
|
|
135
160
|
}
|
|
136
161
|
}
|
|
137
162
|
}
|
|
138
|
-
|
|
139
|
-
for (const [peerConnectionId, peerConnection] of Array.from(updatedPeerConnections.entries())) {
|
|
140
|
-
if (visitedPeerConnectionIds.has(peerConnectionId)) {
|
|
141
|
-
continue;
|
|
142
|
-
}
|
|
143
|
-
// delete PeerConnection
|
|
144
|
-
const { serviceId, callId, clientId } = peerConnection;
|
|
145
|
-
|
|
146
|
-
if (!serviceId || !callId || !clientId) {
|
|
147
|
-
continue;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
const storedClient = clients.get(clientId);
|
|
151
|
-
|
|
152
|
-
updatedPeerConnections.delete(peerConnectionId);
|
|
153
|
-
deletedPeerConnections.add(peerConnectionId);
|
|
154
|
-
|
|
155
|
-
// also update the client model
|
|
156
|
-
if (storedClient) {
|
|
157
|
-
storedClient.peerConnectionIds = storedClient.peerConnectionIds.filter((pcId) => pcId !== peerConnectionId);
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
for (const [trackId, inboundAudioTrack] of Array.from(updatedInboundAudioTracks.entries())) {
|
|
162
|
-
if (visitedInboundAudioTrackIds.has(trackId)) {
|
|
163
|
-
continue;
|
|
164
|
-
}
|
|
165
|
-
// delete PeerConnection
|
|
166
|
-
const { serviceId, callId, clientId, peerConnectionId } = inboundAudioTrack;
|
|
167
|
-
|
|
168
|
-
if (!serviceId || !callId || !clientId || !peerConnectionId) {
|
|
169
|
-
continue;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
const storedPeerConnection = updatedPeerConnections.get(peerConnectionId);
|
|
173
|
-
|
|
174
|
-
updatedInboundAudioTracks.delete(peerConnectionId);
|
|
175
|
-
deletedInboundAudioTracks.add(peerConnectionId);
|
|
176
|
-
|
|
177
|
-
// also update the peer connection model
|
|
178
|
-
if (storedPeerConnection) {
|
|
179
|
-
storedPeerConnection.inboundTrackIds = storedPeerConnection.inboundTrackIds.filter((tId) => tId !== trackId);
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
for (const [trackId, inboundVideoTrack] of Array.from(updatedInboundVideoTracks.entries())) {
|
|
184
|
-
if (visitedInboundVideoTrackIds.has(trackId)) {
|
|
185
|
-
continue;
|
|
186
|
-
}
|
|
187
|
-
// delete PeerConnection
|
|
188
|
-
const { serviceId, callId, clientId, peerConnectionId } = inboundVideoTrack;
|
|
189
|
-
|
|
190
|
-
if (!serviceId || !callId || !clientId || !peerConnectionId) {
|
|
191
|
-
continue;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
const storedPeerConnection = updatedPeerConnections.get(peerConnectionId);
|
|
195
|
-
|
|
196
|
-
updatedInboundVideoTracks.delete(peerConnectionId);
|
|
197
|
-
deletedInboundVideoTracks.add(peerConnectionId);
|
|
198
|
-
|
|
199
|
-
// also update the peer connection model
|
|
200
|
-
if (storedPeerConnection) {
|
|
201
|
-
storedPeerConnection.inboundTrackIds = storedPeerConnection.inboundTrackIds.filter((tId) => tId !== trackId);
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
for (const [trackId, OutboundAudioTrack] of Array.from(updatedOutboundAudioTracks.entries())) {
|
|
206
|
-
if (visitedOutboundAudioTrackIds.has(trackId)) {
|
|
207
|
-
continue;
|
|
208
|
-
}
|
|
209
|
-
// delete PeerConnection
|
|
210
|
-
const { serviceId, callId, clientId, peerConnectionId } = OutboundAudioTrack;
|
|
211
|
-
|
|
212
|
-
if (!serviceId || !callId || !clientId || !peerConnectionId) {
|
|
213
|
-
continue;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
const storedPeerConnection = updatedPeerConnections.get(peerConnectionId);
|
|
217
|
-
|
|
218
|
-
updatedOutboundAudioTracks.delete(peerConnectionId);
|
|
219
|
-
deletedOutboundAudioTracks.add(peerConnectionId);
|
|
220
|
-
|
|
221
|
-
// also update the peer connection model
|
|
222
|
-
if (storedPeerConnection) {
|
|
223
|
-
storedPeerConnection.outboundTrackIds = storedPeerConnection.outboundTrackIds.filter((tId) => tId !== trackId);
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
for (const [trackId, OutboundVideoTrack] of Array.from(updatedOutboundVideoTracks.entries())) {
|
|
228
|
-
if (visitedOutboundVideoTrackIds.has(trackId)) {
|
|
229
|
-
continue;
|
|
230
|
-
}
|
|
231
|
-
// delete PeerConnection
|
|
232
|
-
const { serviceId, callId, clientId, peerConnectionId } = OutboundVideoTrack;
|
|
233
|
-
|
|
234
|
-
if (!serviceId || !callId || !clientId || !peerConnectionId) {
|
|
235
|
-
continue;
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
const storedPeerConnection = updatedPeerConnections.get(peerConnectionId);
|
|
239
|
-
|
|
240
|
-
updatedOutboundVideoTracks.delete(peerConnectionId);
|
|
241
|
-
deletedOutboundVideoTracks.add(peerConnectionId);
|
|
242
|
-
|
|
243
|
-
// also update the peer connection model
|
|
244
|
-
if (storedPeerConnection) {
|
|
245
|
-
storedPeerConnection.outboundTrackIds = storedPeerConnection.outboundTrackIds.filter((tId) => tId !== trackId);
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
163
|
};
|
|
249
164
|
const result = async (context: TransactionContext, next?: Middleware<TransactionContext>) => {
|
|
250
165
|
await process(context);
|
|
@@ -15,7 +15,7 @@ export function visitClient(
|
|
|
15
15
|
reports: ReportsCollector,
|
|
16
16
|
fetchSamples: boolean
|
|
17
17
|
) {
|
|
18
|
-
const { mediaUnitId, clientId } = observedClient;
|
|
18
|
+
const { mediaUnitId, clientId, userId } = observedClient;
|
|
19
19
|
|
|
20
20
|
const { callId, serviceId, roomId } = observedClient.call;
|
|
21
21
|
|
|
@@ -34,7 +34,7 @@ export function visitClient(
|
|
|
34
34
|
const callMetaReport = createCallMetaReport(serviceId, mediaUnitId, roomId, callId, clientId, {
|
|
35
35
|
type: CallMetaType.OPERATION_SYSTEM,
|
|
36
36
|
payload: clientSample.os,
|
|
37
|
-
});
|
|
37
|
+
}, userId);
|
|
38
38
|
reports.addCallMetaReport(callMetaReport);
|
|
39
39
|
}
|
|
40
40
|
|
|
@@ -51,7 +51,7 @@ export function visitClient(
|
|
|
51
51
|
const callMetaReport = createCallMetaReport(serviceId, mediaUnitId, roomId, callId, clientId, {
|
|
52
52
|
type: CallMetaType.ENGINE,
|
|
53
53
|
payload: clientSample.engine,
|
|
54
|
-
});
|
|
54
|
+
}, userId);
|
|
55
55
|
reports.addCallMetaReport(callMetaReport);
|
|
56
56
|
}
|
|
57
57
|
|
|
@@ -69,7 +69,7 @@ export function visitClient(
|
|
|
69
69
|
const callMetaReport = createCallMetaReport(serviceId, mediaUnitId, roomId, callId, clientId, {
|
|
70
70
|
type: CallMetaType.PLATFORM,
|
|
71
71
|
payload: clientSample.platform,
|
|
72
|
-
});
|
|
72
|
+
}, userId);
|
|
73
73
|
reports.addCallMetaReport(callMetaReport);
|
|
74
74
|
}
|
|
75
75
|
|
|
@@ -86,7 +86,7 @@ export function visitClient(
|
|
|
86
86
|
const callMetaReport = createCallMetaReport(serviceId, mediaUnitId, roomId, callId, clientId, {
|
|
87
87
|
type: CallMetaType.BROWSER,
|
|
88
88
|
payload: clientSample.browser,
|
|
89
|
-
});
|
|
89
|
+
}, userId);
|
|
90
90
|
reports.addCallMetaReport(callMetaReport);
|
|
91
91
|
}
|
|
92
92
|
|
|
@@ -95,7 +95,7 @@ export function visitClient(
|
|
|
95
95
|
const callMetaReport = createCallMetaReport(serviceId, mediaUnitId, roomId, callId, clientId, {
|
|
96
96
|
type: CallMetaType.MEDIA_CONSTRAINT,
|
|
97
97
|
payload: mediaConstraint,
|
|
98
|
-
});
|
|
98
|
+
}, userId);
|
|
99
99
|
reports.addCallMetaReport(callMetaReport);
|
|
100
100
|
}
|
|
101
101
|
}
|
|
@@ -106,7 +106,7 @@ export function visitClient(
|
|
|
106
106
|
const callMetaReport = createCallMetaReport(serviceId, mediaUnitId, roomId, callId, clientId, {
|
|
107
107
|
type: CallMetaType.LOCAL_SDP,
|
|
108
108
|
payload: localSDP,
|
|
109
|
-
});
|
|
109
|
+
}, userId);
|
|
110
110
|
reports.addCallMetaReport(callMetaReport);
|
|
111
111
|
}
|
|
112
112
|
}
|
|
@@ -119,6 +119,7 @@ export function visitClient(
|
|
|
119
119
|
roomId,
|
|
120
120
|
callId,
|
|
121
121
|
clientId,
|
|
122
|
+
userId,
|
|
122
123
|
timestamp: Date.now(),
|
|
123
124
|
payload: extensionStats.payload,
|
|
124
125
|
extensionType: extensionStats.type,
|
|
@@ -134,6 +135,7 @@ export function visitClient(
|
|
|
134
135
|
roomId,
|
|
135
136
|
callId,
|
|
136
137
|
clientId,
|
|
138
|
+
userId,
|
|
137
139
|
timestamp: Date.now(),
|
|
138
140
|
...callEvent,
|
|
139
141
|
});
|
|
@@ -145,7 +147,7 @@ export function visitClient(
|
|
|
145
147
|
const callMetaReport = createCallMetaReport(serviceId, mediaUnitId, roomId, callId, clientId, {
|
|
146
148
|
type: CallMetaType.USER_MEDIA_ERROR,
|
|
147
149
|
payload: userMediaError,
|
|
148
|
-
});
|
|
150
|
+
}, userId);
|
|
149
151
|
reports.addCallMetaReport(callMetaReport);
|
|
150
152
|
}
|
|
151
153
|
}
|
|
@@ -155,7 +157,7 @@ export function visitClient(
|
|
|
155
157
|
const callMetaReport = createCallMetaReport(serviceId, mediaUnitId, roomId, callId, clientId, {
|
|
156
158
|
type: CallMetaType.CERTIFICATE,
|
|
157
159
|
payload: certificate,
|
|
158
|
-
});
|
|
160
|
+
}, userId);
|
|
159
161
|
reports.addCallMetaReport(callMetaReport);
|
|
160
162
|
}
|
|
161
163
|
}
|
|
@@ -165,7 +167,7 @@ export function visitClient(
|
|
|
165
167
|
const callMetaReport = createCallMetaReport(serviceId, mediaUnitId, roomId, callId, clientId, {
|
|
166
168
|
type: CallMetaType.CODEC,
|
|
167
169
|
payload: codec,
|
|
168
|
-
});
|
|
170
|
+
}, userId);
|
|
169
171
|
reports.addCallMetaReport(callMetaReport);
|
|
170
172
|
}
|
|
171
173
|
}
|
|
@@ -175,7 +177,7 @@ export function visitClient(
|
|
|
175
177
|
const callMetaReport = createCallMetaReport(serviceId, mediaUnitId, roomId, callId, clientId, {
|
|
176
178
|
type: CallMetaType.ICE_SERVER,
|
|
177
179
|
payload: iceServer,
|
|
178
|
-
});
|
|
180
|
+
}, userId);
|
|
179
181
|
reports.addCallMetaReport(callMetaReport);
|
|
180
182
|
}
|
|
181
183
|
}
|
|
@@ -185,7 +187,7 @@ export function visitClient(
|
|
|
185
187
|
const callMetaReport = createCallMetaReport(serviceId, mediaUnitId, roomId, callId, clientId, {
|
|
186
188
|
type: CallMetaType.MEDIA_DEVICE,
|
|
187
189
|
payload: mediaDevice,
|
|
188
|
-
});
|
|
190
|
+
}, userId);
|
|
189
191
|
reports.addCallMetaReport(callMetaReport);
|
|
190
192
|
}
|
|
191
193
|
}
|
|
@@ -195,7 +197,7 @@ export function visitClient(
|
|
|
195
197
|
const callMetaReport = createCallMetaReport(serviceId, mediaUnitId, roomId, callId, clientId, {
|
|
196
198
|
type: CallMetaType.MEDIA_SOURCE,
|
|
197
199
|
payload: mediaSource,
|
|
198
|
-
});
|
|
200
|
+
}, userId);
|
|
199
201
|
reports.addCallMetaReport(callMetaReport);
|
|
200
202
|
}
|
|
201
203
|
}
|
|
@@ -10,9 +10,12 @@ export function visitInboundAudioTrack(
|
|
|
10
10
|
storedPeerConnection: Models.PeerConnection,
|
|
11
11
|
storedInboundTracks: Map<string, Models.InboundTrack>,
|
|
12
12
|
reports: ReportsCollector,
|
|
13
|
-
fetchSamples: boolean
|
|
13
|
+
fetchSamples: boolean,
|
|
14
|
+
remoteTrackId?: string,
|
|
15
|
+
remotePeerConnectionId?: string,
|
|
16
|
+
remoteClientId?: string,
|
|
14
17
|
) {
|
|
15
|
-
const { trackId } = observedInboundAudioTrack;
|
|
18
|
+
const { trackId, sfuStreamId, sfuSinkId } = observedInboundAudioTrack;
|
|
16
19
|
|
|
17
20
|
const { peerConnectionId } = observedInboundAudioTrack.peerConnection;
|
|
18
21
|
|
|
@@ -25,7 +28,7 @@ export function visitInboundAudioTrack(
|
|
|
25
28
|
} = observedInboundAudioTrack.peerConnection.client;
|
|
26
29
|
|
|
27
30
|
const { serviceId, roomId, callId } = observedInboundAudioTrack.peerConnection.client.call;
|
|
28
|
-
|
|
31
|
+
|
|
29
32
|
let storedInboundAudioTrack = storedInboundTracks.get(trackId);
|
|
30
33
|
if (!storedInboundAudioTrack) {
|
|
31
34
|
storedInboundAudioTrack = new Models.InboundTrack({
|
|
@@ -33,10 +36,13 @@ export function visitInboundAudioTrack(
|
|
|
33
36
|
roomId,
|
|
34
37
|
callId,
|
|
35
38
|
clientId,
|
|
39
|
+
kind: 'audio',
|
|
36
40
|
peerConnectionId,
|
|
37
41
|
mediaUnitId,
|
|
38
42
|
trackId,
|
|
39
|
-
|
|
43
|
+
sfuSinkId,
|
|
44
|
+
sfuStreamId,
|
|
45
|
+
|
|
40
46
|
userId,
|
|
41
47
|
marker,
|
|
42
48
|
});
|
|
@@ -58,11 +64,15 @@ export function visitInboundAudioTrack(
|
|
|
58
64
|
roomId,
|
|
59
65
|
callId,
|
|
60
66
|
clientId,
|
|
67
|
+
userId,
|
|
61
68
|
mediaUnitId,
|
|
62
69
|
peerConnectionId,
|
|
63
70
|
...inboundAudioSample,
|
|
64
71
|
timestamp,
|
|
65
72
|
sampleSeq: -1,
|
|
73
|
+
remoteClientId,
|
|
74
|
+
remotePeerConnectionId,
|
|
75
|
+
remoteTrackId,
|
|
66
76
|
};
|
|
67
77
|
reports.addInboundAudioTrackReport(report);
|
|
68
78
|
|
|
@@ -93,6 +103,6 @@ export function visitInboundAudioTrack(
|
|
|
93
103
|
statsMap.set(ssrc, videoStats);
|
|
94
104
|
}
|
|
95
105
|
}
|
|
96
|
-
|
|
106
|
+
storedInboundAudioTrack.ssrc = [...statsMap.keys()];
|
|
97
107
|
storedInboundAudioTrack.videoStats = Array.from(statsMap.values());
|
|
98
108
|
}
|
|
@@ -12,9 +12,12 @@ export function visitInboundVideoTrack(
|
|
|
12
12
|
storedPeerConnection: Models.PeerConnection,
|
|
13
13
|
storedInboundTracks: Map<string, Models.InboundTrack>,
|
|
14
14
|
reports: ReportsCollector,
|
|
15
|
-
fetchSamples: boolean
|
|
15
|
+
fetchSamples: boolean,
|
|
16
|
+
remoteTrackId?: string,
|
|
17
|
+
remotePeerConnectionId?: string,
|
|
18
|
+
remoteClientId?: string,
|
|
16
19
|
) {
|
|
17
|
-
const { trackId } = observedInboundVideoTrack;
|
|
20
|
+
const { trackId, sfuStreamId, sfuSinkId } = observedInboundVideoTrack;
|
|
18
21
|
|
|
19
22
|
const { peerConnectionId } = observedInboundVideoTrack.peerConnection;
|
|
20
23
|
|
|
@@ -35,9 +38,13 @@ export function visitInboundVideoTrack(
|
|
|
35
38
|
roomId,
|
|
36
39
|
callId,
|
|
37
40
|
clientId,
|
|
41
|
+
kind: 'video',
|
|
38
42
|
peerConnectionId,
|
|
39
43
|
mediaUnitId,
|
|
40
44
|
trackId,
|
|
45
|
+
|
|
46
|
+
sfuStreamId,
|
|
47
|
+
sfuSinkId,
|
|
41
48
|
|
|
42
49
|
userId,
|
|
43
50
|
marker,
|
|
@@ -59,11 +66,15 @@ export function visitInboundVideoTrack(
|
|
|
59
66
|
roomId,
|
|
60
67
|
callId,
|
|
61
68
|
clientId,
|
|
69
|
+
userId,
|
|
62
70
|
mediaUnitId,
|
|
63
71
|
peerConnectionId,
|
|
64
72
|
...inboundVideoSample,
|
|
65
73
|
timestamp,
|
|
66
74
|
sampleSeq: -1,
|
|
75
|
+
remoteClientId,
|
|
76
|
+
remotePeerConnectionId,
|
|
77
|
+
remoteTrackId,
|
|
67
78
|
};
|
|
68
79
|
reports.addInboundVideoTrackReport(report);
|
|
69
80
|
|
|
@@ -96,5 +107,6 @@ export function visitInboundVideoTrack(
|
|
|
96
107
|
statsMap.set(ssrc, videoStats);
|
|
97
108
|
}
|
|
98
109
|
}
|
|
110
|
+
storedInboundVideoTrack.ssrc = [...statsMap.keys()];
|
|
99
111
|
storedInboundVideoTrack.videoStats = Array.from(statsMap.values());
|
|
100
112
|
}
|
|
@@ -12,7 +12,7 @@ export function visitOutboundAudioTrack(
|
|
|
12
12
|
reports: ReportsCollector,
|
|
13
13
|
fetchSamples: boolean
|
|
14
14
|
) {
|
|
15
|
-
const { trackId } = observedOutboundAudioTrack;
|
|
15
|
+
const { trackId, sfuStreamId } = observedOutboundAudioTrack;
|
|
16
16
|
|
|
17
17
|
const { peerConnectionId } = observedOutboundAudioTrack.peerConnection;
|
|
18
18
|
|
|
@@ -33,10 +33,12 @@ export function visitOutboundAudioTrack(
|
|
|
33
33
|
roomId,
|
|
34
34
|
callId,
|
|
35
35
|
clientId,
|
|
36
|
+
kind: 'audio',
|
|
36
37
|
peerConnectionId,
|
|
37
38
|
mediaUnitId,
|
|
38
39
|
trackId,
|
|
39
|
-
|
|
40
|
+
|
|
41
|
+
sfuStreamId,
|
|
40
42
|
userId,
|
|
41
43
|
marker,
|
|
42
44
|
});
|
|
@@ -57,6 +59,7 @@ export function visitOutboundAudioTrack(
|
|
|
57
59
|
roomId,
|
|
58
60
|
callId,
|
|
59
61
|
clientId,
|
|
62
|
+
userId,
|
|
60
63
|
mediaUnitId,
|
|
61
64
|
peerConnectionId,
|
|
62
65
|
...outboundAudioSample,
|
|
@@ -88,5 +91,6 @@ export function visitOutboundAudioTrack(
|
|
|
88
91
|
statsMap.set(ssrc, audioStats);
|
|
89
92
|
}
|
|
90
93
|
}
|
|
94
|
+
storedOutboundAudioTrack.ssrc = [...statsMap.keys()];
|
|
91
95
|
storedOutboundAudioTrack.audioStats = Array.from(statsMap.values());
|
|
92
96
|
}
|
|
@@ -12,7 +12,7 @@ export function visitOutboundVideoTrack(
|
|
|
12
12
|
reports: ReportsCollector,
|
|
13
13
|
fetchSamples: boolean
|
|
14
14
|
) {
|
|
15
|
-
const { trackId } = observedOutboundVideoTrack;
|
|
15
|
+
const { trackId, sfuStreamId } = observedOutboundVideoTrack;
|
|
16
16
|
|
|
17
17
|
const { peerConnectionId } = observedOutboundVideoTrack.peerConnection;
|
|
18
18
|
|
|
@@ -33,10 +33,12 @@ export function visitOutboundVideoTrack(
|
|
|
33
33
|
roomId,
|
|
34
34
|
callId,
|
|
35
35
|
clientId,
|
|
36
|
+
kind: 'video',
|
|
36
37
|
peerConnectionId,
|
|
37
38
|
mediaUnitId,
|
|
38
39
|
trackId,
|
|
39
40
|
|
|
41
|
+
sfuStreamId,
|
|
40
42
|
userId,
|
|
41
43
|
marker,
|
|
42
44
|
});
|
|
@@ -57,6 +59,7 @@ export function visitOutboundVideoTrack(
|
|
|
57
59
|
roomId,
|
|
58
60
|
callId,
|
|
59
61
|
clientId,
|
|
62
|
+
userId,
|
|
60
63
|
mediaUnitId,
|
|
61
64
|
peerConnectionId,
|
|
62
65
|
...outboundVideoSample,
|
|
@@ -90,5 +93,6 @@ export function visitOutboundVideoTrack(
|
|
|
90
93
|
statsMap.set(ssrc, videoStats);
|
|
91
94
|
}
|
|
92
95
|
}
|
|
96
|
+
storedOutboundVideoTrack.ssrc = [...statsMap.keys()];
|
|
93
97
|
storedOutboundVideoTrack.videoStats = Array.from(statsMap.values());
|
|
94
98
|
}
|
|
@@ -2,7 +2,7 @@ import { ObservedPeerConnection } from '../../samples/ObservedPeerConnection';
|
|
|
2
2
|
import * as Models from '../../models/Models';
|
|
3
3
|
import { ReportsCollector } from '../../common/ReportsCollector';
|
|
4
4
|
import { logger } from '../VisitObservedCallsMiddleware';
|
|
5
|
-
import { PeerConnectionTransportReport } from '@observertc/report-schemas-js';
|
|
5
|
+
import { IceCandidatePairReport, PeerConnectionTransportReport } from '@observertc/report-schemas-js';
|
|
6
6
|
import { Samples_ClientSample_IceCandidatePair, Samples_ClientSample_IceLocalCandidate, Samples_ClientSample_IceRemoteCandidate, Samples_ClientSample_PeerConnectionTransport } from '../../models/samples_pb';
|
|
7
7
|
|
|
8
8
|
export function visitPeerConnection(
|
|
@@ -47,6 +47,7 @@ export function visitPeerConnection(
|
|
|
47
47
|
roomId,
|
|
48
48
|
callId,
|
|
49
49
|
clientId,
|
|
50
|
+
userId,
|
|
50
51
|
mediaUnitId,
|
|
51
52
|
...pcTransport,
|
|
52
53
|
timestamp,
|
|
@@ -55,6 +56,21 @@ export function visitPeerConnection(
|
|
|
55
56
|
reports.addPeerConnectionTransportReports(report);
|
|
56
57
|
}
|
|
57
58
|
|
|
59
|
+
for (const iceCandidatePair of observedPeerConnection.iceCandidatePairs()) {
|
|
60
|
+
const report: IceCandidatePairReport = {
|
|
61
|
+
serviceId,
|
|
62
|
+
roomId,
|
|
63
|
+
callId,
|
|
64
|
+
userId,
|
|
65
|
+
clientId,
|
|
66
|
+
mediaUnitId,
|
|
67
|
+
...iceCandidatePair,
|
|
68
|
+
timestamp,
|
|
69
|
+
sampleSeq: -1, // deprecated
|
|
70
|
+
};
|
|
71
|
+
reports.addIceCandidatePairReport(report);
|
|
72
|
+
}
|
|
73
|
+
|
|
58
74
|
if (fetchSamples) {
|
|
59
75
|
storedPeerConnection.icelocalCandidates = [];
|
|
60
76
|
for (const iceLocalCandidate of observedPeerConnection.iceLocalCandidates()) {
|