@webex/web-client-media-engine 3.15.8 → 3.17.0
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 +76 -67
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +76 -67
- package/dist/esm/index.js.map +1 -1
- package/dist/types/index.d.ts +10 -5
- package/package.json +1 -1
package/dist/esm/index.js
CHANGED
|
@@ -10460,6 +10460,7 @@ class Transceiver {
|
|
|
10460
10460
|
class ReceiveOnlyTransceiver extends Transceiver {
|
|
10461
10461
|
constructor(rtcRtpTransceiver, mid, munger) {
|
|
10462
10462
|
super(rtcRtpTransceiver, mid);
|
|
10463
|
+
this.metadata = {};
|
|
10463
10464
|
this.munger = munger;
|
|
10464
10465
|
this._receiveSlot = new ReceiveSlot(() => {
|
|
10465
10466
|
if (!this._rtcRtpTransceiver.mid) {
|
|
@@ -10480,7 +10481,22 @@ class ReceiveOnlyTransceiver extends Transceiver {
|
|
|
10480
10481
|
return this._receiveSlot;
|
|
10481
10482
|
}
|
|
10482
10483
|
getStats() {
|
|
10483
|
-
return this
|
|
10484
|
+
return __awaiter$1(this, void 0, void 0, function* () {
|
|
10485
|
+
const statsMap = new Map();
|
|
10486
|
+
const statsReport = yield this.receiver.getStats();
|
|
10487
|
+
statsReport.forEach((stats, key) => {
|
|
10488
|
+
if (stats.type === 'inbound-rtp') {
|
|
10489
|
+
stats.mid = this.mid;
|
|
10490
|
+
stats.csi = this.receiveSlot.currentRxCsi;
|
|
10491
|
+
stats.calliopeMediaType = this.metadata.mediaType;
|
|
10492
|
+
stats.requestedBitrate = this.metadata.requestedBitrate;
|
|
10493
|
+
stats.requestedFrameSize = this.metadata.requestedFrameSize;
|
|
10494
|
+
Object.assign(stats, this.receiverId);
|
|
10495
|
+
}
|
|
10496
|
+
statsMap.set(key, stats);
|
|
10497
|
+
});
|
|
10498
|
+
return statsMap;
|
|
10499
|
+
});
|
|
10484
10500
|
}
|
|
10485
10501
|
mungeLocalDescription(mediaDescription) {
|
|
10486
10502
|
this.munger.mungeLocalDescription(mediaDescription, { twccDisabled: this.twccDisabled });
|
|
@@ -10494,6 +10510,16 @@ class ReceiveOnlyTransceiver extends Transceiver {
|
|
|
10494
10510
|
resetSdpMunger() {
|
|
10495
10511
|
this.munger.reset();
|
|
10496
10512
|
}
|
|
10513
|
+
handleRequested(streamRequest) {
|
|
10514
|
+
var _a, _b;
|
|
10515
|
+
this.metadata.requestedBitrate = streamRequest.maxPayloadBitsPerSecond;
|
|
10516
|
+
this.metadata.requestedFrameSize = (_b = (_a = streamRequest.codecInfos[0]) === null || _a === void 0 ? void 0 : _a.h264) === null || _b === void 0 ? void 0 : _b.maxFs;
|
|
10517
|
+
}
|
|
10518
|
+
handleUnrequested() {
|
|
10519
|
+
this.metadata.requestedBitrate = undefined;
|
|
10520
|
+
this.metadata.requestedFrameSize = undefined;
|
|
10521
|
+
this.receiveSlot._updateSource('no source', undefined);
|
|
10522
|
+
}
|
|
10497
10523
|
}
|
|
10498
10524
|
ReceiveOnlyTransceiver.rid = '1';
|
|
10499
10525
|
|
|
@@ -14313,7 +14339,29 @@ class SendOnlyTransceiver extends Transceiver {
|
|
|
14313
14339
|
}
|
|
14314
14340
|
}
|
|
14315
14341
|
getStats() {
|
|
14316
|
-
return this
|
|
14342
|
+
return __awaiter$1(this, void 0, void 0, function* () {
|
|
14343
|
+
const statsMap = new Map();
|
|
14344
|
+
const statsReport = yield this.sender.getStats();
|
|
14345
|
+
statsReport.forEach((stats, key) => {
|
|
14346
|
+
var _a;
|
|
14347
|
+
if (stats.type === 'outbound-rtp') {
|
|
14348
|
+
stats.mid = this.mid;
|
|
14349
|
+
stats.csi = this.csi;
|
|
14350
|
+
stats.calliopeMediaType = this.mediaType;
|
|
14351
|
+
stats.requestedBitrate = this.getRequestedBitrate(stats.ssrc);
|
|
14352
|
+
stats.requestedFrameSize = this.getRequestedFrameSize(stats.ssrc);
|
|
14353
|
+
const trackSettings = (_a = this.publishedStream) === null || _a === void 0 ? void 0 : _a.getSettings();
|
|
14354
|
+
if (trackSettings === null || trackSettings === void 0 ? void 0 : trackSettings.frameRate) {
|
|
14355
|
+
stats.targetFrameRate = trackSettings === null || trackSettings === void 0 ? void 0 : trackSettings.frameRate;
|
|
14356
|
+
}
|
|
14357
|
+
}
|
|
14358
|
+
else if (stats.type === 'media-source') {
|
|
14359
|
+
stats.calliopeMediaType = this.mediaType;
|
|
14360
|
+
}
|
|
14361
|
+
statsMap.set(key, stats);
|
|
14362
|
+
});
|
|
14363
|
+
return statsMap;
|
|
14364
|
+
});
|
|
14317
14365
|
}
|
|
14318
14366
|
updateSendParameters(requestedIdEncodingParamsMap) {
|
|
14319
14367
|
return __awaiter$1(this, void 0, void 0, function* () {
|
|
@@ -14484,14 +14532,8 @@ const organizeTransceiverStats = (sendTransceivers, recvTransceivers) => __await
|
|
|
14484
14532
|
};
|
|
14485
14533
|
yield Promise.all([...sendTransceivers.entries()].map(([mediaType, transceiver]) => __awaiter$1(void 0, void 0, void 0, function* () {
|
|
14486
14534
|
var _a;
|
|
14487
|
-
const report = [];
|
|
14488
|
-
(yield transceiver.getStats()).forEach((senderStats) => {
|
|
14489
|
-
if (senderStats.type === 'outbound-rtp') {
|
|
14490
|
-
report.push(Object.assign(Object.assign({}, senderStats), { requestedBitrate: transceiver.getRequestedBitrate(senderStats.ssrc), requestedFrameSize: transceiver.getRequestedFrameSize(senderStats.ssrc) }));
|
|
14491
|
-
}
|
|
14492
|
-
});
|
|
14493
14535
|
const item = {
|
|
14494
|
-
report,
|
|
14536
|
+
report: yield transceiver.getStats(),
|
|
14495
14537
|
mid: transceiver.mid,
|
|
14496
14538
|
csi: transceiver.csi,
|
|
14497
14539
|
currentDirection: 'sendonly',
|
|
@@ -14513,14 +14555,8 @@ const organizeTransceiverStats = (sendTransceivers, recvTransceivers) => __await
|
|
|
14513
14555
|
yield Promise.all([...recvTransceivers.entries()].map(([mediaType, transceivers]) => __awaiter$1(void 0, void 0, void 0, function* () {
|
|
14514
14556
|
return Promise.all(transceivers.map((t) => __awaiter$1(void 0, void 0, void 0, function* () {
|
|
14515
14557
|
var _b, _c;
|
|
14516
|
-
const report = [];
|
|
14517
|
-
(yield t.getStats()).forEach((receiverStats) => {
|
|
14518
|
-
if (receiverStats.type === 'inbound-rtp') {
|
|
14519
|
-
report.push(Object.assign(Object.assign({}, receiverStats), { requestedBitrate: t.requestedBitrate, requestedFrameSize: t.requestedFrameSize }));
|
|
14520
|
-
}
|
|
14521
|
-
});
|
|
14522
14558
|
const item = {
|
|
14523
|
-
report,
|
|
14559
|
+
report: yield t.getStats(),
|
|
14524
14560
|
mid: (_b = t.receiveSlot.id) === null || _b === void 0 ? void 0 : _b.mid,
|
|
14525
14561
|
csi: t.receiveSlot.currentRxCsi,
|
|
14526
14562
|
currentDirection: 'recvonly',
|
|
@@ -14563,6 +14599,7 @@ var MultistreamConnectionEventNames;
|
|
|
14563
14599
|
MultistreamConnectionEventNames["AudioSourceCountUpdate"] = "audio-source-count-update";
|
|
14564
14600
|
MultistreamConnectionEventNames["ActiveSpeakerNotification"] = "active-speaker-notification";
|
|
14565
14601
|
MultistreamConnectionEventNames["ConnectionStateUpdate"] = "connection-state-update";
|
|
14602
|
+
MultistreamConnectionEventNames["IceGatheringStateUpdate"] = "ice-gathering-state-update";
|
|
14566
14603
|
MultistreamConnectionEventNames["NegotiationNeeded"] = "negotiation-needed";
|
|
14567
14604
|
MultistreamConnectionEventNames["CreateOfferOnSuccess"] = "createofferonsuccess";
|
|
14568
14605
|
MultistreamConnectionEventNames["CreateAnswerOnSuccess"] = "createansweronsuccess";
|
|
@@ -14630,10 +14667,16 @@ class MultistreamConnection extends EventEmitter$2 {
|
|
|
14630
14667
|
this.pc.on(PeerConnection.Events.SetRemoteDescriptionOnSuccess, (description) => {
|
|
14631
14668
|
this.emit(MultistreamConnectionEventNames.SetRemoteDescriptionOnSuccess, description);
|
|
14632
14669
|
});
|
|
14670
|
+
this.pc.on(PeerConnection.Events.IceGatheringStateChange, () => {
|
|
14671
|
+
this.emit(MultistreamConnectionEventNames.IceGatheringStateUpdate, this.getIceGatheringState());
|
|
14672
|
+
});
|
|
14633
14673
|
}
|
|
14634
14674
|
getConnectionState() {
|
|
14635
14675
|
return this.pc.getConnectionState();
|
|
14636
14676
|
}
|
|
14677
|
+
getIceGatheringState() {
|
|
14678
|
+
return this.pc.iceGatheringState;
|
|
14679
|
+
}
|
|
14637
14680
|
getVideoEncodingOptions(content) {
|
|
14638
14681
|
const enabledSimulcast = content === MediaContent.Main
|
|
14639
14682
|
? !this.options.disableSimulcast
|
|
@@ -14946,6 +14989,7 @@ SCTP Max Message Size: ${maxMessageSize}`);
|
|
|
14946
14989
|
const transceiverMid = this.midPredictor.getNextMid(mediaType);
|
|
14947
14990
|
const munger = new IngressSdpMunger();
|
|
14948
14991
|
const recvOnlyTransceiver = new ReceiveOnlyTransceiver(rtcRtpTransceiver, transceiverMid, munger);
|
|
14992
|
+
recvOnlyTransceiver.metadata.mediaType = mediaType;
|
|
14949
14993
|
recvOnlyTransceiver.twccDisabled =
|
|
14950
14994
|
getMediaFamily(mediaType) === MediaFamily.Audio ? this.options.disableAudioTwcc : false;
|
|
14951
14995
|
this.recvTransceivers.set(mediaType, [
|
|
@@ -15219,35 +15263,24 @@ SCTP Max Message Size: ${maxMessageSize}`);
|
|
|
15219
15263
|
return;
|
|
15220
15264
|
}
|
|
15221
15265
|
const requestedReceiveSlotIds = [];
|
|
15222
|
-
streamRequests.forEach((
|
|
15223
|
-
|
|
15224
|
-
if (!
|
|
15266
|
+
streamRequests.forEach((request) => {
|
|
15267
|
+
request.receiveSlots.forEach((slot) => {
|
|
15268
|
+
if (!slot.id) {
|
|
15225
15269
|
logger.error(`Running stream request task, but ReceiveSlot ID is missing!`);
|
|
15226
15270
|
return;
|
|
15227
15271
|
}
|
|
15228
|
-
requestedReceiveSlotIds.push(
|
|
15272
|
+
requestedReceiveSlotIds.push(slot.id);
|
|
15229
15273
|
});
|
|
15230
15274
|
});
|
|
15275
|
+
jmpSession.sendRequests(streamRequests.map((sr) => sr._toJmpStreamRequest()));
|
|
15231
15276
|
(_a = this.recvTransceivers.get(mediaType)) === null || _a === void 0 ? void 0 : _a.forEach((transceiver) => {
|
|
15232
|
-
if (
|
|
15233
|
-
|
|
15277
|
+
if (requestedReceiveSlotIds.some((id) => compareStreamIds(id, transceiver.receiveSlot.id))) {
|
|
15278
|
+
const relevantRequest = streamRequests.find((request) => request.receiveSlots.some((slot) => compareStreamIds(slot.id, transceiver.receiveSlot.id)));
|
|
15279
|
+
transceiver.handleRequested(relevantRequest);
|
|
15280
|
+
}
|
|
15281
|
+
else {
|
|
15282
|
+
transceiver.handleUnrequested();
|
|
15234
15283
|
}
|
|
15235
|
-
});
|
|
15236
|
-
jmpSession.sendRequests(streamRequests.map((sr) => sr._toJmpStreamRequest()));
|
|
15237
|
-
streamRequests.forEach((sr) => {
|
|
15238
|
-
var _a;
|
|
15239
|
-
const isAffectedInStreamRequest = (t) => sr.receiveSlots.some((rs) => rs.id && compareStreamIds(rs.id, t.receiverId));
|
|
15240
|
-
(_a = this.recvTransceivers.get(mediaType)) === null || _a === void 0 ? void 0 : _a.forEach((t) => {
|
|
15241
|
-
var _a, _b;
|
|
15242
|
-
if (isAffectedInStreamRequest(t)) {
|
|
15243
|
-
t.requestedBitrate = sr.maxPayloadBitsPerSecond;
|
|
15244
|
-
t.requestedFrameSize = (_b = (_a = sr.codecInfos[0]) === null || _a === void 0 ? void 0 : _a.h264) === null || _b === void 0 ? void 0 : _b.maxFs;
|
|
15245
|
-
}
|
|
15246
|
-
else {
|
|
15247
|
-
t.requestedBitrate = undefined;
|
|
15248
|
-
t.requestedFrameSize = undefined;
|
|
15249
|
-
}
|
|
15250
|
-
});
|
|
15251
15284
|
});
|
|
15252
15285
|
};
|
|
15253
15286
|
if (((_a = this.dataChannel) === null || _a === void 0 ? void 0 : _a.readyState) === 'open') {
|
|
@@ -15313,42 +15346,18 @@ SCTP Max Message Size: ${maxMessageSize}`);
|
|
|
15313
15346
|
}
|
|
15314
15347
|
preProcessStats(stats) {
|
|
15315
15348
|
return __awaiter$1(this, void 0, void 0, function* () {
|
|
15316
|
-
yield Promise.all([...this.sendTransceivers.
|
|
15349
|
+
yield Promise.all([...this.sendTransceivers.values()].map((transceiver) => __awaiter$1(this, void 0, void 0, function* () {
|
|
15317
15350
|
(yield transceiver.getStats()).forEach((senderStats) => {
|
|
15318
|
-
|
|
15319
|
-
|
|
15320
|
-
const statsToModify = stats.get(senderStats.id);
|
|
15321
|
-
statsToModify.mid = transceiver.mid;
|
|
15322
|
-
statsToModify.csi = transceiver.csi;
|
|
15323
|
-
statsToModify.calliopeMediaType = mediaType;
|
|
15324
|
-
statsToModify.requestedBitrate = transceiver.getRequestedBitrate(senderStats.ssrc);
|
|
15325
|
-
statsToModify.requestedFrameSize = transceiver.getRequestedFrameSize(senderStats.ssrc);
|
|
15326
|
-
const trackSettings = (_a = transceiver.publishedStream) === null || _a === void 0 ? void 0 : _a.getSettings();
|
|
15327
|
-
if (trackSettings === null || trackSettings === void 0 ? void 0 : trackSettings.frameRate) {
|
|
15328
|
-
statsToModify.targetFrameRate = trackSettings === null || trackSettings === void 0 ? void 0 : trackSettings.frameRate;
|
|
15329
|
-
}
|
|
15330
|
-
stats.set(senderStats.id, statsToModify);
|
|
15331
|
-
}
|
|
15332
|
-
else if (senderStats.type === 'media-source') {
|
|
15333
|
-
const statsToModify = stats.get(senderStats.id);
|
|
15334
|
-
statsToModify.calliopeMediaType = mediaType;
|
|
15335
|
-
stats.set(senderStats.id, statsToModify);
|
|
15351
|
+
if (senderStats.type === 'outbound-rtp' || senderStats.type === 'media-source') {
|
|
15352
|
+
stats.set(senderStats.id, senderStats);
|
|
15336
15353
|
}
|
|
15337
15354
|
});
|
|
15338
15355
|
})));
|
|
15339
|
-
yield Promise.all([...this.recvTransceivers.
|
|
15356
|
+
yield Promise.all([...this.recvTransceivers.values()].map((transceivers) => __awaiter$1(this, void 0, void 0, function* () {
|
|
15340
15357
|
yield Promise.all(transceivers.map((transceiver) => __awaiter$1(this, void 0, void 0, function* () {
|
|
15341
15358
|
(yield transceiver.getStats()).forEach((receiverStats) => {
|
|
15342
|
-
var _a;
|
|
15343
15359
|
if (receiverStats.type === 'inbound-rtp') {
|
|
15344
|
-
|
|
15345
|
-
statsToModify.mid = (_a = transceiver.receiveSlot.id) === null || _a === void 0 ? void 0 : _a.mid;
|
|
15346
|
-
statsToModify.csi = transceiver.receiveSlot.currentRxCsi;
|
|
15347
|
-
statsToModify.calliopeMediaType = mediaType;
|
|
15348
|
-
statsToModify.requestedBitrate = transceiver.requestedBitrate;
|
|
15349
|
-
statsToModify.requestedFrameSize = transceiver.requestedFrameSize;
|
|
15350
|
-
Object.assign(statsToModify, transceiver.receiverId);
|
|
15351
|
-
stats.set(receiverStats.id, statsToModify);
|
|
15360
|
+
stats.set(receiverStats.id, receiverStats);
|
|
15352
15361
|
}
|
|
15353
15362
|
});
|
|
15354
15363
|
})));
|