@webex/web-client-media-engine 1.34.5 → 1.35.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 +51 -32
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +51 -32
- package/dist/esm/index.js.map +1 -1
- package/dist/types/index.d.ts +2 -1
- package/package.json +4 -4
package/dist/cjs/index.js
CHANGED
|
@@ -4755,10 +4755,11 @@ adapterFactory({window: typeof window === 'undefined' ? undefined : window});
|
|
|
4755
4755
|
/**
|
|
4756
4756
|
* Creates an RTCPeerConnection.
|
|
4757
4757
|
*
|
|
4758
|
+
* @param configuration - Config to the RTCPeerConnection constructor.
|
|
4758
4759
|
* @returns An RTCPeerConnection instance.
|
|
4759
4760
|
*/
|
|
4760
|
-
function createRTCPeerConnection() {
|
|
4761
|
-
return new RTCPeerConnection();
|
|
4761
|
+
function createRTCPeerConnection(configuration) {
|
|
4762
|
+
return new RTCPeerConnection(configuration);
|
|
4762
4763
|
}
|
|
4763
4764
|
|
|
4764
4765
|
/**
|
|
@@ -4780,11 +4781,13 @@ var PeerConnectionEvents;
|
|
|
4780
4781
|
class PeerConnection extends EventEmitter$2 {
|
|
4781
4782
|
/**
|
|
4782
4783
|
* Creates an instance of the RTCPeerConnection.
|
|
4784
|
+
*
|
|
4785
|
+
* @param configuration - Config to the RTCPeerConnection constructor.
|
|
4783
4786
|
*/
|
|
4784
|
-
constructor() {
|
|
4787
|
+
constructor(configuration) {
|
|
4785
4788
|
super();
|
|
4786
4789
|
logger$3.log('PeerConnection init');
|
|
4787
|
-
this.pc = createRTCPeerConnection();
|
|
4790
|
+
this.pc = createRTCPeerConnection(configuration);
|
|
4788
4791
|
this.connectionStateHandler = new ConnectionStateHandler(() => {
|
|
4789
4792
|
return {
|
|
4790
4793
|
connectionState: this.pc.connectionState,
|
|
@@ -5777,7 +5780,7 @@ class JmpSession extends events$2.EventEmitter {
|
|
|
5777
5780
|
}
|
|
5778
5781
|
|
|
5779
5782
|
class MediaRequest {
|
|
5780
|
-
constructor(policy, policySpecificInfo, receiveSlots, maxPayloadBitsPerSecond, codecInfos) {
|
|
5783
|
+
constructor(policy, policySpecificInfo, receiveSlots, maxPayloadBitsPerSecond, codecInfos = []) {
|
|
5781
5784
|
this.policy = policy;
|
|
5782
5785
|
this.policySpecificInfo = policySpecificInfo;
|
|
5783
5786
|
this.receiveSlots = receiveSlots;
|
|
@@ -6859,6 +6862,22 @@ class FingerprintLine extends Line {
|
|
|
6859
6862
|
}
|
|
6860
6863
|
FingerprintLine.regex = new RegExp(`^fingerprint:(${REST})`);
|
|
6861
6864
|
|
|
6865
|
+
function parseFmtpParams(fmtpParams) {
|
|
6866
|
+
fmtpParams = fmtpParams.replace(/^a=fmtp:\d+\x20/, '');
|
|
6867
|
+
const fmtpObj = new Map();
|
|
6868
|
+
if (/^\d+([/-]\d+)+$/.test(fmtpParams)) {
|
|
6869
|
+
fmtpObj.set(fmtpParams, undefined);
|
|
6870
|
+
return fmtpObj;
|
|
6871
|
+
}
|
|
6872
|
+
fmtpParams.split(';').forEach((param) => {
|
|
6873
|
+
const paramArr = param && param.split('=');
|
|
6874
|
+
if (paramArr.length !== 2 || !paramArr[0] || !paramArr[1]) {
|
|
6875
|
+
throw new Error(`Fmtp params is invalid with ${fmtpParams}`);
|
|
6876
|
+
}
|
|
6877
|
+
fmtpObj.set(paramArr[0], paramArr[1]);
|
|
6878
|
+
});
|
|
6879
|
+
return fmtpObj;
|
|
6880
|
+
}
|
|
6862
6881
|
class FmtpLine extends Line {
|
|
6863
6882
|
constructor(payloadType, params) {
|
|
6864
6883
|
super();
|
|
@@ -6872,10 +6891,18 @@ class FmtpLine extends Line {
|
|
|
6872
6891
|
const tokens = line.match(FmtpLine.regex);
|
|
6873
6892
|
const payloadType = parseInt(tokens[1], 10);
|
|
6874
6893
|
const params = tokens[2];
|
|
6875
|
-
return new FmtpLine(payloadType, params);
|
|
6894
|
+
return new FmtpLine(payloadType, parseFmtpParams(params));
|
|
6876
6895
|
}
|
|
6877
6896
|
toSdpLine() {
|
|
6878
|
-
|
|
6897
|
+
const fmtParams = Array.from(this.params.keys())
|
|
6898
|
+
.map((key) => {
|
|
6899
|
+
if (this.params.get(key) !== undefined) {
|
|
6900
|
+
return `${key}=${this.params.get(key)}`;
|
|
6901
|
+
}
|
|
6902
|
+
return `${key}`;
|
|
6903
|
+
})
|
|
6904
|
+
.join(';');
|
|
6905
|
+
return `a=fmtp:${this.payloadType} ${fmtParams}`;
|
|
6879
6906
|
}
|
|
6880
6907
|
}
|
|
6881
6908
|
FmtpLine.regex = new RegExp(`^fmtp:(${NUM}) (${REST})`);
|
|
@@ -7562,7 +7589,7 @@ class ApplicationMediaDescription extends MediaDescription {
|
|
|
7562
7589
|
|
|
7563
7590
|
class CodecInfo {
|
|
7564
7591
|
constructor(pt) {
|
|
7565
|
-
this.fmtParams =
|
|
7592
|
+
this.fmtParams = new Map();
|
|
7566
7593
|
this.feedback = [];
|
|
7567
7594
|
this.pt = pt;
|
|
7568
7595
|
}
|
|
@@ -7574,9 +7601,12 @@ class CodecInfo {
|
|
|
7574
7601
|
return true;
|
|
7575
7602
|
}
|
|
7576
7603
|
if (line instanceof FmtpLine) {
|
|
7577
|
-
this.fmtParams
|
|
7578
|
-
|
|
7579
|
-
|
|
7604
|
+
this.fmtParams = new Map([
|
|
7605
|
+
...Array.from(this.fmtParams.entries()),
|
|
7606
|
+
...Array.from(line.params.entries()),
|
|
7607
|
+
]);
|
|
7608
|
+
if (line.params.has('apt')) {
|
|
7609
|
+
const apt = line.params.get('apt');
|
|
7580
7610
|
this.primaryCodecPt = parseInt(apt, 10);
|
|
7581
7611
|
}
|
|
7582
7612
|
return true;
|
|
@@ -7593,9 +7623,9 @@ class CodecInfo {
|
|
|
7593
7623
|
this.feedback.forEach((fb) => {
|
|
7594
7624
|
lines.push(new RtcpFbLine(this.pt, fb));
|
|
7595
7625
|
});
|
|
7596
|
-
this.fmtParams.
|
|
7597
|
-
lines.push(new FmtpLine(this.pt,
|
|
7598
|
-
}
|
|
7626
|
+
if (this.fmtParams.size > 0) {
|
|
7627
|
+
lines.push(new FmtpLine(this.pt, this.fmtParams));
|
|
7628
|
+
}
|
|
7599
7629
|
return lines;
|
|
7600
7630
|
}
|
|
7601
7631
|
}
|
|
@@ -7941,18 +7971,6 @@ const maxFrameSizeToMaxBitrateMap = new Map([
|
|
|
7941
7971
|
[3600, 2500000],
|
|
7942
7972
|
[8160, 4000000],
|
|
7943
7973
|
]);
|
|
7944
|
-
function parseFmtpParams(fmtpParams) {
|
|
7945
|
-
fmtpParams = fmtpParams.replace(/^a=fmtp:\d+\x20/, '');
|
|
7946
|
-
const fmtpObj = {};
|
|
7947
|
-
fmtpParams.split(';').forEach((param) => {
|
|
7948
|
-
const paramArr = param && param.split('=');
|
|
7949
|
-
if (paramArr.length !== 2 || !paramArr[0] || !paramArr[1]) {
|
|
7950
|
-
throw new Error(`Fmtp params is invalid with ${fmtpParams}`);
|
|
7951
|
-
}
|
|
7952
|
-
fmtpObj[paramArr[0]] = paramArr[1];
|
|
7953
|
-
});
|
|
7954
|
-
return fmtpObj;
|
|
7955
|
-
}
|
|
7956
7974
|
function areProfileLevelIdsCompatible(senderProfileLevelId, receiverProfileLevelId, levelAsymmetryAllowed) {
|
|
7957
7975
|
const senderProfile = Number.parseInt(`0x${senderProfileLevelId}`, 16);
|
|
7958
7976
|
const recvProfile = Number.parseInt(`0x${receiverProfileLevelId}`, 16);
|
|
@@ -7980,8 +7998,8 @@ function areCodecsCompatible(senderCodec, receiverCodec) {
|
|
|
7980
7998
|
return true;
|
|
7981
7999
|
}
|
|
7982
8000
|
if (key === 'sdpFmtpLine') {
|
|
7983
|
-
const fmtpForSender = parseFmtpParams(senderCodec[key]);
|
|
7984
|
-
const fmtpForReceiver = parseFmtpParams(receiverCodec[key]);
|
|
8001
|
+
const fmtpForSender = Object.fromEntries(parseFmtpParams(senderCodec[key]));
|
|
8002
|
+
const fmtpForReceiver = Object.fromEntries(parseFmtpParams(receiverCodec[key]));
|
|
7985
8003
|
const levelAsymmetryAllowed = Object.keys(fmtpForSender).some((senderFmtpParamKey) => {
|
|
7986
8004
|
return (senderFmtpParamKey === 'level-asymmetry-allowed' &&
|
|
7987
8005
|
fmtpForReceiver[senderFmtpParamKey] === '1' &&
|
|
@@ -8795,7 +8813,7 @@ function matchMlinesInAnswer(parsedOffer, parsedAnswer, streamSignalerManager) {
|
|
|
8795
8813
|
if (answerMline) {
|
|
8796
8814
|
if (answerMline instanceof AvMediaDescription) {
|
|
8797
8815
|
[...answerMline.codecs.values()].forEach((ci) => {
|
|
8798
|
-
ci.fmtParams.
|
|
8816
|
+
ci.fmtParams.set('x-google-start-bitrate', '60000');
|
|
8799
8817
|
});
|
|
8800
8818
|
}
|
|
8801
8819
|
return answerMline;
|
|
@@ -9505,6 +9523,7 @@ const defaultMultistreamConnectionOptions = {
|
|
|
9505
9523
|
disableSimulcast: false,
|
|
9506
9524
|
streamSignalingMode: 'SSRC',
|
|
9507
9525
|
bundlePolicy: 'compat',
|
|
9526
|
+
iceServers: undefined,
|
|
9508
9527
|
};
|
|
9509
9528
|
class MultistreamConnection extends EventEmitter {
|
|
9510
9529
|
constructor(userOptions = {}) {
|
|
@@ -9536,7 +9555,7 @@ class MultistreamConnection extends EventEmitter {
|
|
|
9536
9555
|
initializePeerConnection() {
|
|
9537
9556
|
var _a;
|
|
9538
9557
|
(_a = this.pc) === null || _a === void 0 ? void 0 : _a.close();
|
|
9539
|
-
this.pc = new PeerConnection();
|
|
9558
|
+
this.pc = new PeerConnection({ iceServers: this.options.iceServers });
|
|
9540
9559
|
this.pc.on(PeerConnection.Events.ConnectionStateChange, (state) => this.emit(exports.MultistreamConnectionEventNames.ConnectionStateUpdate, state));
|
|
9541
9560
|
this.attachMetricsObserver();
|
|
9542
9561
|
this.createDataChannel();
|
|
@@ -9929,8 +9948,8 @@ class MultistreamConnection extends EventEmitter {
|
|
|
9929
9948
|
[...av.codecs.values()]
|
|
9930
9949
|
.filter((ci) => ci.name === 'H264')
|
|
9931
9950
|
.forEach((ci) => {
|
|
9932
|
-
ci.fmtParams.
|
|
9933
|
-
ci.fmtParams.
|
|
9951
|
+
ci.fmtParams.set('max-mbps', `${defaultMaxVideoEncodeMbps}`);
|
|
9952
|
+
ci.fmtParams.set('max-fs', `${defaultMaxVideoEncodeFrameSize}`);
|
|
9934
9953
|
});
|
|
9935
9954
|
}
|
|
9936
9955
|
});
|