@whereby.com/media 11.2.4 → 11.2.5
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 +33 -20
- package/dist/index.d.cts +10 -6
- package/dist/index.d.mts +10 -6
- package/dist/index.d.ts +10 -6
- package/dist/index.mjs +33 -20
- package/dist/legacy-esm.js +33 -20
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -4431,19 +4431,23 @@ class VegaRtcManager {
|
|
|
4431
4431
|
};
|
|
4432
4432
|
(_a = window === null || window === void 0 ? void 0 : window.addEventListener) === null || _a === void 0 ? void 0 : _a.call(window, "offline", this._sfuZombie.onBrowserOffline);
|
|
4433
4433
|
this.analytics = {
|
|
4434
|
-
|
|
4434
|
+
avgCamPreferredSpatialLayerSwitchLatencyMs: undefined,
|
|
4435
4435
|
camOutboundCongestedFraction: undefined,
|
|
4436
4436
|
camOutboundRttInflationMs: undefined,
|
|
4437
4437
|
camTrackEndedCount: 0,
|
|
4438
|
-
highestPreferredLayerChangeCounts: {},
|
|
4439
4438
|
micTrackEndedCount: 0,
|
|
4440
|
-
|
|
4439
|
+
numCamHighestPreferredSpatialLayerChanges: 0,
|
|
4440
|
+
numCamHighestPreferredSpatialLayerChanges0To1: 0,
|
|
4441
|
+
numCamHighestPreferredSpatialLayerChanges0To2: 0,
|
|
4442
|
+
numCamHighestPreferredSpatialLayerChanges1To0: 0,
|
|
4443
|
+
numCamHighestPreferredSpatialLayerChanges1To2: 0,
|
|
4444
|
+
numCamHighestPreferredSpatialLayerChanges2To0: 0,
|
|
4445
|
+
numCamHighestPreferredSpatialLayerChanges2To1: 0,
|
|
4446
|
+
numCamPreferredSpatialLayerSwitchTimeouts: 0,
|
|
4441
4447
|
numIceConnected: 0,
|
|
4442
4448
|
numIceDisconnected: 0,
|
|
4443
4449
|
numIceFailed: 0,
|
|
4444
4450
|
numNewPc: 0,
|
|
4445
|
-
numPreferredSpatialLayerChanges: 0,
|
|
4446
|
-
preferredSpatialLayerChangeCounts: {},
|
|
4447
4451
|
sfuMsFromOfflineToClose: 0,
|
|
4448
4452
|
sfuOfflineToCloseCount: 0,
|
|
4449
4453
|
sfuOfflineWhileConnectedCount: 0,
|
|
@@ -5595,7 +5599,7 @@ class VegaRtcManager {
|
|
|
5595
5599
|
this._applyStreamResolution(streamId);
|
|
5596
5600
|
}
|
|
5597
5601
|
_applyStreamResolution(streamId) {
|
|
5598
|
-
var _a, _b, _c;
|
|
5602
|
+
var _a, _b, _c, _d;
|
|
5599
5603
|
const resolution = this._streamIdToVideoResolution.get(streamId);
|
|
5600
5604
|
const consumerId = this._streamIdToVideoConsumerId.get(streamId);
|
|
5601
5605
|
const consumer = this._consumers.get(consumerId);
|
|
@@ -5613,10 +5617,6 @@ class VegaRtcManager {
|
|
|
5613
5617
|
if (consumer.appData.spatialLayer !== spatialLayer || consumer.appData.temporalLayer !== temporalLayer) {
|
|
5614
5618
|
const previousSpatialLayer = consumer.appData.spatialLayer;
|
|
5615
5619
|
const spatialLayerChanged = previousSpatialLayer !== spatialLayer;
|
|
5616
|
-
if (spatialLayerChanged) {
|
|
5617
|
-
this.analytics.numPreferredSpatialLayerChanges++;
|
|
5618
|
-
this._incrementHistogramCount(this.analytics.preferredSpatialLayerChangeCounts, `${previousSpatialLayer}->${spatialLayer}`);
|
|
5619
|
-
}
|
|
5620
5620
|
consumer.appData.spatialLayer = spatialLayer;
|
|
5621
5621
|
consumer.appData.temporalLayer = temporalLayer;
|
|
5622
5622
|
(_c = this._vegaConnection) === null || _c === void 0 ? void 0 : _c.message("setConsumersPreferredLayers", {
|
|
@@ -5624,10 +5624,14 @@ class VegaRtcManager {
|
|
|
5624
5624
|
spatialLayer,
|
|
5625
5625
|
temporalLayer,
|
|
5626
5626
|
});
|
|
5627
|
-
if (spatialLayerChanged) {
|
|
5628
|
-
|
|
5629
|
-
|
|
5630
|
-
|
|
5627
|
+
if (spatialLayerChanged && !consumer.appData.screenShare) {
|
|
5628
|
+
const encodings = (_d = consumer._rtpParameters) === null || _d === void 0 ? void 0 : _d.encodings;
|
|
5629
|
+
const topSpatialLayer = getTopSpatialLayer((encodings === null || encodings === void 0 ? void 0 : encodings.length) ? encodings : [{}]);
|
|
5630
|
+
const fromLayer = Math.min(previousSpatialLayer, topSpatialLayer);
|
|
5631
|
+
const toLayer = Math.min(spatialLayer, topSpatialLayer);
|
|
5632
|
+
if (fromLayer !== toLayer) {
|
|
5633
|
+
this._watchForPreferredLayerSwitch(consumerId, consumer, { toHigherLayer: toLayer > fromLayer });
|
|
5634
|
+
}
|
|
5631
5635
|
}
|
|
5632
5636
|
}
|
|
5633
5637
|
}
|
|
@@ -5648,7 +5652,12 @@ class VegaRtcManager {
|
|
|
5648
5652
|
this._preferredLayerSwitchWatches.delete(consumerId);
|
|
5649
5653
|
};
|
|
5650
5654
|
this._preferredLayerSwitchWatches.set(consumerId, { stop });
|
|
5651
|
-
const timeoutId = setTimeout(
|
|
5655
|
+
const timeoutId = setTimeout(() => {
|
|
5656
|
+
if (!stopped && intervalId !== undefined && !consumer.closed) {
|
|
5657
|
+
this.analytics.numCamPreferredSpatialLayerSwitchTimeouts++;
|
|
5658
|
+
}
|
|
5659
|
+
stop();
|
|
5660
|
+
}, PREFERRED_LAYER_SWITCH_WATCH_TIMEOUT_MS);
|
|
5652
5661
|
(() => __awaiter(this, void 0, void 0, function* () {
|
|
5653
5662
|
const sentAt = Date.now();
|
|
5654
5663
|
const baseline = yield this._getConsumerFrameSize(consumer);
|
|
@@ -5700,7 +5709,7 @@ class VegaRtcManager {
|
|
|
5700
5709
|
_recordPreferredLayerSwitchLatency(latencyMs) {
|
|
5701
5710
|
recordMetricSample(this._preferredLayerSwitchLatencyStats, latencyMs);
|
|
5702
5711
|
const { avg } = aggregateMetricStats(this._preferredLayerSwitchLatencyStats);
|
|
5703
|
-
this.analytics.
|
|
5712
|
+
this.analytics.avgCamPreferredSpatialLayerSwitchLatencyMs = avg;
|
|
5704
5713
|
}
|
|
5705
5714
|
_onUpdatedStats(statsByView) {
|
|
5706
5715
|
var _a, _b, _c, _d;
|
|
@@ -6034,8 +6043,8 @@ class VegaRtcManager {
|
|
|
6034
6043
|
}
|
|
6035
6044
|
if (this._webcamProducerHighestPreferredLayer !== undefined &&
|
|
6036
6045
|
this._webcamProducerHighestPreferredLayer !== spatialLayer) {
|
|
6037
|
-
this.analytics.
|
|
6038
|
-
this.
|
|
6046
|
+
this.analytics.numCamHighestPreferredSpatialLayerChanges++;
|
|
6047
|
+
this._incrementLayerChangeCount(this._webcamProducerHighestPreferredLayer, spatialLayer);
|
|
6039
6048
|
}
|
|
6040
6049
|
this._webcamProducerHighestPreferredLayer = spatialLayer;
|
|
6041
6050
|
logger$2.info("_onChangedHighestPreferredLayer()", { producerId, spatialLayer });
|
|
@@ -6089,8 +6098,12 @@ class VegaRtcManager {
|
|
|
6089
6098
|
}
|
|
6090
6099
|
});
|
|
6091
6100
|
}
|
|
6092
|
-
|
|
6093
|
-
|
|
6101
|
+
_incrementLayerChangeCount(from, to) {
|
|
6102
|
+
const counts = this.analytics;
|
|
6103
|
+
const key = `numCamHighestPreferredSpatialLayerChanges${from}To${to}`;
|
|
6104
|
+
const count = counts[key];
|
|
6105
|
+
if (count !== undefined)
|
|
6106
|
+
counts[key] = count + 1;
|
|
6094
6107
|
}
|
|
6095
6108
|
_onDataConsumerReady(options) {
|
|
6096
6109
|
return __awaiter(this, void 0, void 0, function* () {
|
package/dist/index.d.cts
CHANGED
|
@@ -429,19 +429,23 @@ type DataConsumerAppData = {
|
|
|
429
429
|
};
|
|
430
430
|
|
|
431
431
|
type VegaAnalytics = {
|
|
432
|
-
|
|
432
|
+
avgCamPreferredSpatialLayerSwitchLatencyMs: number | undefined;
|
|
433
433
|
camOutboundCongestedFraction: number | undefined;
|
|
434
434
|
camOutboundRttInflationMs: number | undefined;
|
|
435
435
|
camTrackEndedCount: number;
|
|
436
|
-
highestPreferredLayerChangeCounts: Record<string, number>;
|
|
437
436
|
micTrackEndedCount: number;
|
|
438
|
-
|
|
437
|
+
numCamHighestPreferredSpatialLayerChanges: number;
|
|
438
|
+
numCamHighestPreferredSpatialLayerChanges0To1: number;
|
|
439
|
+
numCamHighestPreferredSpatialLayerChanges0To2: number;
|
|
440
|
+
numCamHighestPreferredSpatialLayerChanges1To0: number;
|
|
441
|
+
numCamHighestPreferredSpatialLayerChanges1To2: number;
|
|
442
|
+
numCamHighestPreferredSpatialLayerChanges2To0: number;
|
|
443
|
+
numCamHighestPreferredSpatialLayerChanges2To1: number;
|
|
444
|
+
numCamPreferredSpatialLayerSwitchTimeouts: number;
|
|
439
445
|
numIceConnected: number;
|
|
440
446
|
numIceDisconnected: number;
|
|
441
447
|
numIceFailed: number;
|
|
442
448
|
numNewPc: number;
|
|
443
|
-
numPreferredSpatialLayerChanges: number;
|
|
444
|
-
preferredSpatialLayerChangeCounts: Record<string, number>;
|
|
445
449
|
sfuMsFromOfflineToClose: number;
|
|
446
450
|
sfuOfflineToCloseCount: number;
|
|
447
451
|
sfuOfflineWhileConnectedCount: number;
|
|
@@ -2303,7 +2307,7 @@ declare class VegaRtcManager implements RtcManager {
|
|
|
2303
2307
|
_syncWebcamEncoderToHighestPreferredLayer(): Promise<void>;
|
|
2304
2308
|
_applyPendingHighestPreferredLayerUpdates(): Promise<void>;
|
|
2305
2309
|
_applyHighestPreferredLayerToWebcamEncoder(): Promise<void>;
|
|
2306
|
-
|
|
2310
|
+
_incrementLayerChangeCount(from: number, to: number): void;
|
|
2307
2311
|
_onDataConsumerReady(options: DataConsumerOptions<DataConsumerAppData>): Promise<void>;
|
|
2308
2312
|
_onDataConsumerClosed({ dataConsumerId, reason }: {
|
|
2309
2313
|
dataConsumerId: string;
|
package/dist/index.d.mts
CHANGED
|
@@ -429,19 +429,23 @@ type DataConsumerAppData = {
|
|
|
429
429
|
};
|
|
430
430
|
|
|
431
431
|
type VegaAnalytics = {
|
|
432
|
-
|
|
432
|
+
avgCamPreferredSpatialLayerSwitchLatencyMs: number | undefined;
|
|
433
433
|
camOutboundCongestedFraction: number | undefined;
|
|
434
434
|
camOutboundRttInflationMs: number | undefined;
|
|
435
435
|
camTrackEndedCount: number;
|
|
436
|
-
highestPreferredLayerChangeCounts: Record<string, number>;
|
|
437
436
|
micTrackEndedCount: number;
|
|
438
|
-
|
|
437
|
+
numCamHighestPreferredSpatialLayerChanges: number;
|
|
438
|
+
numCamHighestPreferredSpatialLayerChanges0To1: number;
|
|
439
|
+
numCamHighestPreferredSpatialLayerChanges0To2: number;
|
|
440
|
+
numCamHighestPreferredSpatialLayerChanges1To0: number;
|
|
441
|
+
numCamHighestPreferredSpatialLayerChanges1To2: number;
|
|
442
|
+
numCamHighestPreferredSpatialLayerChanges2To0: number;
|
|
443
|
+
numCamHighestPreferredSpatialLayerChanges2To1: number;
|
|
444
|
+
numCamPreferredSpatialLayerSwitchTimeouts: number;
|
|
439
445
|
numIceConnected: number;
|
|
440
446
|
numIceDisconnected: number;
|
|
441
447
|
numIceFailed: number;
|
|
442
448
|
numNewPc: number;
|
|
443
|
-
numPreferredSpatialLayerChanges: number;
|
|
444
|
-
preferredSpatialLayerChangeCounts: Record<string, number>;
|
|
445
449
|
sfuMsFromOfflineToClose: number;
|
|
446
450
|
sfuOfflineToCloseCount: number;
|
|
447
451
|
sfuOfflineWhileConnectedCount: number;
|
|
@@ -2303,7 +2307,7 @@ declare class VegaRtcManager implements RtcManager {
|
|
|
2303
2307
|
_syncWebcamEncoderToHighestPreferredLayer(): Promise<void>;
|
|
2304
2308
|
_applyPendingHighestPreferredLayerUpdates(): Promise<void>;
|
|
2305
2309
|
_applyHighestPreferredLayerToWebcamEncoder(): Promise<void>;
|
|
2306
|
-
|
|
2310
|
+
_incrementLayerChangeCount(from: number, to: number): void;
|
|
2307
2311
|
_onDataConsumerReady(options: DataConsumerOptions<DataConsumerAppData>): Promise<void>;
|
|
2308
2312
|
_onDataConsumerClosed({ dataConsumerId, reason }: {
|
|
2309
2313
|
dataConsumerId: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -429,19 +429,23 @@ type DataConsumerAppData = {
|
|
|
429
429
|
};
|
|
430
430
|
|
|
431
431
|
type VegaAnalytics = {
|
|
432
|
-
|
|
432
|
+
avgCamPreferredSpatialLayerSwitchLatencyMs: number | undefined;
|
|
433
433
|
camOutboundCongestedFraction: number | undefined;
|
|
434
434
|
camOutboundRttInflationMs: number | undefined;
|
|
435
435
|
camTrackEndedCount: number;
|
|
436
|
-
highestPreferredLayerChangeCounts: Record<string, number>;
|
|
437
436
|
micTrackEndedCount: number;
|
|
438
|
-
|
|
437
|
+
numCamHighestPreferredSpatialLayerChanges: number;
|
|
438
|
+
numCamHighestPreferredSpatialLayerChanges0To1: number;
|
|
439
|
+
numCamHighestPreferredSpatialLayerChanges0To2: number;
|
|
440
|
+
numCamHighestPreferredSpatialLayerChanges1To0: number;
|
|
441
|
+
numCamHighestPreferredSpatialLayerChanges1To2: number;
|
|
442
|
+
numCamHighestPreferredSpatialLayerChanges2To0: number;
|
|
443
|
+
numCamHighestPreferredSpatialLayerChanges2To1: number;
|
|
444
|
+
numCamPreferredSpatialLayerSwitchTimeouts: number;
|
|
439
445
|
numIceConnected: number;
|
|
440
446
|
numIceDisconnected: number;
|
|
441
447
|
numIceFailed: number;
|
|
442
448
|
numNewPc: number;
|
|
443
|
-
numPreferredSpatialLayerChanges: number;
|
|
444
|
-
preferredSpatialLayerChangeCounts: Record<string, number>;
|
|
445
449
|
sfuMsFromOfflineToClose: number;
|
|
446
450
|
sfuOfflineToCloseCount: number;
|
|
447
451
|
sfuOfflineWhileConnectedCount: number;
|
|
@@ -2303,7 +2307,7 @@ declare class VegaRtcManager implements RtcManager {
|
|
|
2303
2307
|
_syncWebcamEncoderToHighestPreferredLayer(): Promise<void>;
|
|
2304
2308
|
_applyPendingHighestPreferredLayerUpdates(): Promise<void>;
|
|
2305
2309
|
_applyHighestPreferredLayerToWebcamEncoder(): Promise<void>;
|
|
2306
|
-
|
|
2310
|
+
_incrementLayerChangeCount(from: number, to: number): void;
|
|
2307
2311
|
_onDataConsumerReady(options: DataConsumerOptions<DataConsumerAppData>): Promise<void>;
|
|
2308
2312
|
_onDataConsumerClosed({ dataConsumerId, reason }: {
|
|
2309
2313
|
dataConsumerId: string;
|
package/dist/index.mjs
CHANGED
|
@@ -4411,19 +4411,23 @@ class VegaRtcManager {
|
|
|
4411
4411
|
};
|
|
4412
4412
|
(_a = window === null || window === void 0 ? void 0 : window.addEventListener) === null || _a === void 0 ? void 0 : _a.call(window, "offline", this._sfuZombie.onBrowserOffline);
|
|
4413
4413
|
this.analytics = {
|
|
4414
|
-
|
|
4414
|
+
avgCamPreferredSpatialLayerSwitchLatencyMs: undefined,
|
|
4415
4415
|
camOutboundCongestedFraction: undefined,
|
|
4416
4416
|
camOutboundRttInflationMs: undefined,
|
|
4417
4417
|
camTrackEndedCount: 0,
|
|
4418
|
-
highestPreferredLayerChangeCounts: {},
|
|
4419
4418
|
micTrackEndedCount: 0,
|
|
4420
|
-
|
|
4419
|
+
numCamHighestPreferredSpatialLayerChanges: 0,
|
|
4420
|
+
numCamHighestPreferredSpatialLayerChanges0To1: 0,
|
|
4421
|
+
numCamHighestPreferredSpatialLayerChanges0To2: 0,
|
|
4422
|
+
numCamHighestPreferredSpatialLayerChanges1To0: 0,
|
|
4423
|
+
numCamHighestPreferredSpatialLayerChanges1To2: 0,
|
|
4424
|
+
numCamHighestPreferredSpatialLayerChanges2To0: 0,
|
|
4425
|
+
numCamHighestPreferredSpatialLayerChanges2To1: 0,
|
|
4426
|
+
numCamPreferredSpatialLayerSwitchTimeouts: 0,
|
|
4421
4427
|
numIceConnected: 0,
|
|
4422
4428
|
numIceDisconnected: 0,
|
|
4423
4429
|
numIceFailed: 0,
|
|
4424
4430
|
numNewPc: 0,
|
|
4425
|
-
numPreferredSpatialLayerChanges: 0,
|
|
4426
|
-
preferredSpatialLayerChangeCounts: {},
|
|
4427
4431
|
sfuMsFromOfflineToClose: 0,
|
|
4428
4432
|
sfuOfflineToCloseCount: 0,
|
|
4429
4433
|
sfuOfflineWhileConnectedCount: 0,
|
|
@@ -5575,7 +5579,7 @@ class VegaRtcManager {
|
|
|
5575
5579
|
this._applyStreamResolution(streamId);
|
|
5576
5580
|
}
|
|
5577
5581
|
_applyStreamResolution(streamId) {
|
|
5578
|
-
var _a, _b, _c;
|
|
5582
|
+
var _a, _b, _c, _d;
|
|
5579
5583
|
const resolution = this._streamIdToVideoResolution.get(streamId);
|
|
5580
5584
|
const consumerId = this._streamIdToVideoConsumerId.get(streamId);
|
|
5581
5585
|
const consumer = this._consumers.get(consumerId);
|
|
@@ -5593,10 +5597,6 @@ class VegaRtcManager {
|
|
|
5593
5597
|
if (consumer.appData.spatialLayer !== spatialLayer || consumer.appData.temporalLayer !== temporalLayer) {
|
|
5594
5598
|
const previousSpatialLayer = consumer.appData.spatialLayer;
|
|
5595
5599
|
const spatialLayerChanged = previousSpatialLayer !== spatialLayer;
|
|
5596
|
-
if (spatialLayerChanged) {
|
|
5597
|
-
this.analytics.numPreferredSpatialLayerChanges++;
|
|
5598
|
-
this._incrementHistogramCount(this.analytics.preferredSpatialLayerChangeCounts, `${previousSpatialLayer}->${spatialLayer}`);
|
|
5599
|
-
}
|
|
5600
5600
|
consumer.appData.spatialLayer = spatialLayer;
|
|
5601
5601
|
consumer.appData.temporalLayer = temporalLayer;
|
|
5602
5602
|
(_c = this._vegaConnection) === null || _c === void 0 ? void 0 : _c.message("setConsumersPreferredLayers", {
|
|
@@ -5604,10 +5604,14 @@ class VegaRtcManager {
|
|
|
5604
5604
|
spatialLayer,
|
|
5605
5605
|
temporalLayer,
|
|
5606
5606
|
});
|
|
5607
|
-
if (spatialLayerChanged) {
|
|
5608
|
-
|
|
5609
|
-
|
|
5610
|
-
|
|
5607
|
+
if (spatialLayerChanged && !consumer.appData.screenShare) {
|
|
5608
|
+
const encodings = (_d = consumer._rtpParameters) === null || _d === void 0 ? void 0 : _d.encodings;
|
|
5609
|
+
const topSpatialLayer = getTopSpatialLayer((encodings === null || encodings === void 0 ? void 0 : encodings.length) ? encodings : [{}]);
|
|
5610
|
+
const fromLayer = Math.min(previousSpatialLayer, topSpatialLayer);
|
|
5611
|
+
const toLayer = Math.min(spatialLayer, topSpatialLayer);
|
|
5612
|
+
if (fromLayer !== toLayer) {
|
|
5613
|
+
this._watchForPreferredLayerSwitch(consumerId, consumer, { toHigherLayer: toLayer > fromLayer });
|
|
5614
|
+
}
|
|
5611
5615
|
}
|
|
5612
5616
|
}
|
|
5613
5617
|
}
|
|
@@ -5628,7 +5632,12 @@ class VegaRtcManager {
|
|
|
5628
5632
|
this._preferredLayerSwitchWatches.delete(consumerId);
|
|
5629
5633
|
};
|
|
5630
5634
|
this._preferredLayerSwitchWatches.set(consumerId, { stop });
|
|
5631
|
-
const timeoutId = setTimeout(
|
|
5635
|
+
const timeoutId = setTimeout(() => {
|
|
5636
|
+
if (!stopped && intervalId !== undefined && !consumer.closed) {
|
|
5637
|
+
this.analytics.numCamPreferredSpatialLayerSwitchTimeouts++;
|
|
5638
|
+
}
|
|
5639
|
+
stop();
|
|
5640
|
+
}, PREFERRED_LAYER_SWITCH_WATCH_TIMEOUT_MS);
|
|
5632
5641
|
(() => __awaiter(this, void 0, void 0, function* () {
|
|
5633
5642
|
const sentAt = Date.now();
|
|
5634
5643
|
const baseline = yield this._getConsumerFrameSize(consumer);
|
|
@@ -5680,7 +5689,7 @@ class VegaRtcManager {
|
|
|
5680
5689
|
_recordPreferredLayerSwitchLatency(latencyMs) {
|
|
5681
5690
|
recordMetricSample(this._preferredLayerSwitchLatencyStats, latencyMs);
|
|
5682
5691
|
const { avg } = aggregateMetricStats(this._preferredLayerSwitchLatencyStats);
|
|
5683
|
-
this.analytics.
|
|
5692
|
+
this.analytics.avgCamPreferredSpatialLayerSwitchLatencyMs = avg;
|
|
5684
5693
|
}
|
|
5685
5694
|
_onUpdatedStats(statsByView) {
|
|
5686
5695
|
var _a, _b, _c, _d;
|
|
@@ -6014,8 +6023,8 @@ class VegaRtcManager {
|
|
|
6014
6023
|
}
|
|
6015
6024
|
if (this._webcamProducerHighestPreferredLayer !== undefined &&
|
|
6016
6025
|
this._webcamProducerHighestPreferredLayer !== spatialLayer) {
|
|
6017
|
-
this.analytics.
|
|
6018
|
-
this.
|
|
6026
|
+
this.analytics.numCamHighestPreferredSpatialLayerChanges++;
|
|
6027
|
+
this._incrementLayerChangeCount(this._webcamProducerHighestPreferredLayer, spatialLayer);
|
|
6019
6028
|
}
|
|
6020
6029
|
this._webcamProducerHighestPreferredLayer = spatialLayer;
|
|
6021
6030
|
logger$2.info("_onChangedHighestPreferredLayer()", { producerId, spatialLayer });
|
|
@@ -6069,8 +6078,12 @@ class VegaRtcManager {
|
|
|
6069
6078
|
}
|
|
6070
6079
|
});
|
|
6071
6080
|
}
|
|
6072
|
-
|
|
6073
|
-
|
|
6081
|
+
_incrementLayerChangeCount(from, to) {
|
|
6082
|
+
const counts = this.analytics;
|
|
6083
|
+
const key = `numCamHighestPreferredSpatialLayerChanges${from}To${to}`;
|
|
6084
|
+
const count = counts[key];
|
|
6085
|
+
if (count !== undefined)
|
|
6086
|
+
counts[key] = count + 1;
|
|
6074
6087
|
}
|
|
6075
6088
|
_onDataConsumerReady(options) {
|
|
6076
6089
|
return __awaiter(this, void 0, void 0, function* () {
|
package/dist/legacy-esm.js
CHANGED
|
@@ -4411,19 +4411,23 @@ class VegaRtcManager {
|
|
|
4411
4411
|
};
|
|
4412
4412
|
(_a = window === null || window === void 0 ? void 0 : window.addEventListener) === null || _a === void 0 ? void 0 : _a.call(window, "offline", this._sfuZombie.onBrowserOffline);
|
|
4413
4413
|
this.analytics = {
|
|
4414
|
-
|
|
4414
|
+
avgCamPreferredSpatialLayerSwitchLatencyMs: undefined,
|
|
4415
4415
|
camOutboundCongestedFraction: undefined,
|
|
4416
4416
|
camOutboundRttInflationMs: undefined,
|
|
4417
4417
|
camTrackEndedCount: 0,
|
|
4418
|
-
highestPreferredLayerChangeCounts: {},
|
|
4419
4418
|
micTrackEndedCount: 0,
|
|
4420
|
-
|
|
4419
|
+
numCamHighestPreferredSpatialLayerChanges: 0,
|
|
4420
|
+
numCamHighestPreferredSpatialLayerChanges0To1: 0,
|
|
4421
|
+
numCamHighestPreferredSpatialLayerChanges0To2: 0,
|
|
4422
|
+
numCamHighestPreferredSpatialLayerChanges1To0: 0,
|
|
4423
|
+
numCamHighestPreferredSpatialLayerChanges1To2: 0,
|
|
4424
|
+
numCamHighestPreferredSpatialLayerChanges2To0: 0,
|
|
4425
|
+
numCamHighestPreferredSpatialLayerChanges2To1: 0,
|
|
4426
|
+
numCamPreferredSpatialLayerSwitchTimeouts: 0,
|
|
4421
4427
|
numIceConnected: 0,
|
|
4422
4428
|
numIceDisconnected: 0,
|
|
4423
4429
|
numIceFailed: 0,
|
|
4424
4430
|
numNewPc: 0,
|
|
4425
|
-
numPreferredSpatialLayerChanges: 0,
|
|
4426
|
-
preferredSpatialLayerChangeCounts: {},
|
|
4427
4431
|
sfuMsFromOfflineToClose: 0,
|
|
4428
4432
|
sfuOfflineToCloseCount: 0,
|
|
4429
4433
|
sfuOfflineWhileConnectedCount: 0,
|
|
@@ -5575,7 +5579,7 @@ class VegaRtcManager {
|
|
|
5575
5579
|
this._applyStreamResolution(streamId);
|
|
5576
5580
|
}
|
|
5577
5581
|
_applyStreamResolution(streamId) {
|
|
5578
|
-
var _a, _b, _c;
|
|
5582
|
+
var _a, _b, _c, _d;
|
|
5579
5583
|
const resolution = this._streamIdToVideoResolution.get(streamId);
|
|
5580
5584
|
const consumerId = this._streamIdToVideoConsumerId.get(streamId);
|
|
5581
5585
|
const consumer = this._consumers.get(consumerId);
|
|
@@ -5593,10 +5597,6 @@ class VegaRtcManager {
|
|
|
5593
5597
|
if (consumer.appData.spatialLayer !== spatialLayer || consumer.appData.temporalLayer !== temporalLayer) {
|
|
5594
5598
|
const previousSpatialLayer = consumer.appData.spatialLayer;
|
|
5595
5599
|
const spatialLayerChanged = previousSpatialLayer !== spatialLayer;
|
|
5596
|
-
if (spatialLayerChanged) {
|
|
5597
|
-
this.analytics.numPreferredSpatialLayerChanges++;
|
|
5598
|
-
this._incrementHistogramCount(this.analytics.preferredSpatialLayerChangeCounts, `${previousSpatialLayer}->${spatialLayer}`);
|
|
5599
|
-
}
|
|
5600
5600
|
consumer.appData.spatialLayer = spatialLayer;
|
|
5601
5601
|
consumer.appData.temporalLayer = temporalLayer;
|
|
5602
5602
|
(_c = this._vegaConnection) === null || _c === void 0 ? void 0 : _c.message("setConsumersPreferredLayers", {
|
|
@@ -5604,10 +5604,14 @@ class VegaRtcManager {
|
|
|
5604
5604
|
spatialLayer,
|
|
5605
5605
|
temporalLayer,
|
|
5606
5606
|
});
|
|
5607
|
-
if (spatialLayerChanged) {
|
|
5608
|
-
|
|
5609
|
-
|
|
5610
|
-
|
|
5607
|
+
if (spatialLayerChanged && !consumer.appData.screenShare) {
|
|
5608
|
+
const encodings = (_d = consumer._rtpParameters) === null || _d === void 0 ? void 0 : _d.encodings;
|
|
5609
|
+
const topSpatialLayer = getTopSpatialLayer((encodings === null || encodings === void 0 ? void 0 : encodings.length) ? encodings : [{}]);
|
|
5610
|
+
const fromLayer = Math.min(previousSpatialLayer, topSpatialLayer);
|
|
5611
|
+
const toLayer = Math.min(spatialLayer, topSpatialLayer);
|
|
5612
|
+
if (fromLayer !== toLayer) {
|
|
5613
|
+
this._watchForPreferredLayerSwitch(consumerId, consumer, { toHigherLayer: toLayer > fromLayer });
|
|
5614
|
+
}
|
|
5611
5615
|
}
|
|
5612
5616
|
}
|
|
5613
5617
|
}
|
|
@@ -5628,7 +5632,12 @@ class VegaRtcManager {
|
|
|
5628
5632
|
this._preferredLayerSwitchWatches.delete(consumerId);
|
|
5629
5633
|
};
|
|
5630
5634
|
this._preferredLayerSwitchWatches.set(consumerId, { stop });
|
|
5631
|
-
const timeoutId = setTimeout(
|
|
5635
|
+
const timeoutId = setTimeout(() => {
|
|
5636
|
+
if (!stopped && intervalId !== undefined && !consumer.closed) {
|
|
5637
|
+
this.analytics.numCamPreferredSpatialLayerSwitchTimeouts++;
|
|
5638
|
+
}
|
|
5639
|
+
stop();
|
|
5640
|
+
}, PREFERRED_LAYER_SWITCH_WATCH_TIMEOUT_MS);
|
|
5632
5641
|
(() => __awaiter(this, void 0, void 0, function* () {
|
|
5633
5642
|
const sentAt = Date.now();
|
|
5634
5643
|
const baseline = yield this._getConsumerFrameSize(consumer);
|
|
@@ -5680,7 +5689,7 @@ class VegaRtcManager {
|
|
|
5680
5689
|
_recordPreferredLayerSwitchLatency(latencyMs) {
|
|
5681
5690
|
recordMetricSample(this._preferredLayerSwitchLatencyStats, latencyMs);
|
|
5682
5691
|
const { avg } = aggregateMetricStats(this._preferredLayerSwitchLatencyStats);
|
|
5683
|
-
this.analytics.
|
|
5692
|
+
this.analytics.avgCamPreferredSpatialLayerSwitchLatencyMs = avg;
|
|
5684
5693
|
}
|
|
5685
5694
|
_onUpdatedStats(statsByView) {
|
|
5686
5695
|
var _a, _b, _c, _d;
|
|
@@ -6014,8 +6023,8 @@ class VegaRtcManager {
|
|
|
6014
6023
|
}
|
|
6015
6024
|
if (this._webcamProducerHighestPreferredLayer !== undefined &&
|
|
6016
6025
|
this._webcamProducerHighestPreferredLayer !== spatialLayer) {
|
|
6017
|
-
this.analytics.
|
|
6018
|
-
this.
|
|
6026
|
+
this.analytics.numCamHighestPreferredSpatialLayerChanges++;
|
|
6027
|
+
this._incrementLayerChangeCount(this._webcamProducerHighestPreferredLayer, spatialLayer);
|
|
6019
6028
|
}
|
|
6020
6029
|
this._webcamProducerHighestPreferredLayer = spatialLayer;
|
|
6021
6030
|
logger$2.info("_onChangedHighestPreferredLayer()", { producerId, spatialLayer });
|
|
@@ -6069,8 +6078,12 @@ class VegaRtcManager {
|
|
|
6069
6078
|
}
|
|
6070
6079
|
});
|
|
6071
6080
|
}
|
|
6072
|
-
|
|
6073
|
-
|
|
6081
|
+
_incrementLayerChangeCount(from, to) {
|
|
6082
|
+
const counts = this.analytics;
|
|
6083
|
+
const key = `numCamHighestPreferredSpatialLayerChanges${from}To${to}`;
|
|
6084
|
+
const count = counts[key];
|
|
6085
|
+
if (count !== undefined)
|
|
6086
|
+
counts[key] = count + 1;
|
|
6074
6087
|
}
|
|
6075
6088
|
_onDataConsumerReady(options) {
|
|
6076
6089
|
return __awaiter(this, void 0, void 0, function* () {
|