@webex/web-client-media-engine 3.35.0 → 3.35.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/cjs/index.js +69 -9
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +69 -9
- package/dist/esm/index.js.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/package.json +2 -2
package/dist/esm/index.js
CHANGED
|
@@ -7154,6 +7154,29 @@ function isValidActiveSpeakerNotificationMsg(msg) {
|
|
|
7154
7154
|
const maybeActiveSpeakerNotificationMsg = msg;
|
|
7155
7155
|
return Boolean(maybeActiveSpeakerNotificationMsg.seqNum && maybeActiveSpeakerNotificationMsg.csis);
|
|
7156
7156
|
}
|
|
7157
|
+
function isValidAV1Codec(msg) {
|
|
7158
|
+
if (typeof msg !== 'object' || msg === null) {
|
|
7159
|
+
return false;
|
|
7160
|
+
}
|
|
7161
|
+
const maybeAV1Codec = msg;
|
|
7162
|
+
return (maybeAV1Codec.levelIdx >= 0 &&
|
|
7163
|
+
maybeAV1Codec.tier >= 0 &&
|
|
7164
|
+
Boolean(maybeAV1Codec.maxWidth) &&
|
|
7165
|
+
Boolean(maybeAV1Codec.maxHeight) &&
|
|
7166
|
+
Boolean(maybeAV1Codec.maxPicSize) &&
|
|
7167
|
+
Boolean(maybeAV1Codec.maxDecodeRate));
|
|
7168
|
+
}
|
|
7169
|
+
function areAV1CodecsEqual(left, right) {
|
|
7170
|
+
if (left === undefined || right === undefined) {
|
|
7171
|
+
return left === right;
|
|
7172
|
+
}
|
|
7173
|
+
return (left.levelIdx === right.levelIdx &&
|
|
7174
|
+
left.tier === right.tier &&
|
|
7175
|
+
left.maxWidth === right.maxWidth &&
|
|
7176
|
+
left.maxHeight === right.maxHeight &&
|
|
7177
|
+
left.maxPicSize === right.maxPicSize &&
|
|
7178
|
+
left.maxDecodeRate === right.maxDecodeRate);
|
|
7179
|
+
}
|
|
7157
7180
|
|
|
7158
7181
|
class H264Codec {
|
|
7159
7182
|
constructor(maxFs, maxFps, maxMbps, maxWidth, maxHeight) {
|
|
@@ -7164,6 +7187,13 @@ class H264Codec {
|
|
|
7164
7187
|
this.maxHeight = maxHeight;
|
|
7165
7188
|
}
|
|
7166
7189
|
}
|
|
7190
|
+
function isValidH264Codec(msg) {
|
|
7191
|
+
if (typeof msg !== 'object' || msg === null) {
|
|
7192
|
+
return false;
|
|
7193
|
+
}
|
|
7194
|
+
const maybeH264Codec = msg;
|
|
7195
|
+
return Boolean(maybeH264Codec.maxFs && maybeH264Codec.maxFps && maybeH264Codec.maxMbps);
|
|
7196
|
+
}
|
|
7167
7197
|
function areH264CodecsEqual(left, right) {
|
|
7168
7198
|
if (left === undefined || right === undefined) {
|
|
7169
7199
|
return left === right;
|
|
@@ -7176,13 +7206,31 @@ function areH264CodecsEqual(left, right) {
|
|
|
7176
7206
|
}
|
|
7177
7207
|
|
|
7178
7208
|
class CodecInfo$1 {
|
|
7179
|
-
constructor(payloadType,
|
|
7209
|
+
constructor(payloadType, codec) {
|
|
7180
7210
|
this.payloadType = payloadType;
|
|
7181
|
-
|
|
7211
|
+
if (isValidAV1Codec(codec))
|
|
7212
|
+
this.av1 = codec;
|
|
7213
|
+
if (isValidH264Codec(codec))
|
|
7214
|
+
this.h264 = codec;
|
|
7215
|
+
}
|
|
7216
|
+
static fromH264(payloadType, h264) {
|
|
7217
|
+
return new CodecInfo$1(payloadType, h264);
|
|
7218
|
+
}
|
|
7219
|
+
static fromAv1(payloadType, av1) {
|
|
7220
|
+
return new CodecInfo$1(payloadType, av1);
|
|
7182
7221
|
}
|
|
7183
7222
|
}
|
|
7184
7223
|
function areCodecInfosEqual(left, right) {
|
|
7185
|
-
|
|
7224
|
+
if (left.payloadType !== right.payloadType) {
|
|
7225
|
+
return false;
|
|
7226
|
+
}
|
|
7227
|
+
if (isValidH264Codec(left.h264) && isValidH264Codec(right.h264)) {
|
|
7228
|
+
return areH264CodecsEqual(left.h264, right.h264);
|
|
7229
|
+
}
|
|
7230
|
+
if (isValidAV1Codec(left.av1) && isValidAV1Codec(right.av1)) {
|
|
7231
|
+
return areAV1CodecsEqual(left.av1, right.av1);
|
|
7232
|
+
}
|
|
7233
|
+
return false;
|
|
7186
7234
|
}
|
|
7187
7235
|
|
|
7188
7236
|
var JmpMsgType;
|
|
@@ -16163,6 +16211,9 @@ SCTP Max Message Size: ${maxMessageSize}`);
|
|
|
16163
16211
|
csi: sendTransceiver.csi,
|
|
16164
16212
|
}));
|
|
16165
16213
|
}
|
|
16214
|
+
static getEncodedTransformId(mediaType, mid) {
|
|
16215
|
+
return `INBOUND-${mediaType}-${mid}`;
|
|
16216
|
+
}
|
|
16166
16217
|
createReceiveTransceiver(mediaType) {
|
|
16167
16218
|
const rtcRtpTransceiver = this.pc.addTransceiver(toMediaStreamTrackKind(mediaType), {
|
|
16168
16219
|
direction: 'recvonly',
|
|
@@ -16177,20 +16228,19 @@ SCTP Max Message Size: ${maxMessageSize}`);
|
|
|
16177
16228
|
munger,
|
|
16178
16229
|
});
|
|
16179
16230
|
if (doAudioLevelMonitoring) {
|
|
16180
|
-
const encodedTransformId = `INBOUND-${mediaType}-${mid}`;
|
|
16181
16231
|
try {
|
|
16182
|
-
this.setupEncodedTransform(rtcRtpTransceiver.receiver,
|
|
16232
|
+
this.setupEncodedTransform(rtcRtpTransceiver.receiver, MultistreamConnection.getEncodedTransformId(mediaType, recvOnlyTransceiver.mid), EncodedTransformType.AudioLevelMonitor);
|
|
16183
16233
|
recvOnlyTransceiver.setEncodedStreamMetadataCallback(() => __awaiter(this, void 0, void 0, function* () {
|
|
16184
16234
|
return getWorkerManager().sendRequestToWorker({
|
|
16185
16235
|
type: MainMsgType.GetMetadata,
|
|
16186
16236
|
mediaType,
|
|
16187
|
-
encodedTransformId,
|
|
16237
|
+
encodedTransformId: MultistreamConnection.getEncodedTransformId(mediaType, recvOnlyTransceiver.mid),
|
|
16188
16238
|
multistreamConnectionId: this.id,
|
|
16189
16239
|
});
|
|
16190
16240
|
}));
|
|
16191
16241
|
}
|
|
16192
16242
|
catch (e) {
|
|
16193
|
-
logger.warn(`Failed to setup encoded transform for
|
|
16243
|
+
logger.warn(`Failed to setup encoded transform for audio level monitoring of mid=${mid}: ${e}`);
|
|
16194
16244
|
}
|
|
16195
16245
|
}
|
|
16196
16246
|
if (getMediaFamily(mediaType) === MediaFamily.Video) {
|
|
@@ -16573,6 +16623,12 @@ SCTP Max Message Size: ${maxMessageSize}`);
|
|
|
16573
16623
|
var _a;
|
|
16574
16624
|
return __awaiter(this, void 0, void 0, function* () {
|
|
16575
16625
|
(_a = this.pc) === null || _a === void 0 ? void 0 : _a.close();
|
|
16626
|
+
if (getWorkerManager().getWorker()) {
|
|
16627
|
+
yield getWorkerManager().sendRequestToWorker({
|
|
16628
|
+
type: MainMsgType.ClearMetadata,
|
|
16629
|
+
multistreamConnectionId: this.id,
|
|
16630
|
+
});
|
|
16631
|
+
}
|
|
16576
16632
|
try {
|
|
16577
16633
|
if (userOptions) {
|
|
16578
16634
|
this.options = Object.assign(Object.assign({}, this.options), (yield userOptions));
|
|
@@ -16606,10 +16662,14 @@ SCTP Max Message Size: ${maxMessageSize}`);
|
|
|
16606
16662
|
this.recvTransceivers.forEach((transceivers, mediaType) => {
|
|
16607
16663
|
transceivers.forEach((t) => {
|
|
16608
16664
|
const mid = this.midPredictor.getNextMid(mediaType);
|
|
16609
|
-
|
|
16665
|
+
const rtcRtpTransceiver = this.pc.addTransceiver(toMediaStreamTrackKind(mediaType), {
|
|
16610
16666
|
direction: 'recvonly',
|
|
16611
|
-
})
|
|
16667
|
+
});
|
|
16668
|
+
t.replaceTransceiver(rtcRtpTransceiver);
|
|
16612
16669
|
t.mid = mid;
|
|
16670
|
+
if (this.options.enableInboundAudioLevelMonitoring && mediaType === MediaType.AudioMain) {
|
|
16671
|
+
this.setupEncodedTransform(rtcRtpTransceiver.receiver, MultistreamConnection.getEncodedTransformId(mediaType, mid), EncodedTransformType.AudioLevelMonitor);
|
|
16672
|
+
}
|
|
16613
16673
|
});
|
|
16614
16674
|
});
|
|
16615
16675
|
});
|