@observertc/observer-js 1.0.0-beta.22 → 1.0.0-beta.23
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/dist/index.d.mts +9 -9
- package/dist/index.d.ts +9 -9
- package/dist/index.js +28 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +28 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1425,6 +1425,24 @@ function parseJsonObject(value) {
|
|
|
1425
1425
|
const parsed = parseJsonAs(value);
|
|
1426
1426
|
return typeof parsed === "object" && parsed !== null && !Array.isArray(parsed) ? parsed : void 0;
|
|
1427
1427
|
}
|
|
1428
|
+
function normalizeScoreReasons(value) {
|
|
1429
|
+
if (value === void 0 || value === null) return void 0;
|
|
1430
|
+
const result = {};
|
|
1431
|
+
if (Array.isArray(value)) {
|
|
1432
|
+
for (const entry of value) {
|
|
1433
|
+
if (typeof entry !== "string" || entry.length === 0) continue;
|
|
1434
|
+
result[entry] = 0;
|
|
1435
|
+
}
|
|
1436
|
+
} else if (typeof value === "object") {
|
|
1437
|
+
for (const [key, magnitude] of Object.entries(value)) {
|
|
1438
|
+
if (typeof magnitude !== "number" || !Number.isFinite(magnitude)) continue;
|
|
1439
|
+
result[key] = magnitude;
|
|
1440
|
+
}
|
|
1441
|
+
} else {
|
|
1442
|
+
return void 0;
|
|
1443
|
+
}
|
|
1444
|
+
return Object.keys(result).length === 0 ? void 0 : result;
|
|
1445
|
+
}
|
|
1428
1446
|
|
|
1429
1447
|
// src/ObservedOutboundTrack.ts
|
|
1430
1448
|
var ObservedOutboundTrack = class {
|
|
@@ -2705,6 +2723,16 @@ var ObservedClient = class extends EventEmitter2 {
|
|
|
2705
2723
|
this.usingTCP = false;
|
|
2706
2724
|
this.currentMinRttInMs = void 0;
|
|
2707
2725
|
this.currentMaxRttInMs = void 0;
|
|
2726
|
+
sample.scoreReasons = normalizeScoreReasons(sample.scoreReasons);
|
|
2727
|
+
for (const pcSample of sample.peerConnections ?? []) {
|
|
2728
|
+
pcSample.scoreReasons = normalizeScoreReasons(pcSample.scoreReasons);
|
|
2729
|
+
for (const trackSample of pcSample.inboundTracks ?? []) {
|
|
2730
|
+
trackSample.scoreReasons = normalizeScoreReasons(trackSample.scoreReasons);
|
|
2731
|
+
}
|
|
2732
|
+
for (const trackSample of pcSample.outboundTracks ?? []) {
|
|
2733
|
+
trackSample.scoreReasons = normalizeScoreReasons(trackSample.scoreReasons);
|
|
2734
|
+
}
|
|
2735
|
+
}
|
|
2708
2736
|
this._mergePendingInjections(sample);
|
|
2709
2737
|
this._activeSample = sample;
|
|
2710
2738
|
const clientEventsPostBuffer = [];
|