@whereby.com/media 11.2.3 → 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 +36 -26
- 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 +36 -26
- package/dist/legacy-esm.js +36 -26
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -2803,12 +2803,9 @@ class P2pRtcManager {
|
|
|
2803
2803
|
logger$7.warn("RtcManager closed. Will not send event", eventName, data);
|
|
2804
2804
|
return;
|
|
2805
2805
|
}
|
|
2806
|
-
if (
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
else {
|
|
2810
|
-
this._serverSocket.emit(eventName, data);
|
|
2811
|
-
}
|
|
2806
|
+
if (!this._serverSocket.joinRoomFinished)
|
|
2807
|
+
return;
|
|
2808
|
+
this._serverSocket.emit(eventName, data);
|
|
2812
2809
|
}
|
|
2813
2810
|
_emit(eventName, data) {
|
|
2814
2811
|
this._emitter.emit(eventName, data);
|
|
@@ -4434,19 +4431,23 @@ class VegaRtcManager {
|
|
|
4434
4431
|
};
|
|
4435
4432
|
(_a = window === null || window === void 0 ? void 0 : window.addEventListener) === null || _a === void 0 ? void 0 : _a.call(window, "offline", this._sfuZombie.onBrowserOffline);
|
|
4436
4433
|
this.analytics = {
|
|
4437
|
-
|
|
4434
|
+
avgCamPreferredSpatialLayerSwitchLatencyMs: undefined,
|
|
4438
4435
|
camOutboundCongestedFraction: undefined,
|
|
4439
4436
|
camOutboundRttInflationMs: undefined,
|
|
4440
4437
|
camTrackEndedCount: 0,
|
|
4441
|
-
highestPreferredLayerChangeCounts: {},
|
|
4442
4438
|
micTrackEndedCount: 0,
|
|
4443
|
-
|
|
4439
|
+
numCamHighestPreferredSpatialLayerChanges: 0,
|
|
4440
|
+
numCamHighestPreferredSpatialLayerChanges0To1: 0,
|
|
4441
|
+
numCamHighestPreferredSpatialLayerChanges0To2: 0,
|
|
4442
|
+
numCamHighestPreferredSpatialLayerChanges1To0: 0,
|
|
4443
|
+
numCamHighestPreferredSpatialLayerChanges1To2: 0,
|
|
4444
|
+
numCamHighestPreferredSpatialLayerChanges2To0: 0,
|
|
4445
|
+
numCamHighestPreferredSpatialLayerChanges2To1: 0,
|
|
4446
|
+
numCamPreferredSpatialLayerSwitchTimeouts: 0,
|
|
4444
4447
|
numIceConnected: 0,
|
|
4445
4448
|
numIceDisconnected: 0,
|
|
4446
4449
|
numIceFailed: 0,
|
|
4447
4450
|
numNewPc: 0,
|
|
4448
|
-
numPreferredSpatialLayerChanges: 0,
|
|
4449
|
-
preferredSpatialLayerChangeCounts: {},
|
|
4450
4451
|
sfuMsFromOfflineToClose: 0,
|
|
4451
4452
|
sfuOfflineToCloseCount: 0,
|
|
4452
4453
|
sfuOfflineWhileConnectedCount: 0,
|
|
@@ -5598,7 +5599,7 @@ class VegaRtcManager {
|
|
|
5598
5599
|
this._applyStreamResolution(streamId);
|
|
5599
5600
|
}
|
|
5600
5601
|
_applyStreamResolution(streamId) {
|
|
5601
|
-
var _a, _b, _c;
|
|
5602
|
+
var _a, _b, _c, _d;
|
|
5602
5603
|
const resolution = this._streamIdToVideoResolution.get(streamId);
|
|
5603
5604
|
const consumerId = this._streamIdToVideoConsumerId.get(streamId);
|
|
5604
5605
|
const consumer = this._consumers.get(consumerId);
|
|
@@ -5616,10 +5617,6 @@ class VegaRtcManager {
|
|
|
5616
5617
|
if (consumer.appData.spatialLayer !== spatialLayer || consumer.appData.temporalLayer !== temporalLayer) {
|
|
5617
5618
|
const previousSpatialLayer = consumer.appData.spatialLayer;
|
|
5618
5619
|
const spatialLayerChanged = previousSpatialLayer !== spatialLayer;
|
|
5619
|
-
if (spatialLayerChanged) {
|
|
5620
|
-
this.analytics.numPreferredSpatialLayerChanges++;
|
|
5621
|
-
this._incrementHistogramCount(this.analytics.preferredSpatialLayerChangeCounts, `${previousSpatialLayer}->${spatialLayer}`);
|
|
5622
|
-
}
|
|
5623
5620
|
consumer.appData.spatialLayer = spatialLayer;
|
|
5624
5621
|
consumer.appData.temporalLayer = temporalLayer;
|
|
5625
5622
|
(_c = this._vegaConnection) === null || _c === void 0 ? void 0 : _c.message("setConsumersPreferredLayers", {
|
|
@@ -5627,10 +5624,14 @@ class VegaRtcManager {
|
|
|
5627
5624
|
spatialLayer,
|
|
5628
5625
|
temporalLayer,
|
|
5629
5626
|
});
|
|
5630
|
-
if (spatialLayerChanged) {
|
|
5631
|
-
|
|
5632
|
-
|
|
5633
|
-
|
|
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
|
+
}
|
|
5634
5635
|
}
|
|
5635
5636
|
}
|
|
5636
5637
|
}
|
|
@@ -5651,7 +5652,12 @@ class VegaRtcManager {
|
|
|
5651
5652
|
this._preferredLayerSwitchWatches.delete(consumerId);
|
|
5652
5653
|
};
|
|
5653
5654
|
this._preferredLayerSwitchWatches.set(consumerId, { stop });
|
|
5654
|
-
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);
|
|
5655
5661
|
(() => __awaiter(this, void 0, void 0, function* () {
|
|
5656
5662
|
const sentAt = Date.now();
|
|
5657
5663
|
const baseline = yield this._getConsumerFrameSize(consumer);
|
|
@@ -5703,7 +5709,7 @@ class VegaRtcManager {
|
|
|
5703
5709
|
_recordPreferredLayerSwitchLatency(latencyMs) {
|
|
5704
5710
|
recordMetricSample(this._preferredLayerSwitchLatencyStats, latencyMs);
|
|
5705
5711
|
const { avg } = aggregateMetricStats(this._preferredLayerSwitchLatencyStats);
|
|
5706
|
-
this.analytics.
|
|
5712
|
+
this.analytics.avgCamPreferredSpatialLayerSwitchLatencyMs = avg;
|
|
5707
5713
|
}
|
|
5708
5714
|
_onUpdatedStats(statsByView) {
|
|
5709
5715
|
var _a, _b, _c, _d;
|
|
@@ -6037,8 +6043,8 @@ class VegaRtcManager {
|
|
|
6037
6043
|
}
|
|
6038
6044
|
if (this._webcamProducerHighestPreferredLayer !== undefined &&
|
|
6039
6045
|
this._webcamProducerHighestPreferredLayer !== spatialLayer) {
|
|
6040
|
-
this.analytics.
|
|
6041
|
-
this.
|
|
6046
|
+
this.analytics.numCamHighestPreferredSpatialLayerChanges++;
|
|
6047
|
+
this._incrementLayerChangeCount(this._webcamProducerHighestPreferredLayer, spatialLayer);
|
|
6042
6048
|
}
|
|
6043
6049
|
this._webcamProducerHighestPreferredLayer = spatialLayer;
|
|
6044
6050
|
logger$2.info("_onChangedHighestPreferredLayer()", { producerId, spatialLayer });
|
|
@@ -6092,8 +6098,12 @@ class VegaRtcManager {
|
|
|
6092
6098
|
}
|
|
6093
6099
|
});
|
|
6094
6100
|
}
|
|
6095
|
-
|
|
6096
|
-
|
|
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;
|
|
6097
6107
|
}
|
|
6098
6108
|
_onDataConsumerReady(options) {
|
|
6099
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
|
@@ -2783,12 +2783,9 @@ class P2pRtcManager {
|
|
|
2783
2783
|
logger$7.warn("RtcManager closed. Will not send event", eventName, data);
|
|
2784
2784
|
return;
|
|
2785
2785
|
}
|
|
2786
|
-
if (
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
else {
|
|
2790
|
-
this._serverSocket.emit(eventName, data);
|
|
2791
|
-
}
|
|
2786
|
+
if (!this._serverSocket.joinRoomFinished)
|
|
2787
|
+
return;
|
|
2788
|
+
this._serverSocket.emit(eventName, data);
|
|
2792
2789
|
}
|
|
2793
2790
|
_emit(eventName, data) {
|
|
2794
2791
|
this._emitter.emit(eventName, data);
|
|
@@ -4414,19 +4411,23 @@ class VegaRtcManager {
|
|
|
4414
4411
|
};
|
|
4415
4412
|
(_a = window === null || window === void 0 ? void 0 : window.addEventListener) === null || _a === void 0 ? void 0 : _a.call(window, "offline", this._sfuZombie.onBrowserOffline);
|
|
4416
4413
|
this.analytics = {
|
|
4417
|
-
|
|
4414
|
+
avgCamPreferredSpatialLayerSwitchLatencyMs: undefined,
|
|
4418
4415
|
camOutboundCongestedFraction: undefined,
|
|
4419
4416
|
camOutboundRttInflationMs: undefined,
|
|
4420
4417
|
camTrackEndedCount: 0,
|
|
4421
|
-
highestPreferredLayerChangeCounts: {},
|
|
4422
4418
|
micTrackEndedCount: 0,
|
|
4423
|
-
|
|
4419
|
+
numCamHighestPreferredSpatialLayerChanges: 0,
|
|
4420
|
+
numCamHighestPreferredSpatialLayerChanges0To1: 0,
|
|
4421
|
+
numCamHighestPreferredSpatialLayerChanges0To2: 0,
|
|
4422
|
+
numCamHighestPreferredSpatialLayerChanges1To0: 0,
|
|
4423
|
+
numCamHighestPreferredSpatialLayerChanges1To2: 0,
|
|
4424
|
+
numCamHighestPreferredSpatialLayerChanges2To0: 0,
|
|
4425
|
+
numCamHighestPreferredSpatialLayerChanges2To1: 0,
|
|
4426
|
+
numCamPreferredSpatialLayerSwitchTimeouts: 0,
|
|
4424
4427
|
numIceConnected: 0,
|
|
4425
4428
|
numIceDisconnected: 0,
|
|
4426
4429
|
numIceFailed: 0,
|
|
4427
4430
|
numNewPc: 0,
|
|
4428
|
-
numPreferredSpatialLayerChanges: 0,
|
|
4429
|
-
preferredSpatialLayerChangeCounts: {},
|
|
4430
4431
|
sfuMsFromOfflineToClose: 0,
|
|
4431
4432
|
sfuOfflineToCloseCount: 0,
|
|
4432
4433
|
sfuOfflineWhileConnectedCount: 0,
|
|
@@ -5578,7 +5579,7 @@ class VegaRtcManager {
|
|
|
5578
5579
|
this._applyStreamResolution(streamId);
|
|
5579
5580
|
}
|
|
5580
5581
|
_applyStreamResolution(streamId) {
|
|
5581
|
-
var _a, _b, _c;
|
|
5582
|
+
var _a, _b, _c, _d;
|
|
5582
5583
|
const resolution = this._streamIdToVideoResolution.get(streamId);
|
|
5583
5584
|
const consumerId = this._streamIdToVideoConsumerId.get(streamId);
|
|
5584
5585
|
const consumer = this._consumers.get(consumerId);
|
|
@@ -5596,10 +5597,6 @@ class VegaRtcManager {
|
|
|
5596
5597
|
if (consumer.appData.spatialLayer !== spatialLayer || consumer.appData.temporalLayer !== temporalLayer) {
|
|
5597
5598
|
const previousSpatialLayer = consumer.appData.spatialLayer;
|
|
5598
5599
|
const spatialLayerChanged = previousSpatialLayer !== spatialLayer;
|
|
5599
|
-
if (spatialLayerChanged) {
|
|
5600
|
-
this.analytics.numPreferredSpatialLayerChanges++;
|
|
5601
|
-
this._incrementHistogramCount(this.analytics.preferredSpatialLayerChangeCounts, `${previousSpatialLayer}->${spatialLayer}`);
|
|
5602
|
-
}
|
|
5603
5600
|
consumer.appData.spatialLayer = spatialLayer;
|
|
5604
5601
|
consumer.appData.temporalLayer = temporalLayer;
|
|
5605
5602
|
(_c = this._vegaConnection) === null || _c === void 0 ? void 0 : _c.message("setConsumersPreferredLayers", {
|
|
@@ -5607,10 +5604,14 @@ class VegaRtcManager {
|
|
|
5607
5604
|
spatialLayer,
|
|
5608
5605
|
temporalLayer,
|
|
5609
5606
|
});
|
|
5610
|
-
if (spatialLayerChanged) {
|
|
5611
|
-
|
|
5612
|
-
|
|
5613
|
-
|
|
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
|
+
}
|
|
5614
5615
|
}
|
|
5615
5616
|
}
|
|
5616
5617
|
}
|
|
@@ -5631,7 +5632,12 @@ class VegaRtcManager {
|
|
|
5631
5632
|
this._preferredLayerSwitchWatches.delete(consumerId);
|
|
5632
5633
|
};
|
|
5633
5634
|
this._preferredLayerSwitchWatches.set(consumerId, { stop });
|
|
5634
|
-
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);
|
|
5635
5641
|
(() => __awaiter(this, void 0, void 0, function* () {
|
|
5636
5642
|
const sentAt = Date.now();
|
|
5637
5643
|
const baseline = yield this._getConsumerFrameSize(consumer);
|
|
@@ -5683,7 +5689,7 @@ class VegaRtcManager {
|
|
|
5683
5689
|
_recordPreferredLayerSwitchLatency(latencyMs) {
|
|
5684
5690
|
recordMetricSample(this._preferredLayerSwitchLatencyStats, latencyMs);
|
|
5685
5691
|
const { avg } = aggregateMetricStats(this._preferredLayerSwitchLatencyStats);
|
|
5686
|
-
this.analytics.
|
|
5692
|
+
this.analytics.avgCamPreferredSpatialLayerSwitchLatencyMs = avg;
|
|
5687
5693
|
}
|
|
5688
5694
|
_onUpdatedStats(statsByView) {
|
|
5689
5695
|
var _a, _b, _c, _d;
|
|
@@ -6017,8 +6023,8 @@ class VegaRtcManager {
|
|
|
6017
6023
|
}
|
|
6018
6024
|
if (this._webcamProducerHighestPreferredLayer !== undefined &&
|
|
6019
6025
|
this._webcamProducerHighestPreferredLayer !== spatialLayer) {
|
|
6020
|
-
this.analytics.
|
|
6021
|
-
this.
|
|
6026
|
+
this.analytics.numCamHighestPreferredSpatialLayerChanges++;
|
|
6027
|
+
this._incrementLayerChangeCount(this._webcamProducerHighestPreferredLayer, spatialLayer);
|
|
6022
6028
|
}
|
|
6023
6029
|
this._webcamProducerHighestPreferredLayer = spatialLayer;
|
|
6024
6030
|
logger$2.info("_onChangedHighestPreferredLayer()", { producerId, spatialLayer });
|
|
@@ -6072,8 +6078,12 @@ class VegaRtcManager {
|
|
|
6072
6078
|
}
|
|
6073
6079
|
});
|
|
6074
6080
|
}
|
|
6075
|
-
|
|
6076
|
-
|
|
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;
|
|
6077
6087
|
}
|
|
6078
6088
|
_onDataConsumerReady(options) {
|
|
6079
6089
|
return __awaiter(this, void 0, void 0, function* () {
|
package/dist/legacy-esm.js
CHANGED
|
@@ -2783,12 +2783,9 @@ class P2pRtcManager {
|
|
|
2783
2783
|
logger$7.warn("RtcManager closed. Will not send event", eventName, data);
|
|
2784
2784
|
return;
|
|
2785
2785
|
}
|
|
2786
|
-
if (
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
else {
|
|
2790
|
-
this._serverSocket.emit(eventName, data);
|
|
2791
|
-
}
|
|
2786
|
+
if (!this._serverSocket.joinRoomFinished)
|
|
2787
|
+
return;
|
|
2788
|
+
this._serverSocket.emit(eventName, data);
|
|
2792
2789
|
}
|
|
2793
2790
|
_emit(eventName, data) {
|
|
2794
2791
|
this._emitter.emit(eventName, data);
|
|
@@ -4414,19 +4411,23 @@ class VegaRtcManager {
|
|
|
4414
4411
|
};
|
|
4415
4412
|
(_a = window === null || window === void 0 ? void 0 : window.addEventListener) === null || _a === void 0 ? void 0 : _a.call(window, "offline", this._sfuZombie.onBrowserOffline);
|
|
4416
4413
|
this.analytics = {
|
|
4417
|
-
|
|
4414
|
+
avgCamPreferredSpatialLayerSwitchLatencyMs: undefined,
|
|
4418
4415
|
camOutboundCongestedFraction: undefined,
|
|
4419
4416
|
camOutboundRttInflationMs: undefined,
|
|
4420
4417
|
camTrackEndedCount: 0,
|
|
4421
|
-
highestPreferredLayerChangeCounts: {},
|
|
4422
4418
|
micTrackEndedCount: 0,
|
|
4423
|
-
|
|
4419
|
+
numCamHighestPreferredSpatialLayerChanges: 0,
|
|
4420
|
+
numCamHighestPreferredSpatialLayerChanges0To1: 0,
|
|
4421
|
+
numCamHighestPreferredSpatialLayerChanges0To2: 0,
|
|
4422
|
+
numCamHighestPreferredSpatialLayerChanges1To0: 0,
|
|
4423
|
+
numCamHighestPreferredSpatialLayerChanges1To2: 0,
|
|
4424
|
+
numCamHighestPreferredSpatialLayerChanges2To0: 0,
|
|
4425
|
+
numCamHighestPreferredSpatialLayerChanges2To1: 0,
|
|
4426
|
+
numCamPreferredSpatialLayerSwitchTimeouts: 0,
|
|
4424
4427
|
numIceConnected: 0,
|
|
4425
4428
|
numIceDisconnected: 0,
|
|
4426
4429
|
numIceFailed: 0,
|
|
4427
4430
|
numNewPc: 0,
|
|
4428
|
-
numPreferredSpatialLayerChanges: 0,
|
|
4429
|
-
preferredSpatialLayerChangeCounts: {},
|
|
4430
4431
|
sfuMsFromOfflineToClose: 0,
|
|
4431
4432
|
sfuOfflineToCloseCount: 0,
|
|
4432
4433
|
sfuOfflineWhileConnectedCount: 0,
|
|
@@ -5578,7 +5579,7 @@ class VegaRtcManager {
|
|
|
5578
5579
|
this._applyStreamResolution(streamId);
|
|
5579
5580
|
}
|
|
5580
5581
|
_applyStreamResolution(streamId) {
|
|
5581
|
-
var _a, _b, _c;
|
|
5582
|
+
var _a, _b, _c, _d;
|
|
5582
5583
|
const resolution = this._streamIdToVideoResolution.get(streamId);
|
|
5583
5584
|
const consumerId = this._streamIdToVideoConsumerId.get(streamId);
|
|
5584
5585
|
const consumer = this._consumers.get(consumerId);
|
|
@@ -5596,10 +5597,6 @@ class VegaRtcManager {
|
|
|
5596
5597
|
if (consumer.appData.spatialLayer !== spatialLayer || consumer.appData.temporalLayer !== temporalLayer) {
|
|
5597
5598
|
const previousSpatialLayer = consumer.appData.spatialLayer;
|
|
5598
5599
|
const spatialLayerChanged = previousSpatialLayer !== spatialLayer;
|
|
5599
|
-
if (spatialLayerChanged) {
|
|
5600
|
-
this.analytics.numPreferredSpatialLayerChanges++;
|
|
5601
|
-
this._incrementHistogramCount(this.analytics.preferredSpatialLayerChangeCounts, `${previousSpatialLayer}->${spatialLayer}`);
|
|
5602
|
-
}
|
|
5603
5600
|
consumer.appData.spatialLayer = spatialLayer;
|
|
5604
5601
|
consumer.appData.temporalLayer = temporalLayer;
|
|
5605
5602
|
(_c = this._vegaConnection) === null || _c === void 0 ? void 0 : _c.message("setConsumersPreferredLayers", {
|
|
@@ -5607,10 +5604,14 @@ class VegaRtcManager {
|
|
|
5607
5604
|
spatialLayer,
|
|
5608
5605
|
temporalLayer,
|
|
5609
5606
|
});
|
|
5610
|
-
if (spatialLayerChanged) {
|
|
5611
|
-
|
|
5612
|
-
|
|
5613
|
-
|
|
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
|
+
}
|
|
5614
5615
|
}
|
|
5615
5616
|
}
|
|
5616
5617
|
}
|
|
@@ -5631,7 +5632,12 @@ class VegaRtcManager {
|
|
|
5631
5632
|
this._preferredLayerSwitchWatches.delete(consumerId);
|
|
5632
5633
|
};
|
|
5633
5634
|
this._preferredLayerSwitchWatches.set(consumerId, { stop });
|
|
5634
|
-
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);
|
|
5635
5641
|
(() => __awaiter(this, void 0, void 0, function* () {
|
|
5636
5642
|
const sentAt = Date.now();
|
|
5637
5643
|
const baseline = yield this._getConsumerFrameSize(consumer);
|
|
@@ -5683,7 +5689,7 @@ class VegaRtcManager {
|
|
|
5683
5689
|
_recordPreferredLayerSwitchLatency(latencyMs) {
|
|
5684
5690
|
recordMetricSample(this._preferredLayerSwitchLatencyStats, latencyMs);
|
|
5685
5691
|
const { avg } = aggregateMetricStats(this._preferredLayerSwitchLatencyStats);
|
|
5686
|
-
this.analytics.
|
|
5692
|
+
this.analytics.avgCamPreferredSpatialLayerSwitchLatencyMs = avg;
|
|
5687
5693
|
}
|
|
5688
5694
|
_onUpdatedStats(statsByView) {
|
|
5689
5695
|
var _a, _b, _c, _d;
|
|
@@ -6017,8 +6023,8 @@ class VegaRtcManager {
|
|
|
6017
6023
|
}
|
|
6018
6024
|
if (this._webcamProducerHighestPreferredLayer !== undefined &&
|
|
6019
6025
|
this._webcamProducerHighestPreferredLayer !== spatialLayer) {
|
|
6020
|
-
this.analytics.
|
|
6021
|
-
this.
|
|
6026
|
+
this.analytics.numCamHighestPreferredSpatialLayerChanges++;
|
|
6027
|
+
this._incrementLayerChangeCount(this._webcamProducerHighestPreferredLayer, spatialLayer);
|
|
6022
6028
|
}
|
|
6023
6029
|
this._webcamProducerHighestPreferredLayer = spatialLayer;
|
|
6024
6030
|
logger$2.info("_onChangedHighestPreferredLayer()", { producerId, spatialLayer });
|
|
@@ -6072,8 +6078,12 @@ class VegaRtcManager {
|
|
|
6072
6078
|
}
|
|
6073
6079
|
});
|
|
6074
6080
|
}
|
|
6075
|
-
|
|
6076
|
-
|
|
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;
|
|
6077
6087
|
}
|
|
6078
6088
|
_onDataConsumerReady(options) {
|
|
6079
6089
|
return __awaiter(this, void 0, void 0, function* () {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@whereby.com/media",
|
|
3
3
|
"description": "Media library for Whereby",
|
|
4
|
-
"version": "11.2.
|
|
4
|
+
"version": "11.2.5",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/whereby/sdk",
|
|
7
7
|
"repository": {
|
|
@@ -62,8 +62,8 @@
|
|
|
62
62
|
"prettier": "^3.5.3",
|
|
63
63
|
"process": "^0.11.10",
|
|
64
64
|
"typescript": "^5.8.3",
|
|
65
|
-
"@whereby.com/jest-config": "0.1.0",
|
|
66
65
|
"@whereby.com/eslint-config": "0.1.0",
|
|
66
|
+
"@whereby.com/jest-config": "0.1.0",
|
|
67
67
|
"@whereby.com/prettier-config": "0.1.0",
|
|
68
68
|
"@whereby.com/rollup-config": "0.1.1",
|
|
69
69
|
"@whereby.com/tsconfig": "0.1.0"
|