@webex/web-client-media-engine 2.0.2 → 2.0.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 +66 -52
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +66 -52
- package/dist/esm/index.js.map +1 -1
- package/dist/types/index.d.ts +10 -10
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -9071,22 +9071,6 @@ DefaultSdpGrammar.addParser('a', JmpLine.fromSdpLine);
|
|
|
9071
9071
|
DefaultSdpGrammar.addParser('a', JmpSourceLine.fromSdpLine);
|
|
9072
9072
|
DefaultSdpGrammar.addParser('a', JmpStreamIdModeLine.fromSdpLine);
|
|
9073
9073
|
|
|
9074
|
-
function deepCopy(source) {
|
|
9075
|
-
return Array.isArray(source)
|
|
9076
|
-
? source.map((item) => deepCopy(item))
|
|
9077
|
-
: source instanceof Map
|
|
9078
|
-
? new Map(source)
|
|
9079
|
-
: source instanceof Date
|
|
9080
|
-
? new Date(source.getTime())
|
|
9081
|
-
: source && typeof source === 'object'
|
|
9082
|
-
? Object.getOwnPropertyNames(source).reduce((o, prop) => {
|
|
9083
|
-
Object.defineProperty(o, prop, Object.getOwnPropertyDescriptor(source, prop));
|
|
9084
|
-
o[prop] = deepCopy(source[prop]);
|
|
9085
|
-
return o;
|
|
9086
|
-
}, Object.create(Object.getPrototypeOf(source)))
|
|
9087
|
-
: source;
|
|
9088
|
-
}
|
|
9089
|
-
|
|
9090
9074
|
function getMediaTypeForMline(mLine) {
|
|
9091
9075
|
var _a, _b;
|
|
9092
9076
|
let mediaFamily;
|
|
@@ -9156,42 +9140,6 @@ function filterRecvOnlyMlines(parsedSdp) {
|
|
|
9156
9140
|
g.mids = g.mids.filter((m) => filteredMids.includes(m));
|
|
9157
9141
|
});
|
|
9158
9142
|
}
|
|
9159
|
-
function matchMlinesInAnswer(parsedOffer, parsedAnswer, streamSignalerManager) {
|
|
9160
|
-
parsedAnswer.session.groups = parsedOffer.session.groups;
|
|
9161
|
-
parsedAnswer.media = parsedOffer.media.map((offerMline) => {
|
|
9162
|
-
if (!offerMline.mid) {
|
|
9163
|
-
throw new Error(`Offer mline is missing MID`);
|
|
9164
|
-
}
|
|
9165
|
-
const answerMline = parsedAnswer.media.find((m) => m.mid === offerMline.mid);
|
|
9166
|
-
if (answerMline) {
|
|
9167
|
-
if (answerMline instanceof AvMediaDescription) {
|
|
9168
|
-
[...answerMline.codecs.values()].forEach((ci) => {
|
|
9169
|
-
ci.fmtParams.set('x-google-start-bitrate', '60000');
|
|
9170
|
-
});
|
|
9171
|
-
}
|
|
9172
|
-
return answerMline;
|
|
9173
|
-
}
|
|
9174
|
-
if (!(offerMline instanceof AvMediaDescription)) {
|
|
9175
|
-
throw new Error(`Answer is missing a non-media mline: ${offerMline.mid}`);
|
|
9176
|
-
}
|
|
9177
|
-
const startingMline = parsedAnswer.avMedia.find((m) => m.type === offerMline.type);
|
|
9178
|
-
if (!startingMline) {
|
|
9179
|
-
throw new Error(`Answer has no mline of type ${offerMline.type}, can't generate synthetic answer mline for mid ${offerMline.mid}`);
|
|
9180
|
-
}
|
|
9181
|
-
const fakeCorrespondingMline = deepCopy(startingMline);
|
|
9182
|
-
fakeCorrespondingMline.mid = offerMline.mid;
|
|
9183
|
-
fakeCorrespondingMline.simulcast = undefined;
|
|
9184
|
-
if (offerMline.direction === 'sendrecv' || offerMline.direction === 'sendonly') {
|
|
9185
|
-
fakeCorrespondingMline.direction = 'recvonly';
|
|
9186
|
-
}
|
|
9187
|
-
if (offerMline.direction === 'recvonly') {
|
|
9188
|
-
fakeCorrespondingMline.direction = 'sendonly';
|
|
9189
|
-
const ingressSignaler = streamSignalerManager.getIngressStreamSignalerOrThrow(offerMline.mid);
|
|
9190
|
-
ingressSignaler.signalRemoteStreams(fakeCorrespondingMline);
|
|
9191
|
-
}
|
|
9192
|
-
return fakeCorrespondingMline;
|
|
9193
|
-
});
|
|
9194
|
-
}
|
|
9195
9143
|
function injectContentTypes(sdp, contentTypeMap) {
|
|
9196
9144
|
contentTypeMap.forEach((mediaContent, mid) => {
|
|
9197
9145
|
const mline = sdp.media.find((m) => m.mid === mid);
|
|
@@ -9225,6 +9173,14 @@ function injectJmpAttributes(parsedSdp, csiMap, streamSignalingMode) {
|
|
|
9225
9173
|
}
|
|
9226
9174
|
function hasSimulcast(av) {
|
|
9227
9175
|
return !!av.simulcast || av.ssrcGroups.map((sg) => sg.semantics).some((sem) => sem === 'SIM');
|
|
9176
|
+
}
|
|
9177
|
+
function addVlaExtension(mLine) {
|
|
9178
|
+
const vlaUri = 'http://www.webrtc.org/experiments/rtp-hdrext/video-layers-allocation00';
|
|
9179
|
+
if (mLine.extMaps.findIndex((extMapLine) => extMapLine.uri === vlaUri) === -1) {
|
|
9180
|
+
const maxIdValue = Math.max(...mLine.extMaps.map((extMapLine) => extMapLine.id), 0);
|
|
9181
|
+
const videoLayersAllocationLine = new ExtMapLine(maxIdValue + 1, vlaUri, undefined);
|
|
9182
|
+
mLine.extMaps.push(videoLayersAllocationLine);
|
|
9183
|
+
}
|
|
9228
9184
|
}
|
|
9229
9185
|
|
|
9230
9186
|
class SendOnlyTransceiver extends Transceiver {
|
|
@@ -9386,6 +9342,7 @@ class RidEgressStreamSignaler {
|
|
|
9386
9342
|
if (simulcastEnabled) {
|
|
9387
9343
|
mLine.rids = this.streamIds.map((streamId, index) => new RidLine(streamId.rid, 'send', `max-fs=${simulcastMaxFrameSizes[index]}`));
|
|
9388
9344
|
mLine.simulcast = new SimulcastLine(SimulcastLayerList.fromString('low;medium;high'), new SimulcastLayerList());
|
|
9345
|
+
addVlaExtension(mLine);
|
|
9389
9346
|
}
|
|
9390
9347
|
}
|
|
9391
9348
|
getSenderIds() {
|
|
@@ -9492,6 +9449,7 @@ class SsrcEgressStreamSignaler {
|
|
|
9492
9449
|
});
|
|
9493
9450
|
if (simulcastEnabled) {
|
|
9494
9451
|
mLine.addLine(new SsrcGroupLine('SIM', this.streamIds.map((streamId) => streamId.ssrc)));
|
|
9452
|
+
addVlaExtension(mLine);
|
|
9495
9453
|
}
|
|
9496
9454
|
}
|
|
9497
9455
|
getSenderIds() {
|
|
@@ -13147,6 +13105,59 @@ function setLogHandler(logHandler) {
|
|
|
13147
13105
|
Logger$2.setHandler(logHandler);
|
|
13148
13106
|
}
|
|
13149
13107
|
|
|
13108
|
+
function deepCopy(source) {
|
|
13109
|
+
return Array.isArray(source)
|
|
13110
|
+
? source.map((item) => deepCopy(item))
|
|
13111
|
+
: source instanceof Map
|
|
13112
|
+
? new Map(source)
|
|
13113
|
+
: source instanceof Date
|
|
13114
|
+
? new Date(source.getTime())
|
|
13115
|
+
: source && typeof source === 'object'
|
|
13116
|
+
? Object.getOwnPropertyNames(source).reduce((o, prop) => {
|
|
13117
|
+
Object.defineProperty(o, prop, Object.getOwnPropertyDescriptor(source, prop));
|
|
13118
|
+
o[prop] = deepCopy(source[prop]);
|
|
13119
|
+
return o;
|
|
13120
|
+
}, Object.create(Object.getPrototypeOf(source)))
|
|
13121
|
+
: source;
|
|
13122
|
+
}
|
|
13123
|
+
|
|
13124
|
+
function matchMlinesInAnswer(parsedOffer, parsedAnswer, streamSignalerManager) {
|
|
13125
|
+
parsedAnswer.session.groups = parsedOffer.session.groups;
|
|
13126
|
+
parsedAnswer.media = parsedOffer.media.map((offerMline) => {
|
|
13127
|
+
if (!offerMline.mid) {
|
|
13128
|
+
throw new Error(`Offer mline is missing MID`);
|
|
13129
|
+
}
|
|
13130
|
+
const answerMline = parsedAnswer.media.find((m) => m.mid === offerMline.mid);
|
|
13131
|
+
if (answerMline) {
|
|
13132
|
+
if (answerMline instanceof AvMediaDescription) {
|
|
13133
|
+
[...answerMline.codecs.values()].forEach((ci) => {
|
|
13134
|
+
ci.fmtParams.set('x-google-start-bitrate', '60000');
|
|
13135
|
+
});
|
|
13136
|
+
}
|
|
13137
|
+
return answerMline;
|
|
13138
|
+
}
|
|
13139
|
+
if (!(offerMline instanceof AvMediaDescription)) {
|
|
13140
|
+
throw new Error(`Answer is missing a non-media mline: ${offerMline.mid}`);
|
|
13141
|
+
}
|
|
13142
|
+
const startingMline = parsedAnswer.avMedia.find((m) => m.type === offerMline.type);
|
|
13143
|
+
if (!startingMline) {
|
|
13144
|
+
throw new Error(`Answer has no mline of type ${offerMline.type}, can't generate synthetic answer mline for mid ${offerMline.mid}`);
|
|
13145
|
+
}
|
|
13146
|
+
const fakeCorrespondingMline = deepCopy(startingMline);
|
|
13147
|
+
fakeCorrespondingMline.mid = offerMline.mid;
|
|
13148
|
+
fakeCorrespondingMline.simulcast = undefined;
|
|
13149
|
+
if (offerMline.direction === 'sendrecv' || offerMline.direction === 'sendonly') {
|
|
13150
|
+
fakeCorrespondingMline.direction = 'recvonly';
|
|
13151
|
+
}
|
|
13152
|
+
if (offerMline.direction === 'recvonly') {
|
|
13153
|
+
fakeCorrespondingMline.direction = 'sendonly';
|
|
13154
|
+
const ingressSignaler = streamSignalerManager.getIngressStreamSignalerOrThrow(offerMline.mid);
|
|
13155
|
+
ingressSignaler.signalRemoteStreams(fakeCorrespondingMline);
|
|
13156
|
+
}
|
|
13157
|
+
return fakeCorrespondingMline;
|
|
13158
|
+
});
|
|
13159
|
+
}
|
|
13160
|
+
|
|
13150
13161
|
function toMediaStreamTrackKind(mediaType) {
|
|
13151
13162
|
return [MediaType.VideoMain, MediaType.VideoSlides].includes(mediaType)
|
|
13152
13163
|
? exports.MediaStreamTrackKind.Video
|
|
@@ -13753,6 +13764,9 @@ class MultistreamConnection extends EventEmitter {
|
|
|
13753
13764
|
});
|
|
13754
13765
|
}
|
|
13755
13766
|
});
|
|
13767
|
+
if (getBrowserDetails().name === 'Firefox') {
|
|
13768
|
+
setupBundle(parsed, this.options.bundlePolicy, this.midMap);
|
|
13769
|
+
}
|
|
13756
13770
|
return parsed.toString();
|
|
13757
13771
|
}
|
|
13758
13772
|
preProcessRemoteAnswer(answer) {
|