@webex/web-client-media-engine 2.1.3 → 2.1.4
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/cjs/index.js +20 -15
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +20 -15
- package/dist/esm/index.js.map +1 -1
- package/dist/types/index.d.ts +4 -1
- package/package.json +1 -1
package/dist/esm/index.js
CHANGED
|
@@ -9428,12 +9428,17 @@ class SendOnlyTransceiver extends Transceiver {
|
|
|
9428
9428
|
}
|
|
9429
9429
|
updateSendParameters(requestedIdEncodingParamsMap) {
|
|
9430
9430
|
return __awaiter(this, void 0, void 0, function* () {
|
|
9431
|
+
if (!this.publishedTrack)
|
|
9432
|
+
return;
|
|
9433
|
+
this.setTrackRequested(requestedIdEncodingParamsMap.size > 0);
|
|
9431
9434
|
const sendParameters = this.sender.getParameters();
|
|
9432
9435
|
sendParameters.encodings.forEach((encoding, index) => {
|
|
9436
|
+
var _a, _b;
|
|
9433
9437
|
const encodingParams = requestedIdEncodingParamsMap.get(index);
|
|
9434
9438
|
encoding.active = !!encodingParams;
|
|
9435
9439
|
if (encodingParams) {
|
|
9436
|
-
const { maxPayloadBitsPerSecond,
|
|
9440
|
+
const { maxPayloadBitsPerSecond, maxFs, maxWidth, maxHeight } = encodingParams;
|
|
9441
|
+
const scaleDownRatio = getScaleDownRatio((_a = this.publishedTrack) === null || _a === void 0 ? void 0 : _a.getSettings().width, (_b = this.publishedTrack) === null || _b === void 0 ? void 0 : _b.getSettings().height, maxFs, maxWidth, maxHeight);
|
|
9437
9442
|
if (maxPayloadBitsPerSecond !== undefined && maxPayloadBitsPerSecond >= 0) {
|
|
9438
9443
|
encoding.maxBitrate = maxPayloadBitsPerSecond;
|
|
9439
9444
|
}
|
|
@@ -13278,6 +13283,7 @@ class MultistreamConnection extends EventEmitter {
|
|
|
13278
13283
|
this.overuseUpdateCallback = () => { };
|
|
13279
13284
|
this.midPredictor = new MidPredictor();
|
|
13280
13285
|
this.offerAnswerQueue = new AsyncQueue();
|
|
13286
|
+
this.requestedIdEncodingParamsMap = new Map();
|
|
13281
13287
|
this.options = Object.assign(Object.assign({}, defaultMultistreamConnectionOptions), userOptions);
|
|
13282
13288
|
logger.info(`Creating multistream connection with options ${JSON.stringify(this.options)}`);
|
|
13283
13289
|
this.initializePeerConnection();
|
|
@@ -13401,7 +13407,7 @@ class MultistreamConnection extends EventEmitter {
|
|
|
13401
13407
|
logger.warn('Ignoring non-receiver-selected requests');
|
|
13402
13408
|
}
|
|
13403
13409
|
rsRequests.forEach(({ ids, policySpecificInfo, codecInfos, maxPayloadBitsPerSecond }) => {
|
|
13404
|
-
var _a, _b, _c
|
|
13410
|
+
var _a, _b, _c;
|
|
13405
13411
|
if (ids.length > 1) {
|
|
13406
13412
|
throw new Error(`More than a single ID being unexpected/invalid ${ids}`);
|
|
13407
13413
|
}
|
|
@@ -13420,10 +13426,9 @@ class MultistreamConnection extends EventEmitter {
|
|
|
13420
13426
|
if (encodingIndex !== -1) {
|
|
13421
13427
|
const encodingParams = { maxPayloadBitsPerSecond };
|
|
13422
13428
|
if (mediaFamily === MediaFamily.Video) {
|
|
13423
|
-
|
|
13424
|
-
|
|
13425
|
-
|
|
13426
|
-
}
|
|
13429
|
+
encodingParams.maxFs = (_a = codecInfo === null || codecInfo === void 0 ? void 0 : codecInfo.h264) === null || _a === void 0 ? void 0 : _a.maxFs;
|
|
13430
|
+
encodingParams.maxWidth = (_b = codecInfo === null || codecInfo === void 0 ? void 0 : codecInfo.h264) === null || _b === void 0 ? void 0 : _b.maxWidth;
|
|
13431
|
+
encodingParams.maxHeight = (_c = codecInfo === null || codecInfo === void 0 ? void 0 : codecInfo.h264) === null || _c === void 0 ? void 0 : _c.maxHeight;
|
|
13427
13432
|
}
|
|
13428
13433
|
requestedIdEncodingParamsMap.set(encodingIndex, encodingParams);
|
|
13429
13434
|
}
|
|
@@ -13435,8 +13440,8 @@ class MultistreamConnection extends EventEmitter {
|
|
|
13435
13440
|
logger.warn(`${mediaType}: Unable to find matching stream ID for requested ID: ${JSON.stringify(id)}`);
|
|
13436
13441
|
}
|
|
13437
13442
|
});
|
|
13438
|
-
sendTransceiver.setTrackRequested(requestedIdEncodingParamsMap.size > 0);
|
|
13439
13443
|
sendTransceiver.updateSendParameters(requestedIdEncodingParamsMap);
|
|
13444
|
+
this.requestedIdEncodingParamsMap = requestedIdEncodingParamsMap;
|
|
13440
13445
|
}
|
|
13441
13446
|
createDataChannel() {
|
|
13442
13447
|
const dataChannel = this.pc.createDataChannel('datachannel', {});
|
|
@@ -13577,8 +13582,9 @@ class MultistreamConnection extends EventEmitter {
|
|
|
13577
13582
|
});
|
|
13578
13583
|
}
|
|
13579
13584
|
addTrackListeners(mediaType, track) {
|
|
13585
|
+
const sendTransceiver = this.getSendTransceiverOrThrow(mediaType);
|
|
13580
13586
|
const onTrackResolutionChange = () => {
|
|
13581
|
-
this.
|
|
13587
|
+
sendTransceiver.updateSendParameters(this.requestedIdEncodingParamsMap);
|
|
13582
13588
|
};
|
|
13583
13589
|
track.on(LocalTrack.Events.TrackConstraintsChange, onTrackResolutionChange);
|
|
13584
13590
|
const onTrackMute = () => {
|
|
@@ -13595,16 +13601,18 @@ class MultistreamConnection extends EventEmitter {
|
|
|
13595
13601
|
if (!track.muted) {
|
|
13596
13602
|
this.sendSourceAdvertisement(mediaType);
|
|
13597
13603
|
this.sendMediaRequestStatus(mediaType);
|
|
13604
|
+
if (mediaType === MediaType.VideoMain) {
|
|
13605
|
+
sendTransceiver.updateSendParameters(this.requestedIdEncodingParamsMap);
|
|
13606
|
+
}
|
|
13598
13607
|
}
|
|
13599
13608
|
};
|
|
13600
13609
|
track.on(LocalTrack.Events.PublishedStateUpdate, onTrackPublish);
|
|
13601
13610
|
}
|
|
13602
13611
|
getVideoStreamStates(mediaType) {
|
|
13603
|
-
var _a, _b
|
|
13612
|
+
var _a, _b;
|
|
13604
13613
|
const sendTransceiver = this.getSendTransceiverOrThrow(mediaType);
|
|
13605
|
-
const
|
|
13606
|
-
const
|
|
13607
|
-
const muted = ((_c = sendTransceiver.publishedTrack) === null || _c === void 0 ? void 0 : _c.muted) === true;
|
|
13614
|
+
const published = (_a = sendTransceiver.publishedTrack) === null || _a === void 0 ? void 0 : _a.published;
|
|
13615
|
+
const muted = ((_b = sendTransceiver.publishedTrack) === null || _b === void 0 ? void 0 : _b.muted) === true;
|
|
13608
13616
|
return sendTransceiver.senderIds.map((id) => {
|
|
13609
13617
|
let state;
|
|
13610
13618
|
if (!published) {
|
|
@@ -13613,9 +13621,6 @@ class MultistreamConnection extends EventEmitter {
|
|
|
13613
13621
|
else if (muted) {
|
|
13614
13622
|
state = 'avatar';
|
|
13615
13623
|
}
|
|
13616
|
-
else if (activeSimulcastLayerNumber < sendTransceiver.getEncodingIndexForStreamId(id)) {
|
|
13617
|
-
state = 'no source';
|
|
13618
|
-
}
|
|
13619
13624
|
else {
|
|
13620
13625
|
state = 'live';
|
|
13621
13626
|
}
|