@whereby.com/media 1.16.1 → 1.16.2
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.cjs +16 -8
- package/dist/index.mjs +16 -8
- package/dist/legacy-esm.js +16 -8
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1443,7 +1443,7 @@ fromLocation(window && window.location);
|
|
|
1443
1443
|
|
|
1444
1444
|
const logger$9 = new Logger();
|
|
1445
1445
|
const debugLogger = {
|
|
1446
|
-
print: (...args) => console.
|
|
1446
|
+
print: (...args) => console.debug(args[0], ...args.slice(1)),
|
|
1447
1447
|
};
|
|
1448
1448
|
logger$9.withDebugLogger(debugLogger);
|
|
1449
1449
|
class PacketLossAnalyser {
|
|
@@ -1455,7 +1455,6 @@ class PacketLossAnalyser {
|
|
|
1455
1455
|
this.staleMeasurementTimeouts = new Map();
|
|
1456
1456
|
}
|
|
1457
1457
|
addPacketLossMeasurement(id, packetLoss, timestamp) {
|
|
1458
|
-
logger$9.debug("addPacketLossMeasurement() [ssrcId: %s, loss: %s, timestamp: %s]", id, packetLoss, timestamp);
|
|
1459
1458
|
this.handleStaleMeasurements(id);
|
|
1460
1459
|
const hasPacketLoss = packetLoss > this.PACKET_LOSS_PERIOD_THRESHOLD;
|
|
1461
1460
|
let history = this.ssrcsHistory.get(id);
|
|
@@ -1482,9 +1481,20 @@ class PacketLossAnalyser {
|
|
|
1482
1481
|
};
|
|
1483
1482
|
}
|
|
1484
1483
|
}
|
|
1485
|
-
hasPeriodicPacketLoss(id) {
|
|
1486
|
-
|
|
1487
|
-
|
|
1484
|
+
hasPeriodicPacketLoss(id, timestamp) {
|
|
1485
|
+
const history = this.ssrcsHistory.get(id);
|
|
1486
|
+
if (history && this.intervalExceeded(history, timestamp)) {
|
|
1487
|
+
this.ssrcsHistory.delete(history.id);
|
|
1488
|
+
return false;
|
|
1489
|
+
}
|
|
1490
|
+
return (history === null || history === void 0 ? void 0 : history.hasPeriodicPacketLoss) || false;
|
|
1491
|
+
}
|
|
1492
|
+
intervalExceeded(history, timestamp) {
|
|
1493
|
+
if (history.prevPeriod && history.prevIntervalInMs) {
|
|
1494
|
+
const intervalLimitTimestamp = this.calculatePeriodCenterTimestamp(history.prevPeriod) + history.prevIntervalInMs;
|
|
1495
|
+
return timestamp > intervalLimitTimestamp;
|
|
1496
|
+
}
|
|
1497
|
+
return false;
|
|
1488
1498
|
}
|
|
1489
1499
|
handleStaleMeasurements(id) {
|
|
1490
1500
|
const staleMeasurementTimeout = this.staleMeasurementTimeouts.get(id);
|
|
@@ -1540,9 +1550,7 @@ const periodicPacketLossDetector = {
|
|
|
1540
1550
|
},
|
|
1541
1551
|
check: ({ ssrc0 }) => {
|
|
1542
1552
|
packetLossAnalyser.addPacketLossMeasurement(ssrc0.ssrc, ssrc0.fractionLost || 0, Date.now());
|
|
1543
|
-
|
|
1544
|
-
return true;
|
|
1545
|
-
return false;
|
|
1553
|
+
return packetLossAnalyser.hasPeriodicPacketLoss(ssrc0.ssrc, Date.now());
|
|
1546
1554
|
},
|
|
1547
1555
|
};
|
|
1548
1556
|
const badNetworkIssueDetector = {
|
package/dist/index.mjs
CHANGED
|
@@ -1422,7 +1422,7 @@ fromLocation(window && window.location);
|
|
|
1422
1422
|
|
|
1423
1423
|
const logger$9 = new Logger();
|
|
1424
1424
|
const debugLogger = {
|
|
1425
|
-
print: (...args) => console.
|
|
1425
|
+
print: (...args) => console.debug(args[0], ...args.slice(1)),
|
|
1426
1426
|
};
|
|
1427
1427
|
logger$9.withDebugLogger(debugLogger);
|
|
1428
1428
|
class PacketLossAnalyser {
|
|
@@ -1434,7 +1434,6 @@ class PacketLossAnalyser {
|
|
|
1434
1434
|
this.staleMeasurementTimeouts = new Map();
|
|
1435
1435
|
}
|
|
1436
1436
|
addPacketLossMeasurement(id, packetLoss, timestamp) {
|
|
1437
|
-
logger$9.debug("addPacketLossMeasurement() [ssrcId: %s, loss: %s, timestamp: %s]", id, packetLoss, timestamp);
|
|
1438
1437
|
this.handleStaleMeasurements(id);
|
|
1439
1438
|
const hasPacketLoss = packetLoss > this.PACKET_LOSS_PERIOD_THRESHOLD;
|
|
1440
1439
|
let history = this.ssrcsHistory.get(id);
|
|
@@ -1461,9 +1460,20 @@ class PacketLossAnalyser {
|
|
|
1461
1460
|
};
|
|
1462
1461
|
}
|
|
1463
1462
|
}
|
|
1464
|
-
hasPeriodicPacketLoss(id) {
|
|
1465
|
-
|
|
1466
|
-
|
|
1463
|
+
hasPeriodicPacketLoss(id, timestamp) {
|
|
1464
|
+
const history = this.ssrcsHistory.get(id);
|
|
1465
|
+
if (history && this.intervalExceeded(history, timestamp)) {
|
|
1466
|
+
this.ssrcsHistory.delete(history.id);
|
|
1467
|
+
return false;
|
|
1468
|
+
}
|
|
1469
|
+
return (history === null || history === void 0 ? void 0 : history.hasPeriodicPacketLoss) || false;
|
|
1470
|
+
}
|
|
1471
|
+
intervalExceeded(history, timestamp) {
|
|
1472
|
+
if (history.prevPeriod && history.prevIntervalInMs) {
|
|
1473
|
+
const intervalLimitTimestamp = this.calculatePeriodCenterTimestamp(history.prevPeriod) + history.prevIntervalInMs;
|
|
1474
|
+
return timestamp > intervalLimitTimestamp;
|
|
1475
|
+
}
|
|
1476
|
+
return false;
|
|
1467
1477
|
}
|
|
1468
1478
|
handleStaleMeasurements(id) {
|
|
1469
1479
|
const staleMeasurementTimeout = this.staleMeasurementTimeouts.get(id);
|
|
@@ -1519,9 +1529,7 @@ const periodicPacketLossDetector = {
|
|
|
1519
1529
|
},
|
|
1520
1530
|
check: ({ ssrc0 }) => {
|
|
1521
1531
|
packetLossAnalyser.addPacketLossMeasurement(ssrc0.ssrc, ssrc0.fractionLost || 0, Date.now());
|
|
1522
|
-
|
|
1523
|
-
return true;
|
|
1524
|
-
return false;
|
|
1532
|
+
return packetLossAnalyser.hasPeriodicPacketLoss(ssrc0.ssrc, Date.now());
|
|
1525
1533
|
},
|
|
1526
1534
|
};
|
|
1527
1535
|
const badNetworkIssueDetector = {
|
package/dist/legacy-esm.js
CHANGED
|
@@ -1422,7 +1422,7 @@ fromLocation(window && window.location);
|
|
|
1422
1422
|
|
|
1423
1423
|
const logger$9 = new Logger();
|
|
1424
1424
|
const debugLogger = {
|
|
1425
|
-
print: (...args) => console.
|
|
1425
|
+
print: (...args) => console.debug(args[0], ...args.slice(1)),
|
|
1426
1426
|
};
|
|
1427
1427
|
logger$9.withDebugLogger(debugLogger);
|
|
1428
1428
|
class PacketLossAnalyser {
|
|
@@ -1434,7 +1434,6 @@ class PacketLossAnalyser {
|
|
|
1434
1434
|
this.staleMeasurementTimeouts = new Map();
|
|
1435
1435
|
}
|
|
1436
1436
|
addPacketLossMeasurement(id, packetLoss, timestamp) {
|
|
1437
|
-
logger$9.debug("addPacketLossMeasurement() [ssrcId: %s, loss: %s, timestamp: %s]", id, packetLoss, timestamp);
|
|
1438
1437
|
this.handleStaleMeasurements(id);
|
|
1439
1438
|
const hasPacketLoss = packetLoss > this.PACKET_LOSS_PERIOD_THRESHOLD;
|
|
1440
1439
|
let history = this.ssrcsHistory.get(id);
|
|
@@ -1461,9 +1460,20 @@ class PacketLossAnalyser {
|
|
|
1461
1460
|
};
|
|
1462
1461
|
}
|
|
1463
1462
|
}
|
|
1464
|
-
hasPeriodicPacketLoss(id) {
|
|
1465
|
-
|
|
1466
|
-
|
|
1463
|
+
hasPeriodicPacketLoss(id, timestamp) {
|
|
1464
|
+
const history = this.ssrcsHistory.get(id);
|
|
1465
|
+
if (history && this.intervalExceeded(history, timestamp)) {
|
|
1466
|
+
this.ssrcsHistory.delete(history.id);
|
|
1467
|
+
return false;
|
|
1468
|
+
}
|
|
1469
|
+
return (history === null || history === void 0 ? void 0 : history.hasPeriodicPacketLoss) || false;
|
|
1470
|
+
}
|
|
1471
|
+
intervalExceeded(history, timestamp) {
|
|
1472
|
+
if (history.prevPeriod && history.prevIntervalInMs) {
|
|
1473
|
+
const intervalLimitTimestamp = this.calculatePeriodCenterTimestamp(history.prevPeriod) + history.prevIntervalInMs;
|
|
1474
|
+
return timestamp > intervalLimitTimestamp;
|
|
1475
|
+
}
|
|
1476
|
+
return false;
|
|
1467
1477
|
}
|
|
1468
1478
|
handleStaleMeasurements(id) {
|
|
1469
1479
|
const staleMeasurementTimeout = this.staleMeasurementTimeouts.get(id);
|
|
@@ -1519,9 +1529,7 @@ const periodicPacketLossDetector = {
|
|
|
1519
1529
|
},
|
|
1520
1530
|
check: ({ ssrc0 }) => {
|
|
1521
1531
|
packetLossAnalyser.addPacketLossMeasurement(ssrc0.ssrc, ssrc0.fractionLost || 0, Date.now());
|
|
1522
|
-
|
|
1523
|
-
return true;
|
|
1524
|
-
return false;
|
|
1532
|
+
return packetLossAnalyser.hasPeriodicPacketLoss(ssrc0.ssrc, Date.now());
|
|
1525
1533
|
},
|
|
1526
1534
|
};
|
|
1527
1535
|
const badNetworkIssueDetector = {
|