@observertc/observer-js 0.9.2-beta → 0.9.4-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/Observer.d.ts +2 -2
- package/lib/Observer.d.ts.map +1 -1
- package/lib/Observer.js +8 -4
- package/lib/middlewares/visitors/visitPeerConnection.d.ts.map +1 -1
- package/lib/middlewares/visitors/visitPeerConnection.js +32 -3
- package/lib/models/Models.d.ts +7 -3
- package/lib/models/Models.d.ts.map +1 -1
- package/lib/models/Models.js +136 -149
- package/lib/models/samples_pb.d.ts +2 -2
- package/lib/models/samples_pb.d.ts.map +1 -1
- package/lib/models/samples_pb.js +538 -586
- package/package.json +1 -1
- package/src/Observer.ts +8 -4
- package/src/middlewares/visitors/visitPeerConnection.ts +50 -3
- package/src/models/Models.ts +986 -1037
- package/src/models/samples_pb.ts +3858 -4047
package/package.json
CHANGED
package/src/Observer.ts
CHANGED
|
@@ -176,18 +176,22 @@ export class Observer {
|
|
|
176
176
|
return this._sink;
|
|
177
177
|
}
|
|
178
178
|
|
|
179
|
-
public
|
|
179
|
+
public addEvaluators(...processes: EvaluatorProcess[]) {
|
|
180
180
|
if (this._closed) {
|
|
181
181
|
throw new Error(`Attempted to add an evaluator to a closed observer`);
|
|
182
182
|
}
|
|
183
|
-
|
|
183
|
+
for (const process of processes) {
|
|
184
|
+
this._evaluator.addProcess(process);
|
|
185
|
+
}
|
|
184
186
|
}
|
|
185
187
|
|
|
186
|
-
public
|
|
188
|
+
public removeEvaluators(...processes: EvaluatorProcess[]) {
|
|
187
189
|
if (this._closed) {
|
|
188
190
|
throw new Error(`Attempted to remove an evaluator from a closed observer`);
|
|
189
191
|
}
|
|
190
|
-
|
|
192
|
+
for (const process of processes) {
|
|
193
|
+
this._evaluator.removeProcess(process);
|
|
194
|
+
}
|
|
191
195
|
}
|
|
192
196
|
|
|
193
197
|
public calls(): AsyncIterableIterator<[string, Models.Call]> {
|
|
@@ -3,6 +3,7 @@ import * as Models from '../../models/Models';
|
|
|
3
3
|
import { ReportsCollector } from '../../common/ReportsCollector';
|
|
4
4
|
import { logger } from '../VisitObservedCallsMiddleware';
|
|
5
5
|
import { PeerConnectionTransportReport } from '@observertc/report-schemas-js';
|
|
6
|
+
import { Samples_ClientSample_IceCandidatePair, Samples_ClientSample_IceLocalCandidate, Samples_ClientSample_IceRemoteCandidate, Samples_ClientSample_PeerConnectionTransport } from '../../models/samples_pb';
|
|
6
7
|
|
|
7
8
|
export function visitPeerConnection(
|
|
8
9
|
observedPeerConnection: ObservedPeerConnection,
|
|
@@ -55,16 +56,62 @@ export function visitPeerConnection(
|
|
|
55
56
|
}
|
|
56
57
|
|
|
57
58
|
if (fetchSamples) {
|
|
59
|
+
storedPeerConnection.icelocalCandidates = [];
|
|
58
60
|
for (const iceLocalCandidate of observedPeerConnection.iceLocalCandidates()) {
|
|
59
|
-
|
|
61
|
+
const {
|
|
62
|
+
priority,
|
|
63
|
+
...sample
|
|
64
|
+
} = iceLocalCandidate;
|
|
65
|
+
storedPeerConnection.icelocalCandidates.push(new Samples_ClientSample_IceLocalCandidate({
|
|
66
|
+
...sample,
|
|
67
|
+
priority: BigInt(priority ?? -1)
|
|
68
|
+
}));
|
|
60
69
|
}
|
|
61
70
|
|
|
71
|
+
storedPeerConnection.iceRemoteCandidates = [];
|
|
62
72
|
for (const iceRemoteCandidate of observedPeerConnection.iceRemoteCandidates()) {
|
|
63
|
-
|
|
73
|
+
const {
|
|
74
|
+
priority,
|
|
75
|
+
...sample
|
|
76
|
+
} = iceRemoteCandidate;
|
|
77
|
+
storedPeerConnection.iceRemoteCandidates.push(new Samples_ClientSample_IceRemoteCandidate({
|
|
78
|
+
...sample,
|
|
79
|
+
priority: BigInt(priority ?? -1)
|
|
80
|
+
}));
|
|
64
81
|
}
|
|
65
82
|
|
|
83
|
+
storedPeerConnection.iceCandidatePairs = [];
|
|
66
84
|
for (const iceCandidatePair of observedPeerConnection.iceCandidatePairs()) {
|
|
67
|
-
|
|
85
|
+
const {
|
|
86
|
+
bytesDiscardedOnSend,
|
|
87
|
+
bytesReceived,
|
|
88
|
+
bytesSent,
|
|
89
|
+
lastPacketReceivedTimestamp,
|
|
90
|
+
lastPacketSentTimestamp,
|
|
91
|
+
...sample
|
|
92
|
+
} = iceCandidatePair;
|
|
93
|
+
storedPeerConnection.iceCandidatePairs.push(new Samples_ClientSample_IceCandidatePair({
|
|
94
|
+
...sample,
|
|
95
|
+
bytesDiscardedOnSend: BigInt(bytesDiscardedOnSend ?? -1),
|
|
96
|
+
bytesReceived: BigInt(bytesReceived ?? -1),
|
|
97
|
+
bytesSent: BigInt(bytesSent ?? -1),
|
|
98
|
+
lastPacketReceivedTimestamp: BigInt(lastPacketReceivedTimestamp ?? -1),
|
|
99
|
+
lastPacketSentTimestamp: BigInt(lastPacketSentTimestamp ?? -1),
|
|
100
|
+
}));
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
storedPeerConnection.transports = [];
|
|
104
|
+
for (const pcTransport of observedPeerConnection.transportSamples()) {
|
|
105
|
+
const {
|
|
106
|
+
bytesReceived,
|
|
107
|
+
bytesSent,
|
|
108
|
+
...sample
|
|
109
|
+
} = pcTransport;
|
|
110
|
+
storedPeerConnection.transports.push(new Samples_ClientSample_PeerConnectionTransport({
|
|
111
|
+
...sample,
|
|
112
|
+
bytesReceived: BigInt(bytesReceived ?? -1),
|
|
113
|
+
bytesSent: BigInt(bytesSent ?? -1),
|
|
114
|
+
}));
|
|
68
115
|
}
|
|
69
116
|
}
|
|
70
117
|
}
|