@webex/plugin-meetings 2.31.4 → 2.33.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/constants.js +60 -36
- package/dist/constants.js.map +1 -1
- package/dist/media/properties.js +1 -1
- package/dist/media/properties.js.map +1 -1
- package/dist/meeting/index.js +72 -30
- package/dist/meeting/index.js.map +1 -1
- package/dist/peer-connection-manager/index.js +9 -11
- package/dist/peer-connection-manager/index.js.map +1 -1
- package/dist/peer-connection-manager/util.js +99 -3
- package/dist/peer-connection-manager/util.js.map +1 -1
- package/dist/reachability/index.js +30 -0
- package/dist/reachability/index.js.map +1 -1
- package/dist/roap/turnDiscovery.js +8 -0
- package/dist/roap/turnDiscovery.js.map +1 -1
- package/package.json +18 -17
- package/src/constants.ts +45 -19
- package/src/media/properties.js +1 -1
- package/src/meeting/index.js +28 -5
- package/src/peer-connection-manager/index.js +11 -12
- package/src/peer-connection-manager/util.ts +117 -0
- package/src/reachability/index.js +24 -0
- package/src/roap/turnDiscovery.ts +7 -0
- package/test/unit/spec/meeting/index.js +56 -50
- package/test/unit/spec/peerconnection-manager/utils.js +30 -7
- package/test/unit/spec/peerconnection-manager/utils.test-fixtures.ts +389 -0
- package/test/unit/spec/reachability/index.ts +52 -0
- package/test/unit/spec/roap/turnDiscovery.ts +14 -0
- package/src/peer-connection-manager/util.js +0 -19
|
@@ -97,19 +97,17 @@ var insertBandwidthLimit = function insertBandwidthLimit(sdpLines, index) {
|
|
|
97
97
|
*/
|
|
98
98
|
|
|
99
99
|
|
|
100
|
-
var
|
|
100
|
+
var setRemoteVideoConstraints = function setRemoteVideoConstraints(sdp) {
|
|
101
101
|
var level = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _constants.QUALITY_LEVELS.HIGH;
|
|
102
|
+
var maxFs = _constants.REMOTE_VIDEO_CONSTRAINTS.MAX_FS[level];
|
|
102
103
|
|
|
103
|
-
if (!
|
|
104
|
-
throw new _parameter.default("
|
|
105
|
-
}
|
|
106
|
-
// TODO convert with sdp parser, no munging
|
|
104
|
+
if (!maxFs) {
|
|
105
|
+
throw new _parameter.default("setRemoteVideoConstraints: unable to set max framesize, value for level \"".concat(level, "\" is not defined"));
|
|
106
|
+
}
|
|
107
107
|
|
|
108
|
+
var modifiedSdp = _util.default.adjustH264Profile(sdp, maxFs);
|
|
108
109
|
|
|
109
|
-
|
|
110
|
-
var maxFsLine = "".concat(_constants.SDP.MAX_FS).concat(_constants.MAX_FRAMESIZES[level]);
|
|
111
|
-
replaceSdp = replaceSdp.replace(/(\na=fmtp:(\d+).*profile-level-id=.*)/gi, "$1;".concat(maxFsLine));
|
|
112
|
-
return replaceSdp;
|
|
110
|
+
return modifiedSdp;
|
|
113
111
|
};
|
|
114
112
|
|
|
115
113
|
var setStartBitrateOnRemoteSdp = function setStartBitrateOnRemoteSdp(sdp) {
|
|
@@ -235,8 +233,8 @@ pc.iceCandidate = function (peerConnection, _ref) {
|
|
|
235
233
|
var doneGatheringIceCandidate = function doneGatheringIceCandidate() {
|
|
236
234
|
var miliseconds = (0, _parseInt2.default)(Math.abs((0, _now.default)() - now), 4);
|
|
237
235
|
peerConnection.sdp = limitBandwidth(peerConnection.localDescription.sdp);
|
|
238
|
-
peerConnection.sdp = setMaxFs(peerConnection.sdp, remoteQualityLevel);
|
|
239
236
|
peerConnection.sdp = _util.default.convertCLineToIpv4(peerConnection.sdp);
|
|
237
|
+
peerConnection.sdp = setRemoteVideoConstraints(peerConnection.sdp, remoteQualityLevel);
|
|
240
238
|
var invalidSdpPresent = isSdpInvalid(peerConnection.sdp);
|
|
241
239
|
|
|
242
240
|
if (invalidSdpPresent) {
|
|
@@ -585,8 +583,8 @@ pc.createAnswer = function (params, _ref4) {
|
|
|
585
583
|
});
|
|
586
584
|
}).then(function () {
|
|
587
585
|
peerConnection.sdp = limitBandwidth(peerConnection.localDescription.sdp);
|
|
588
|
-
peerConnection.sdp = setMaxFs(peerConnection.sdp, remoteQualityLevel);
|
|
589
586
|
peerConnection.sdp = _util.default.convertCLineToIpv4(peerConnection.sdp);
|
|
587
|
+
peerConnection.sdp = setRemoteVideoConstraints(peerConnection.sdp, remoteQualityLevel);
|
|
590
588
|
|
|
591
589
|
if (!checkH264Support(peerConnection.sdp)) {
|
|
592
590
|
throw new _media.default('openH264 is downloading please Wait. Upload logs if not working on second try');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["BrowserDetection","isBrowser","pc","insertBandwidthLimit","sdpLines","index","limit","periodicKeyFrame","search","AUDIO","StaticConfig","meetings","bandwidth","audio","video","SDP","PERIODIC_KEYFRAME","splice","B_LINE","setMaxFs","sdp","level","QUALITY_LEVELS","HIGH","MAX_FRAMESIZES","ParameterError","replaceSdp","maxFsLine","MAX_FS","replace","setStartBitrateOnRemoteSdp","startBitrate","checkH264Support","videoPresent","match","h264Present","isSdpInvalid","parsedSdp","sdpTransform","parse","media","mediaLine","candidates","length","LoggerProxy","logger","error","BAD_MEDIA_PORTS","includes","port","icePwd","iceUfrag","limitBandwidth","offerSdp","split","CARRIAGE_RETURN","i","M_LINE","join","setContentSlides","screenPc","A_CONTENT_SLIDES","iceCandidate","peerConnection","remoteQualityLevel","resolve","reject","now","doneGatheringIceCandidate","miliseconds","Math","abs","localDescription","PeerConnectionUtils","convertCLineToIpv4","invalidSdpPresent","InvalidSdpError","log","iceGatheringState","COMPLETE","onIceGatheringStateChange","GATHERING","onicecandidate","evt","candidate","type","protocol","address","onicecandidateerror","event","replaceTrack","track","senders","getSenders","forEach","sender","kind","err","addStream","stream","tracksPresent","find","getTracks","addTrack","setRemoteSessionDetails","typeStr","remoteSdp","meetingId","signalingState","Metrics","postEvent","eventType","REMOTE_SDP_RECEIVED","data","canProceed","errors","generateErrorPayload","name","MEDIA_ENGINE","HAVE_LOCAL_OFFER","STABLE","OFFER","enableExtmap","setRemoteDescription","window","RTCSessionDescription","then","catch","metricName","BEHAVIORAL_METRICS","PEERCONNECTION_FAILURE","correlation_id","reason","message","stack","metadata","sendBehavioralMetric","MediaError","createOffer","enableRtx","description","setLocalDescription","LOCAL_SDP_GENERATED","INVALID_ICE_CANDIDATE","code","close","rollBackLocalDescription","ROLLBACK","updatePeerConnection","params","createAnswer","peerconnection","HAVE_REMOTE_OFFER","sdpConstraints","answer","connectionState","PEER_CONNECTION_STATE","CLOSED","setPeerConnectionEvents","meeting","mediaProperties","connectionFailed","reconnectionManager","iceState","reconnect","networkDisconnect","ICE_END","uploadLogs","file","function","CONNECTION_FAILURE","correlationId","locus_id","locusId","oniceconnectionstatechange","info","iceConnectionState","ICE_STATE","CHECKING","ICE_START","COMPLETED","CONNECTED","CONNECTION_SUCCESS","setNetworkStatus","NETWORK_STATUS","iceReconnected","DISCONNECTED","waitForIceReconnect","FAILED","onconnectionstatechange","CONNECTION_STATE","NEW","CONNECTING"],"sources":["index.js"],"sourcesContent":["\n// We need to figure out how to pass a webex logger instance to these util files\n\n/* globals RTCSessionDescription */\n\nimport window from 'global/window';\nimport sdpTransform from 'sdp-transform'; // https://github.com/clux/sdp-transform\n\nimport Metrics from '../metrics';\nimport LoggerProxy from '../common/logs/logger-proxy';\nimport StaticConfig from '../common/config';\nimport {\n COMPLETE,\n GATHERING,\n AUDIO,\n SDP,\n ICE_STATE,\n CONNECTION_STATE,\n NETWORK_STATUS,\n PEER_CONNECTION_STATE,\n OFFER,\n QUALITY_LEVELS,\n MAX_FRAMESIZES\n} from '../constants';\nimport BEHAVIORAL_METRICS from '../metrics/constants';\nimport {error, eventType} from '../metrics/config';\nimport MediaError from '../common/errors/media';\nimport ParameterError from '../common/errors/parameter';\nimport {InvalidSdpError} from '../common/errors/webex-errors';\nimport BrowserDetection from '../common/browser-detection';\n\nimport PeerConnectionUtils from './util';\n\nconst {isBrowser} = BrowserDetection();\n\n/**\n * @export\n * @public\n */\nconst pc = {};\n\n/**\n * munges the bandwidth limit into the sdp\n * @param {String} sdpLines\n * @param {Number} index\n * @returns {String}\n */\nconst insertBandwidthLimit = (sdpLines, index) => {\n // eslint-disable-next-line no-warning-comments\n // TODO convert to sdp parser\n let limit;\n let periodicKeyFrame = '';\n\n if (sdpLines[index].search(AUDIO) !== -1) {\n limit = StaticConfig.meetings.bandwidth.audio;\n }\n else {\n limit = StaticConfig.meetings.bandwidth.video;\n periodicKeyFrame = SDP.PERIODIC_KEYFRAME;\n sdpLines.splice(index + 2, 0, periodicKeyFrame);\n }\n sdpLines.splice(index + 1, 0, `${SDP.B_LINE}:${limit}`);\n\n return sdpLines;\n};\n\n/**\n * needed for calliope max-fs\n * @param {String} sdp\n * @param {String} [level=QUALITY_LEVELS.HIGH] quality level for max-fs\n * @returns {String}\n */\nconst setMaxFs = (sdp, level = QUALITY_LEVELS.HIGH) => {\n if (!MAX_FRAMESIZES[level]) {\n throw new ParameterError(`setMaxFs: unable to set max framesize, value for level \"${level}\" is not defined`);\n }\n // eslint-disable-next-line no-warning-comments\n // TODO convert with sdp parser, no munging\n let replaceSdp = sdp;\n const maxFsLine = `${SDP.MAX_FS}${MAX_FRAMESIZES[level]}`;\n\n replaceSdp = replaceSdp.replace(/(\\na=fmtp:(\\d+).*profile-level-id=.*)/gi, `$1;${maxFsLine}`);\n\n return replaceSdp;\n};\n\n\nconst setStartBitrateOnRemoteSdp = (sdp) => {\n if (StaticConfig.meetings.bandwidth.startBitrate) {\n sdp = sdp.replace(/(\\na=fmtp:(\\d+).*profile-level-id=.*)/gi, `$1;x-google-start-bitrate=${StaticConfig.meetings.bandwidth.startBitrate}`);\n }\n\n return sdp;\n};\n\n/**\n * checks that sdp has h264 codec in it\n * @param {String} sdp\n * @returns {boolean}\n */\nconst checkH264Support = (sdp) => {\n // eslint-disable-next-line no-warning-comments\n // TODO convert to sdp parser to read rtp.codec\n const videoPresent = sdp.match(/\\nm=video.*/g);\n const h264Present = sdp.match(/\\na=rtpmap:\\d+\\sH264.*/g);\n\n if (videoPresent) {\n return !!h264Present;\n }\n\n return true;\n};\n\n/**\n * validates the sdp, checks port, candidates, and ice info\n * @param {String} sdp\n * @returns {String}\n */\nconst isSdpInvalid = (sdp) => {\n const parsedSdp = sdpTransform.parse(sdp);\n\n for (const mediaLine of parsedSdp.media) {\n if (!mediaLine.candidates || mediaLine.candidates?.length === 0) {\n LoggerProxy.logger.error('PeerConnectionManager:index#isSdpInvalid --> iceCandidate: Ice candidate never completed');\n\n return 'iceCandidate: Ice gathering never completed';\n }\n\n if (SDP.BAD_MEDIA_PORTS.includes(mediaLine.port)) {\n LoggerProxy.logger.error('PeerConnectionManager:index#isSdpInvalid --> iceCandidate: Found invalid port number for the ice candidate');\n\n return 'iceCandidate: Found invalid port number for the ice candidate';\n }\n if (!mediaLine.icePwd || !mediaLine.iceUfrag) {\n LoggerProxy.logger.error('PeerConnectionManager:index#isSdpInvalid --> iceCandidate: ice ufrag and password not found');\n\n return 'iceCandidate: ice ufrag and password not found';\n }\n }\n\n return '';\n};\n\n/**\n * munges the bandwidth into the sdp\n * @param {String} sdp\n * @returns {String}\n */\nconst limitBandwidth = (sdp) => {\n // TODO convert to sdp parser\n let offerSdp = sdp;\n let sdpLines = offerSdp.split(SDP.CARRIAGE_RETURN);\n\n for (let i = 0; i < sdpLines.length; i += 1) {\n if (sdpLines[i].search(SDP.M_LINE) !== -1) {\n sdpLines = insertBandwidthLimit(sdpLines, i);\n }\n }\n offerSdp = sdpLines.join(SDP.CARRIAGE_RETURN);\n\n return offerSdp;\n};\n\n/**\n * makes sure the screen pc sdp has content:slides for server\n * @param {RTCPeerConnection} screenPc\n * @returns {RTCPeerConnection}\n */\npc.setContentSlides = (screenPc) => {\n if (screenPc && screenPc.sdp) {\n screenPc.sdp += `${SDP.A_CONTENT_SLIDES}${SDP.CARRIAGE_RETURN}`;\n }\n\n return screenPc;\n};\n\n/**\n * handles ice trickling and establishes ICE connection onto peer connection object\n * @param {Object} peerConnection\n * @param {Object} options\n * @param {String} options.remoteQualityLevel\n * @returns {Promise.RTCPeerConnection}\n */\npc.iceCandidate = (peerConnection, {remoteQualityLevel}) =>\n new Promise((resolve, reject) => {\n const now = Date.now();\n const doneGatheringIceCandidate = () => {\n const miliseconds = parseInt(Math.abs(Date.now() - now), 4);\n\n peerConnection.sdp = limitBandwidth(peerConnection.localDescription.sdp);\n peerConnection.sdp = setMaxFs(peerConnection.sdp, remoteQualityLevel);\n peerConnection.sdp = PeerConnectionUtils.convertCLineToIpv4(peerConnection.sdp);\n\n const invalidSdpPresent = isSdpInvalid(peerConnection.sdp);\n\n if (invalidSdpPresent) {\n LoggerProxy.logger.error('PeerConnectionManager:index#iceCandidate --> SDP not valid after waiting.');\n reject(new InvalidSdpError(invalidSdpPresent));\n }\n LoggerProxy.logger.log(`PeerConnectionManager:index#iceCandidate --> Time to gather ice candidate ${miliseconds} miliseconds`);\n\n\n resolve();\n };\n\n // If ice has already been gathered\n if (peerConnection.iceGatheringState === COMPLETE) {\n doneGatheringIceCandidate();\n }\n\n peerConnection.onIceGatheringStateChange = () => {\n if (peerConnection.iceGatheringState === COMPLETE) {\n doneGatheringIceCandidate(peerConnection);\n }\n if (peerConnection.iceGatheringState === GATHERING) {\n LoggerProxy.logger.log('PeerConnectionManager:index#onIceGatheringStateChange --> Ice state changed to gathering');\n }\n };\n\n peerConnection.onicecandidate = (evt) => {\n if (evt.candidate === null) {\n doneGatheringIceCandidate(peerConnection);\n }\n else {\n LoggerProxy.logger.log(`PeerConnectionManager:index#onicecandidate --> Candidate ${evt.candidate?.type} ${evt.candidate?.protocol} ${evt.candidate?.address}:${evt.candidate?.port}`);\n }\n };\n\n peerConnection.onicecandidateerror = (event) => {\n // we can often get ICE candidate errors (for example when failing to communicate with a TURN server)\n // they don't mean that the whole ICE connection will fail, so it's OK to ignore them\n LoggerProxy.logger.error('PeerConnectionManager:index#onicecandidateerror --> ignoring ice error:', event);\n };\n });\n\n/**\n * swapping tracks\n * @param {Object} peerConnection\n * @param {Object} track\n * @returns {undefined}\n */\npc.replaceTrack = (peerConnection, track) => {\n try {\n const senders = peerConnection.getSenders();\n\n if (senders.length > 0) {\n senders.forEach((sender) => {\n if (sender.track && sender.track.kind === track.kind) {\n sender.replaceTrack(track);\n }\n });\n }\n }\n catch (err) {\n LoggerProxy.logger.error(`PeerConnectionManager:index#replaceTrack --> Error replacing track, ${err}`);\n }\n};\n\n/**\n * adding streams to peerConnection\n * @param {Object} peerConnection\n * @param {Object} stream\n * @returns {undefined}\n */\npc.addStream = (peerConnection, stream) => {\n try {\n if (stream && !isBrowser('edge')) {\n const tracksPresent = peerConnection.getSenders && peerConnection.getSenders().find((sender) => sender.track != null);\n\n if (tracksPresent) {\n stream.getTracks().forEach((track) => {\n pc.replaceTrack(peerConnection, track);\n });\n\n return;\n }\n stream.getTracks().forEach((track) => {\n peerConnection.addTrack(track, stream);\n });\n // // TODO : may come back disable addTracks for chrome they are moving back to addStream\n // // https://bugs.chromium.org/p/chromium/issues/detail?id=764414\n // // https://bugs.chromium.org/p/chromium/issues/detail?id=738918#c7\n // peerConnection.addStream(stream);\n }\n else if (isBrowser('edge')) {\n peerConnection.addStream(stream);\n }\n }\n catch (err) {\n LoggerProxy.logger.error(`PeerConnectionManager:index#addStream --> Error adding stream, error: ${error}`);\n }\n};\n\n/**\n * setting the remote description\n * @param {Object} peerConnection\n * @param {String} typeStr\n * @param {String} remoteSdp\n * @param {String} meetingId\n * @returns {undefined}\n */\npc.setRemoteSessionDetails = (\n peerConnection,\n typeStr,\n remoteSdp,\n meetingId,\n) => {\n LoggerProxy.logger.log(`PeerConnectionManager:index#setRemoteSessionDetails --> Setting the remote description type: ${typeStr}State: ${peerConnection.signalingState}`);\n let sdp = remoteSdp;\n\n // making sure that the remoteDescription is only set when there is a answer for offer\n // or there is a offer from the server\n\n if (!sdp) {\n Metrics.postEvent({\n event: eventType.REMOTE_SDP_RECEIVED,\n meetingId,\n data: {\n canProceed: false,\n errors: [Metrics.generateErrorPayload(2001, true,\n error.name.MEDIA_ENGINE, 'missing remoteSdp')]\n }\n });\n }\n if (peerConnection.signalingState === SDP.HAVE_LOCAL_OFFER || (peerConnection.signalingState === SDP.STABLE && typeStr === SDP.OFFER)) {\n sdp = setStartBitrateOnRemoteSdp(sdp);\n\n if (!peerConnection.enableExtmap) {\n sdp = sdp.replace(/\\na=extmap.*/g, '');\n }\n\n // remove any xtls candidates\n sdp = sdp.replace(/^a=candidate:.*xTLS.*\\r\\n/gim, '');\n\n return peerConnection.setRemoteDescription(\n new window.RTCSessionDescription({\n type: typeStr,\n sdp\n })\n )\n .then(() => {\n if (peerConnection.signalingState === SDP.STABLE) {\n Metrics.postEvent({\n event: eventType.REMOTE_SDP_RECEIVED,\n meetingId\n });\n }\n })\n .catch((error) => {\n LoggerProxy.logger.error(`Peer-connection-manager:index#setRemoteDescription --> ${error} missing remotesdp`);\n\n\n const metricName = BEHAVIORAL_METRICS.PEERCONNECTION_FAILURE;\n const data = {\n correlation_id: meetingId,\n reason: error.message,\n stack: error.stack\n };\n const metadata = {\n type: error.name\n };\n\n Metrics.sendBehavioralMetric(metricName, data, metadata);\n\n return Metrics.postEvent({\n event: eventType.REMOTE_SDP_RECEIVED,\n meetingId,\n data: {\n canProceed: false,\n errors: [Metrics.generateErrorPayload(2001, true,\n error.name.MEDIA_ENGINE, 'missing remoteSdp')]\n }\n });\n });\n }\n\n return Promise.reject(new MediaError('PeerConnection in wrong state'));\n};\n\n/**\n * Create offer with a valid parameter\n * @param {Object} peerConnection\n * @param {Object} meetingProperties\n * @param {string} meetingProperties.meetingId\n * @param {string} meetingProperties.remoteQualityLevel LOW|MEDIUM|HIGH\n * @param {string} meetingProperties.enableRtx\n * @param {string} meetingProperties.enableExtmap\n * @returns {RTCPeerConnection}\n */\npc.createOffer = (peerConnection, {\n meetingId,\n remoteQualityLevel,\n enableRtx,\n enableExtmap\n}) => {\n LoggerProxy.logger.log('PeerConnectionManager:index#createOffer --> creating a new offer');\n\n // saving the extMap State to use in setRemoteDescription\n\n peerConnection.enableExtmap = enableExtmap;\n\n return peerConnection\n .createOffer()\n .then((description) => {\n // bug https://bugs.chromium.org/p/chromium/issues/detail?id=1020642\n // chrome currently generates RTX line irrespective of whether the server side supports it\n // we are removing apt as well because its associated with rtx line\n\n if (!enableRtx) {\n description.sdp = description.sdp.replace(/\\r\\na=rtpmap:\\d+ rtx\\/\\d+/g, '');\n description.sdp = description.sdp.replace(/\\r\\na=fmtp:\\d+ apt=\\d+/g, '');\n }\n\n return peerConnection.setLocalDescription(description);\n })\n .then(() => pc.iceCandidate(peerConnection, {remoteQualityLevel}))\n .then(() => {\n if (!checkH264Support(peerConnection.sdp)) {\n throw new MediaError('openH264 is downloading please Wait. Upload logs if not working on second try');\n }\n\n if (!enableExtmap) {\n peerConnection.sdp = peerConnection.sdp.replace(/\\na=extmap.*/g, '');\n }\n\n pc.setContentSlides(peerConnection);\n\n Metrics.postEvent({\n event: eventType.LOCAL_SDP_GENERATED,\n meetingId\n });\n\n return peerConnection;\n })\n .catch((error) => {\n LoggerProxy.logger.error(`Peer-connection-manager:index#createOffer --> ${error}`);\n if (error instanceof InvalidSdpError) {\n Metrics.sendBehavioralMetric(\n BEHAVIORAL_METRICS.INVALID_ICE_CANDIDATE,\n {\n correlation_id: meetingId,\n code: error.code,\n reason: error.message\n }\n );\n }\n else {\n const metricName = BEHAVIORAL_METRICS.PEERCONNECTION_FAILURE;\n const data = {\n correlation_id: meetingId,\n reason: error.message,\n stack: error.stack\n };\n const metadata = {\n type: error.name\n };\n\n Metrics.sendBehavioralMetric(metricName, data, metadata);\n }\n\n Metrics.postEvent({\n event: eventType.LOCAL_SDP_GENERATED,\n meetingId,\n data: {\n canProceed: false,\n errors: [\n Metrics.generateErrorPayload(2001, true,\n error.name.MEDIA_ENGINE)]\n }\n });\n pc.close(peerConnection);\n throw error;\n });\n};\n\n/**\n * rollBack local description in peerconnection\n * @param {Object} peerConnection\n * @returns {Promise.RTCPeerConnection}\n */\npc.rollBackLocalDescription = (peerConnection) => peerConnection\n .setLocalDescription(new RTCSessionDescription({type: SDP.ROLLBACK}))\n .then(() => peerConnection)\n .catch((err) => {\n LoggerProxy.logger.error(`Peer-connection-manager:index#setLocalDescription --> ${err} `);\n\n return Promise.error(err);\n });\n\n/**\n * @param {Object} params {\n * @param {Boolean} params.offerToReceiveAudio\n * @param {Boolean} params.offerToReceiveVideo\n * @param {string} params.offerSdp\n * @param {MediaStream} params.stream\n * @param {Object} meetingProperties\n * @param {string} meetingProperties.meetingId\n * @param {string} meetingProperties.remoteQualityLevel LOW|MEDIUM|HIGH\n * @returns {Promise.<Array>} [MediaSDP, ScreenSDP]\n */\npc.updatePeerConnection = (params, {meetingId, remoteQualityLevel}) => {\n LoggerProxy.logger.log(`PeerConnectionManager:index#updatePeerConnection --> updating the peerConnection with params: ${params}`);\n\n const {peerConnection, offerSdp} = params;\n\n return pc.createAnswer({\n peerConnection,\n offerSdp: offerSdp[0]\n }, {meetingId, remoteQualityLevel}).then((peerconnection) => {\n // The content slides should also be set when we are sending inactive\n pc.setContentSlides(peerconnection);\n\n return Promise.resolve([peerconnection.sdp]);\n });\n};\n\n/**\n * @param {Object} params\n * @param {Object} params.peerConnection\n * @param {Object} params.sdpConstraints\n * @param {Object} meetingProperties\n * @param {string} meetingProperties.meetingId\n * @param {string} meetingProperties.remoteQualityLevel LOW|MEDIUM|HIGH\n * @returns {RTCPeerConnection} peerConnection\n */\npc.createAnswer = (params, {meetingId, remoteQualityLevel}) => {\n const {peerConnection} = params;\n\n // TODO: Some times to many mercury event comes at the same time\n // Need to maintain state of peerconnection\n if (peerConnection.signalingState === SDP.HAVE_REMOTE_OFFER) {\n return Promise.resolve(peerConnection);\n }\n\n return pc.setRemoteSessionDetails(peerConnection, OFFER, params.offerSdp, meetingId)\n .then(() => peerConnection.createAnswer(params.sdpConstraints))\n .then((answer) =>\n\n peerConnection.setLocalDescription(answer))\n .then(() => pc.iceCandidate(peerConnection, {remoteQualityLevel}))\n .then(() => {\n peerConnection.sdp = limitBandwidth(peerConnection.localDescription.sdp);\n peerConnection.sdp = setMaxFs(peerConnection.sdp, remoteQualityLevel);\n peerConnection.sdp = PeerConnectionUtils.convertCLineToIpv4(peerConnection.sdp);\n if (!checkH264Support(peerConnection.sdp)) {\n throw new MediaError('openH264 is downloading please Wait. Upload logs if not working on second try');\n }\n\n return peerConnection;\n })\n .catch((error) => {\n if (error instanceof InvalidSdpError) {\n Metrics.sendBehavioralMetric(\n BEHAVIORAL_METRICS.INVALID_ICE_CANDIDATE,\n {\n correlation_id: meetingId\n }\n );\n }\n else {\n const metricName = BEHAVIORAL_METRICS.PEERCONNECTION_FAILURE;\n const data = {\n correlation_id: meetingId,\n reason: error.message,\n stack: error.stack\n };\n const metadata = {\n type: error.name\n };\n\n Metrics.sendBehavioralMetric(metricName, data, metadata);\n }\n\n LoggerProxy.logger.error(`PeerConnectionManager:index#setRemoteSessionDetails --> Error creating remote session, error: ${error}`);\n });\n};\n\n/**\n * shut down the peer connection\n * @param {Object} peerConnection\n * @returns {undefined}\n */\npc.close = (peerConnection) => {\n // peerConnection.close() fails on firefox on network changes and gives a Dom exception\n // To avoid this we have added a try catch block.\n // Please refer to https://bugzilla.mozilla.org/show_bug.cgi?id=1274407 for more information\n LoggerProxy.logger.log('PeerConnectionManager:index#close --> pc: close() -> attempting to close the peer connection');\n\n if (peerConnection && peerConnection.connectionState === PEER_CONNECTION_STATE.CLOSED) {\n LoggerProxy.logger.log('PeerConnectionManager:index#close --> pc: close() -> connection already closed');\n\n return Promise.resolve();\n }\n LoggerProxy.logger.log('PeerConnectionManager:index#close --> pc: close() -> closing the mediaPeerConnection');\n\n return Promise.resolve()\n .then(() => {\n if (peerConnection && peerConnection.close) {\n peerConnection.close();\n }\n });\n};\n\n\npc.setPeerConnectionEvents = (meeting) => {\n // In case ICE fail\n const {peerConnection} = meeting.mediaProperties;\n\n const connectionFailed = () => {\n if (meeting.reconnectionManager.iceState.resolve) {\n // DISCONNECTED state triggers first then it goes to FAILED STATE\n // sometimes the failed state can happen before 10 seconds (Which is the timer for the reconnect for ice disconnect)\n meeting.reconnectionManager.iceState.resolve();\n }\n\n meeting.reconnect({networkDisconnect: true});\n Metrics.postEvent({\n event: eventType.ICE_END,\n meeting,\n data: {\n canProceed: false,\n errors: [\n Metrics.generateErrorPayload(\n 2004, false, error.name.MEDIA_ENGINE\n )]\n }\n });\n\n meeting.uploadLogs({\n file: 'peer-connection-manager/index',\n function: 'connectionFailed'\n });\n\n Metrics.sendBehavioralMetric(\n BEHAVIORAL_METRICS.CONNECTION_FAILURE,\n {\n correlation_id: meeting.correlationId,\n locus_id: meeting.locusId\n }\n );\n };\n\n peerConnection.oniceconnectionstatechange = () => {\n LoggerProxy.logger.info('PeerConnectionManager:index#setPeerConnectionEvents --> ICE STATE CHANGE.');\n switch (peerConnection.iceConnectionState) {\n case ICE_STATE.CHECKING:\n LoggerProxy.logger.info('PeerConnectionManager:index#setPeerConnectionEvents --> ICE STATE CHECKING.');\n Metrics.postEvent({event: eventType.ICE_START, meeting});\n break;\n case ICE_STATE.COMPLETED:\n LoggerProxy.logger.info('PeerConnectionManager:index#setPeerConnectionEvents --> ICE STATE COMPLETED.');\n break;\n case ICE_STATE.CONNECTED:\n // Ice connection state goes to connected when both client and server sends STUN packets and\n // Established connected between them. Firefox does not trigger COMPLETED and only trigger CONNECTED\n Metrics.postEvent({event: eventType.ICE_END, meeting});\n Metrics.sendBehavioralMetric(\n BEHAVIORAL_METRICS.CONNECTION_SUCCESS,\n {\n correlation_id: meeting.correlationId,\n locus_id: meeting.locusId\n }\n );\n meeting.setNetworkStatus(NETWORK_STATUS.CONNECTED);\n meeting.reconnectionManager.iceReconnected();\n LoggerProxy.logger.info('PeerConnectionManager:index#setPeerConnectionEvents --> ICE STATE CONNECTED.');\n break;\n case ICE_STATE.CLOSED:\n LoggerProxy.logger.info('PeerConnectionManager:index#setPeerConnectionEvents --> ICE STATE CLOSED.');\n break;\n case ICE_STATE.DISCONNECTED:\n meeting.setNetworkStatus(NETWORK_STATUS.DISCONNECTED);\n meeting.reconnectionManager.waitForIceReconnect()\n .catch(() => {\n LoggerProxy.logger.info('PeerConnectionManager:index#setPeerConnectionEvents --> ICE STATE DISCONNECTED. Automatic Reconnection Timed Out.');\n\n connectionFailed();\n });\n LoggerProxy.logger.info('PeerConnectionManager:index#setPeerConnectionEvents --> ICE STATE DISCONNECTED.');\n break;\n case ICE_STATE.FAILED:\n LoggerProxy.logger.info('PeerConnectionManager:index#setPeerConnectionEvents --> ICE STATE FAILED.');\n // notify of ice failure\n // Ice failure is the only indicator currently for identifying the actual connection drop\n // Firefox takes sometime 10-15 seconds to go to failed state\n connectionFailed();\n break;\n default:\n break;\n }\n };\n\n peerConnection.onconnectionstatechange = () => {\n LoggerProxy.logger.info('PeerConnectionManager:index#setPeerConnectionEvents --> CONNECTION STATE CHANGE.');\n switch (peerConnection.connectionState) {\n case CONNECTION_STATE.NEW:\n LoggerProxy.logger.info('PeerConnectionManager:index#setPeerConnectionEvents --> CONNECTION STATE NEW.');\n break;\n case CONNECTION_STATE.CONNECTING:\n LoggerProxy.logger.info('PeerConnectionManager:index#setPeerConnectionEvents --> CONNECTION STATE CONNECTING.');\n break;\n case CONNECTION_STATE.CONNECTED:\n LoggerProxy.logger.info('PeerConnectionManager:index#setPeerConnectionEvents --> CONNECTION STATE CONNECTED.');\n break;\n case CONNECTION_STATE.CLOSED:\n LoggerProxy.logger.info('PeerConnectionManager:index#setPeerConnectionEvents --> CONNECTION STATE CLOSED.');\n break;\n case CONNECTION_STATE.DISCONNECTED:\n LoggerProxy.logger.info('PeerConnectionManager:index#setPeerConnectionEvents --> CONNECTION STATE DISCONNECTED.');\n break;\n case CONNECTION_STATE.FAILED:\n LoggerProxy.logger.info('PeerConnectionManager:index#setPeerConnectionEvents --> CONNECTION STATE FAILED.');\n // Special case happens only on chrome where there is no ICE FAILED event\n // only CONNECTION FAILED event gets triggered\n\n connectionFailed();\n break;\n default:\n break;\n }\n };\n};\n\nexport default pc;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAKA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AAaA;;AACA;;A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KAAKe,2BAAA,CAAiBE,UAAtB;QACEpJ,oBAAA,CAAYC,MAAZ,CAAmBkI,IAAnB,CAAwB,sFAAxB;;QACA;;MACF,KAAKe,2BAAA,CAAiBT,SAAtB;QACEzI,oBAAA,CAAYC,MAAZ,CAAmBkI,IAAnB,CAAwB,qFAAxB;;QACA;;MACF,KAAKe,2BAAA,CAAiBjC,MAAtB;QACEjH,oBAAA,CAAYC,MAAZ,CAAmBkI,IAAnB,CAAwB,kFAAxB;;QACA;;MACF,KAAKe,2BAAA,CAAiBJ,YAAtB;QACE9I,oBAAA,CAAYC,MAAZ,CAAmBkI,IAAnB,CAAwB,wFAAxB;;QACA;;MACF,KAAKe,2BAAA,CAAiBF,MAAtB;QACEhJ,oBAAA,CAAYC,MAAZ,CAAmBkI,IAAnB,CAAwB,kFAAxB,EADF,CAEE;QACA;;;QAEAd,gBAAgB;QAChB;;MACF;QACE;IAxBJ;EA0BD,CA5BD;AA6BD,CArHD;;eAuHe/J,E"}
|
|
1
|
+
{"version":3,"names":["BrowserDetection","isBrowser","pc","insertBandwidthLimit","sdpLines","index","limit","periodicKeyFrame","search","AUDIO","StaticConfig","meetings","bandwidth","audio","video","SDP","PERIODIC_KEYFRAME","splice","B_LINE","setRemoteVideoConstraints","sdp","level","QUALITY_LEVELS","HIGH","maxFs","REMOTE_VIDEO_CONSTRAINTS","MAX_FS","ParameterError","modifiedSdp","PeerConnectionUtils","adjustH264Profile","setStartBitrateOnRemoteSdp","startBitrate","replace","checkH264Support","videoPresent","match","h264Present","isSdpInvalid","parsedSdp","sdpTransform","parse","media","mediaLine","candidates","length","LoggerProxy","logger","error","BAD_MEDIA_PORTS","includes","port","icePwd","iceUfrag","limitBandwidth","offerSdp","split","CARRIAGE_RETURN","i","M_LINE","join","setContentSlides","screenPc","A_CONTENT_SLIDES","iceCandidate","peerConnection","remoteQualityLevel","resolve","reject","now","doneGatheringIceCandidate","miliseconds","Math","abs","localDescription","convertCLineToIpv4","invalidSdpPresent","InvalidSdpError","log","iceGatheringState","COMPLETE","onIceGatheringStateChange","GATHERING","onicecandidate","evt","candidate","type","protocol","address","onicecandidateerror","event","replaceTrack","track","senders","getSenders","forEach","sender","kind","err","addStream","stream","tracksPresent","find","getTracks","addTrack","setRemoteSessionDetails","typeStr","remoteSdp","meetingId","signalingState","Metrics","postEvent","eventType","REMOTE_SDP_RECEIVED","data","canProceed","errors","generateErrorPayload","name","MEDIA_ENGINE","HAVE_LOCAL_OFFER","STABLE","OFFER","enableExtmap","setRemoteDescription","window","RTCSessionDescription","then","catch","metricName","BEHAVIORAL_METRICS","PEERCONNECTION_FAILURE","correlation_id","reason","message","stack","metadata","sendBehavioralMetric","MediaError","createOffer","enableRtx","description","setLocalDescription","LOCAL_SDP_GENERATED","INVALID_ICE_CANDIDATE","code","close","rollBackLocalDescription","ROLLBACK","updatePeerConnection","params","createAnswer","peerconnection","HAVE_REMOTE_OFFER","sdpConstraints","answer","connectionState","PEER_CONNECTION_STATE","CLOSED","setPeerConnectionEvents","meeting","mediaProperties","connectionFailed","reconnectionManager","iceState","reconnect","networkDisconnect","ICE_END","uploadLogs","file","function","CONNECTION_FAILURE","correlationId","locus_id","locusId","oniceconnectionstatechange","info","iceConnectionState","ICE_STATE","CHECKING","ICE_START","COMPLETED","CONNECTED","CONNECTION_SUCCESS","setNetworkStatus","NETWORK_STATUS","iceReconnected","DISCONNECTED","waitForIceReconnect","FAILED","onconnectionstatechange","CONNECTION_STATE","NEW","CONNECTING"],"sources":["index.js"],"sourcesContent":["\n// We need to figure out how to pass a webex logger instance to these util files\n\n/* globals RTCSessionDescription */\n\nimport window from 'global/window';\nimport sdpTransform from 'sdp-transform'; // https://github.com/clux/sdp-transform\n\nimport Metrics from '../metrics';\nimport LoggerProxy from '../common/logs/logger-proxy';\nimport StaticConfig from '../common/config';\nimport {\n COMPLETE,\n GATHERING,\n AUDIO,\n SDP,\n ICE_STATE,\n CONNECTION_STATE,\n NETWORK_STATUS,\n PEER_CONNECTION_STATE,\n OFFER,\n QUALITY_LEVELS,\n REMOTE_VIDEO_CONSTRAINTS\n} from '../constants';\nimport BEHAVIORAL_METRICS from '../metrics/constants';\nimport {error, eventType} from '../metrics/config';\nimport MediaError from '../common/errors/media';\nimport ParameterError from '../common/errors/parameter';\nimport {InvalidSdpError} from '../common/errors/webex-errors';\nimport BrowserDetection from '../common/browser-detection';\n\nimport PeerConnectionUtils from './util';\n\nconst {isBrowser} = BrowserDetection();\n\n/**\n * @export\n * @public\n */\nconst pc = {};\n\n/**\n * munges the bandwidth limit into the sdp\n * @param {String} sdpLines\n * @param {Number} index\n * @returns {String}\n */\nconst insertBandwidthLimit = (sdpLines, index) => {\n // eslint-disable-next-line no-warning-comments\n // TODO convert to sdp parser\n let limit;\n let periodicKeyFrame = '';\n\n if (sdpLines[index].search(AUDIO) !== -1) {\n limit = StaticConfig.meetings.bandwidth.audio;\n }\n else {\n limit = StaticConfig.meetings.bandwidth.video;\n periodicKeyFrame = SDP.PERIODIC_KEYFRAME;\n sdpLines.splice(index + 2, 0, periodicKeyFrame);\n }\n sdpLines.splice(index + 1, 0, `${SDP.B_LINE}:${limit}`);\n\n return sdpLines;\n};\n\n/**\n * needed for calliope max-fs\n * @param {String} sdp\n * @param {String} [level=QUALITY_LEVELS.HIGH] quality level for max-fs\n * @returns {String}\n */\nconst setRemoteVideoConstraints = (sdp, level = QUALITY_LEVELS.HIGH) => {\n const maxFs = REMOTE_VIDEO_CONSTRAINTS.MAX_FS[level];\n\n if (!maxFs) {\n throw new ParameterError(`setRemoteVideoConstraints: unable to set max framesize, value for level \"${level}\" is not defined`);\n }\n\n const modifiedSdp = PeerConnectionUtils.adjustH264Profile(sdp, maxFs);\n\n return modifiedSdp;\n};\n\n\nconst setStartBitrateOnRemoteSdp = (sdp) => {\n if (StaticConfig.meetings.bandwidth.startBitrate) {\n sdp = sdp.replace(/(\\na=fmtp:(\\d+).*profile-level-id=.*)/gi, `$1;x-google-start-bitrate=${StaticConfig.meetings.bandwidth.startBitrate}`);\n }\n\n return sdp;\n};\n\n/**\n * checks that sdp has h264 codec in it\n * @param {String} sdp\n * @returns {boolean}\n */\nconst checkH264Support = (sdp) => {\n // eslint-disable-next-line no-warning-comments\n // TODO convert to sdp parser to read rtp.codec\n const videoPresent = sdp.match(/\\nm=video.*/g);\n const h264Present = sdp.match(/\\na=rtpmap:\\d+\\sH264.*/g);\n\n if (videoPresent) {\n return !!h264Present;\n }\n\n return true;\n};\n\n/**\n * validates the sdp, checks port, candidates, and ice info\n * @param {String} sdp\n * @returns {String}\n */\nconst isSdpInvalid = (sdp) => {\n const parsedSdp = sdpTransform.parse(sdp);\n\n for (const mediaLine of parsedSdp.media) {\n if (!mediaLine.candidates || mediaLine.candidates?.length === 0) {\n LoggerProxy.logger.error('PeerConnectionManager:index#isSdpInvalid --> iceCandidate: Ice candidate never completed');\n\n return 'iceCandidate: Ice gathering never completed';\n }\n\n if (SDP.BAD_MEDIA_PORTS.includes(mediaLine.port)) {\n LoggerProxy.logger.error('PeerConnectionManager:index#isSdpInvalid --> iceCandidate: Found invalid port number for the ice candidate');\n\n return 'iceCandidate: Found invalid port number for the ice candidate';\n }\n if (!mediaLine.icePwd || !mediaLine.iceUfrag) {\n LoggerProxy.logger.error('PeerConnectionManager:index#isSdpInvalid --> iceCandidate: ice ufrag and password not found');\n\n return 'iceCandidate: ice ufrag and password not found';\n }\n }\n\n return '';\n};\n\n/**\n * munges the bandwidth into the sdp\n * @param {String} sdp\n * @returns {String}\n */\nconst limitBandwidth = (sdp) => {\n // TODO convert to sdp parser\n let offerSdp = sdp;\n let sdpLines = offerSdp.split(SDP.CARRIAGE_RETURN);\n\n for (let i = 0; i < sdpLines.length; i += 1) {\n if (sdpLines[i].search(SDP.M_LINE) !== -1) {\n sdpLines = insertBandwidthLimit(sdpLines, i);\n }\n }\n offerSdp = sdpLines.join(SDP.CARRIAGE_RETURN);\n\n return offerSdp;\n};\n\n/**\n * makes sure the screen pc sdp has content:slides for server\n * @param {RTCPeerConnection} screenPc\n * @returns {RTCPeerConnection}\n */\npc.setContentSlides = (screenPc) => {\n if (screenPc && screenPc.sdp) {\n screenPc.sdp += `${SDP.A_CONTENT_SLIDES}${SDP.CARRIAGE_RETURN}`;\n }\n\n return screenPc;\n};\n\n/**\n * handles ice trickling and establishes ICE connection onto peer connection object\n * @param {Object} peerConnection\n * @param {Object} options\n * @param {String} options.remoteQualityLevel\n * @returns {Promise.RTCPeerConnection}\n */\npc.iceCandidate = (peerConnection, {remoteQualityLevel}) =>\n new Promise((resolve, reject) => {\n const now = Date.now();\n const doneGatheringIceCandidate = () => {\n const miliseconds = parseInt(Math.abs(Date.now() - now), 4);\n\n peerConnection.sdp = limitBandwidth(peerConnection.localDescription.sdp);\n peerConnection.sdp = PeerConnectionUtils.convertCLineToIpv4(peerConnection.sdp);\n peerConnection.sdp = setRemoteVideoConstraints(peerConnection.sdp, remoteQualityLevel);\n\n const invalidSdpPresent = isSdpInvalid(peerConnection.sdp);\n\n if (invalidSdpPresent) {\n LoggerProxy.logger.error('PeerConnectionManager:index#iceCandidate --> SDP not valid after waiting.');\n reject(new InvalidSdpError(invalidSdpPresent));\n }\n LoggerProxy.logger.log(`PeerConnectionManager:index#iceCandidate --> Time to gather ice candidate ${miliseconds} miliseconds`);\n\n\n resolve();\n };\n\n // If ice has already been gathered\n if (peerConnection.iceGatheringState === COMPLETE) {\n doneGatheringIceCandidate();\n }\n\n peerConnection.onIceGatheringStateChange = () => {\n if (peerConnection.iceGatheringState === COMPLETE) {\n doneGatheringIceCandidate(peerConnection);\n }\n if (peerConnection.iceGatheringState === GATHERING) {\n LoggerProxy.logger.log('PeerConnectionManager:index#onIceGatheringStateChange --> Ice state changed to gathering');\n }\n };\n\n peerConnection.onicecandidate = (evt) => {\n if (evt.candidate === null) {\n doneGatheringIceCandidate(peerConnection);\n }\n else {\n LoggerProxy.logger.log(`PeerConnectionManager:index#onicecandidate --> Candidate ${evt.candidate?.type} ${evt.candidate?.protocol} ${evt.candidate?.address}:${evt.candidate?.port}`);\n }\n };\n\n peerConnection.onicecandidateerror = (event) => {\n // we can often get ICE candidate errors (for example when failing to communicate with a TURN server)\n // they don't mean that the whole ICE connection will fail, so it's OK to ignore them\n LoggerProxy.logger.error('PeerConnectionManager:index#onicecandidateerror --> ignoring ice error:', event);\n };\n });\n\n/**\n * swapping tracks\n * @param {Object} peerConnection\n * @param {Object} track\n * @returns {undefined}\n */\npc.replaceTrack = (peerConnection, track) => {\n try {\n const senders = peerConnection.getSenders();\n\n if (senders.length > 0) {\n senders.forEach((sender) => {\n if (sender.track && sender.track.kind === track.kind) {\n sender.replaceTrack(track);\n }\n });\n }\n }\n catch (err) {\n LoggerProxy.logger.error(`PeerConnectionManager:index#replaceTrack --> Error replacing track, ${err}`);\n }\n};\n\n/**\n * adding streams to peerConnection\n * @param {Object} peerConnection\n * @param {Object} stream\n * @returns {undefined}\n */\npc.addStream = (peerConnection, stream) => {\n try {\n if (stream && !isBrowser('edge')) {\n const tracksPresent = peerConnection.getSenders && peerConnection.getSenders().find((sender) => sender.track != null);\n\n if (tracksPresent) {\n stream.getTracks().forEach((track) => {\n pc.replaceTrack(peerConnection, track);\n });\n\n return;\n }\n stream.getTracks().forEach((track) => {\n peerConnection.addTrack(track, stream);\n });\n // // TODO : may come back disable addTracks for chrome they are moving back to addStream\n // // https://bugs.chromium.org/p/chromium/issues/detail?id=764414\n // // https://bugs.chromium.org/p/chromium/issues/detail?id=738918#c7\n // peerConnection.addStream(stream);\n }\n else if (isBrowser('edge')) {\n peerConnection.addStream(stream);\n }\n }\n catch (err) {\n LoggerProxy.logger.error(`PeerConnectionManager:index#addStream --> Error adding stream, error: ${error}`);\n }\n};\n\n/**\n * setting the remote description\n * @param {Object} peerConnection\n * @param {String} typeStr\n * @param {String} remoteSdp\n * @param {String} meetingId\n * @returns {undefined}\n */\npc.setRemoteSessionDetails = (\n peerConnection,\n typeStr,\n remoteSdp,\n meetingId,\n) => {\n LoggerProxy.logger.log(`PeerConnectionManager:index#setRemoteSessionDetails --> Setting the remote description type: ${typeStr}State: ${peerConnection.signalingState}`);\n let sdp = remoteSdp;\n\n // making sure that the remoteDescription is only set when there is a answer for offer\n // or there is a offer from the server\n\n if (!sdp) {\n Metrics.postEvent({\n event: eventType.REMOTE_SDP_RECEIVED,\n meetingId,\n data: {\n canProceed: false,\n errors: [Metrics.generateErrorPayload(2001, true,\n error.name.MEDIA_ENGINE, 'missing remoteSdp')]\n }\n });\n }\n if (peerConnection.signalingState === SDP.HAVE_LOCAL_OFFER || (peerConnection.signalingState === SDP.STABLE && typeStr === SDP.OFFER)) {\n sdp = setStartBitrateOnRemoteSdp(sdp);\n\n if (!peerConnection.enableExtmap) {\n sdp = sdp.replace(/\\na=extmap.*/g, '');\n }\n\n // remove any xtls candidates\n sdp = sdp.replace(/^a=candidate:.*xTLS.*\\r\\n/gim, '');\n\n return peerConnection.setRemoteDescription(\n new window.RTCSessionDescription({\n type: typeStr,\n sdp\n })\n )\n .then(() => {\n if (peerConnection.signalingState === SDP.STABLE) {\n Metrics.postEvent({\n event: eventType.REMOTE_SDP_RECEIVED,\n meetingId\n });\n }\n })\n .catch((error) => {\n LoggerProxy.logger.error(`Peer-connection-manager:index#setRemoteDescription --> ${error} missing remotesdp`);\n\n\n const metricName = BEHAVIORAL_METRICS.PEERCONNECTION_FAILURE;\n const data = {\n correlation_id: meetingId,\n reason: error.message,\n stack: error.stack\n };\n const metadata = {\n type: error.name\n };\n\n Metrics.sendBehavioralMetric(metricName, data, metadata);\n\n return Metrics.postEvent({\n event: eventType.REMOTE_SDP_RECEIVED,\n meetingId,\n data: {\n canProceed: false,\n errors: [Metrics.generateErrorPayload(2001, true,\n error.name.MEDIA_ENGINE, 'missing remoteSdp')]\n }\n });\n });\n }\n\n return Promise.reject(new MediaError('PeerConnection in wrong state'));\n};\n\n/**\n * Create offer with a valid parameter\n * @param {Object} peerConnection\n * @param {Object} meetingProperties\n * @param {string} meetingProperties.meetingId\n * @param {string} meetingProperties.remoteQualityLevel LOW|MEDIUM|HIGH\n * @param {string} meetingProperties.enableRtx\n * @param {string} meetingProperties.enableExtmap\n * @returns {RTCPeerConnection}\n */\npc.createOffer = (peerConnection, {\n meetingId,\n remoteQualityLevel,\n enableRtx,\n enableExtmap\n}) => {\n LoggerProxy.logger.log('PeerConnectionManager:index#createOffer --> creating a new offer');\n\n // saving the extMap State to use in setRemoteDescription\n\n peerConnection.enableExtmap = enableExtmap;\n\n return peerConnection\n .createOffer()\n .then((description) => {\n // bug https://bugs.chromium.org/p/chromium/issues/detail?id=1020642\n // chrome currently generates RTX line irrespective of whether the server side supports it\n // we are removing apt as well because its associated with rtx line\n\n if (!enableRtx) {\n description.sdp = description.sdp.replace(/\\r\\na=rtpmap:\\d+ rtx\\/\\d+/g, '');\n description.sdp = description.sdp.replace(/\\r\\na=fmtp:\\d+ apt=\\d+/g, '');\n }\n\n return peerConnection.setLocalDescription(description);\n })\n .then(() => pc.iceCandidate(peerConnection, {remoteQualityLevel}))\n .then(() => {\n if (!checkH264Support(peerConnection.sdp)) {\n throw new MediaError('openH264 is downloading please Wait. Upload logs if not working on second try');\n }\n\n if (!enableExtmap) {\n peerConnection.sdp = peerConnection.sdp.replace(/\\na=extmap.*/g, '');\n }\n\n pc.setContentSlides(peerConnection);\n\n Metrics.postEvent({\n event: eventType.LOCAL_SDP_GENERATED,\n meetingId\n });\n\n return peerConnection;\n })\n .catch((error) => {\n LoggerProxy.logger.error(`Peer-connection-manager:index#createOffer --> ${error}`);\n if (error instanceof InvalidSdpError) {\n Metrics.sendBehavioralMetric(\n BEHAVIORAL_METRICS.INVALID_ICE_CANDIDATE,\n {\n correlation_id: meetingId,\n code: error.code,\n reason: error.message\n }\n );\n }\n else {\n const metricName = BEHAVIORAL_METRICS.PEERCONNECTION_FAILURE;\n const data = {\n correlation_id: meetingId,\n reason: error.message,\n stack: error.stack\n };\n const metadata = {\n type: error.name\n };\n\n Metrics.sendBehavioralMetric(metricName, data, metadata);\n }\n\n Metrics.postEvent({\n event: eventType.LOCAL_SDP_GENERATED,\n meetingId,\n data: {\n canProceed: false,\n errors: [\n Metrics.generateErrorPayload(2001, true,\n error.name.MEDIA_ENGINE)]\n }\n });\n pc.close(peerConnection);\n throw error;\n });\n};\n\n/**\n * rollBack local description in peerconnection\n * @param {Object} peerConnection\n * @returns {Promise.RTCPeerConnection}\n */\npc.rollBackLocalDescription = (peerConnection) => peerConnection\n .setLocalDescription(new RTCSessionDescription({type: SDP.ROLLBACK}))\n .then(() => peerConnection)\n .catch((err) => {\n LoggerProxy.logger.error(`Peer-connection-manager:index#setLocalDescription --> ${err} `);\n\n return Promise.error(err);\n });\n\n/**\n * @param {Object} params {\n * @param {Boolean} params.offerToReceiveAudio\n * @param {Boolean} params.offerToReceiveVideo\n * @param {string} params.offerSdp\n * @param {MediaStream} params.stream\n * @param {Object} meetingProperties\n * @param {string} meetingProperties.meetingId\n * @param {string} meetingProperties.remoteQualityLevel LOW|MEDIUM|HIGH\n * @returns {Promise.<Array>} [MediaSDP, ScreenSDP]\n */\npc.updatePeerConnection = (params, {meetingId, remoteQualityLevel}) => {\n LoggerProxy.logger.log(`PeerConnectionManager:index#updatePeerConnection --> updating the peerConnection with params: ${params}`);\n\n const {peerConnection, offerSdp} = params;\n\n return pc.createAnswer({\n peerConnection,\n offerSdp: offerSdp[0]\n }, {meetingId, remoteQualityLevel}).then((peerconnection) => {\n // The content slides should also be set when we are sending inactive\n pc.setContentSlides(peerconnection);\n\n return Promise.resolve([peerconnection.sdp]);\n });\n};\n\n/**\n * @param {Object} params\n * @param {Object} params.peerConnection\n * @param {Object} params.sdpConstraints\n * @param {Object} meetingProperties\n * @param {string} meetingProperties.meetingId\n * @param {string} meetingProperties.remoteQualityLevel LOW|MEDIUM|HIGH\n * @returns {RTCPeerConnection} peerConnection\n */\npc.createAnswer = (params, {meetingId, remoteQualityLevel}) => {\n const {peerConnection} = params;\n\n // TODO: Some times to many mercury event comes at the same time\n // Need to maintain state of peerconnection\n if (peerConnection.signalingState === SDP.HAVE_REMOTE_OFFER) {\n return Promise.resolve(peerConnection);\n }\n\n return pc.setRemoteSessionDetails(peerConnection, OFFER, params.offerSdp, meetingId)\n .then(() => peerConnection.createAnswer(params.sdpConstraints))\n .then((answer) =>\n\n peerConnection.setLocalDescription(answer))\n .then(() => pc.iceCandidate(peerConnection, {remoteQualityLevel}))\n .then(() => {\n peerConnection.sdp = limitBandwidth(peerConnection.localDescription.sdp);\n peerConnection.sdp = PeerConnectionUtils.convertCLineToIpv4(peerConnection.sdp);\n peerConnection.sdp = setRemoteVideoConstraints(peerConnection.sdp, remoteQualityLevel);\n\n if (!checkH264Support(peerConnection.sdp)) {\n throw new MediaError('openH264 is downloading please Wait. Upload logs if not working on second try');\n }\n\n return peerConnection;\n })\n .catch((error) => {\n if (error instanceof InvalidSdpError) {\n Metrics.sendBehavioralMetric(\n BEHAVIORAL_METRICS.INVALID_ICE_CANDIDATE,\n {\n correlation_id: meetingId\n }\n );\n }\n else {\n const metricName = BEHAVIORAL_METRICS.PEERCONNECTION_FAILURE;\n const data = {\n correlation_id: meetingId,\n reason: error.message,\n stack: error.stack\n };\n const metadata = {\n type: error.name\n };\n\n Metrics.sendBehavioralMetric(metricName, data, metadata);\n }\n\n LoggerProxy.logger.error(`PeerConnectionManager:index#setRemoteSessionDetails --> Error creating remote session, error: ${error}`);\n });\n};\n\n/**\n * shut down the peer connection\n * @param {Object} peerConnection\n * @returns {undefined}\n */\npc.close = (peerConnection) => {\n // peerConnection.close() fails on firefox on network changes and gives a Dom exception\n // To avoid this we have added a try catch block.\n // Please refer to https://bugzilla.mozilla.org/show_bug.cgi?id=1274407 for more information\n LoggerProxy.logger.log('PeerConnectionManager:index#close --> pc: close() -> attempting to close the peer connection');\n\n if (peerConnection && peerConnection.connectionState === PEER_CONNECTION_STATE.CLOSED) {\n LoggerProxy.logger.log('PeerConnectionManager:index#close --> pc: close() -> connection already closed');\n\n return Promise.resolve();\n }\n LoggerProxy.logger.log('PeerConnectionManager:index#close --> pc: close() -> closing the mediaPeerConnection');\n\n return Promise.resolve()\n .then(() => {\n if (peerConnection && peerConnection.close) {\n peerConnection.close();\n }\n });\n};\n\n\npc.setPeerConnectionEvents = (meeting) => {\n // In case ICE fail\n const {peerConnection} = meeting.mediaProperties;\n\n const connectionFailed = () => {\n if (meeting.reconnectionManager.iceState.resolve) {\n // DISCONNECTED state triggers first then it goes to FAILED STATE\n // sometimes the failed state can happen before 10 seconds (Which is the timer for the reconnect for ice disconnect)\n meeting.reconnectionManager.iceState.resolve();\n }\n\n meeting.reconnect({networkDisconnect: true});\n Metrics.postEvent({\n event: eventType.ICE_END,\n meeting,\n data: {\n canProceed: false,\n errors: [\n Metrics.generateErrorPayload(\n 2004, false, error.name.MEDIA_ENGINE\n )]\n }\n });\n\n meeting.uploadLogs({\n file: 'peer-connection-manager/index',\n function: 'connectionFailed'\n });\n\n Metrics.sendBehavioralMetric(\n BEHAVIORAL_METRICS.CONNECTION_FAILURE,\n {\n correlation_id: meeting.correlationId,\n locus_id: meeting.locusId\n }\n );\n };\n\n peerConnection.oniceconnectionstatechange = () => {\n LoggerProxy.logger.info('PeerConnectionManager:index#setPeerConnectionEvents --> ICE STATE CHANGE.');\n switch (peerConnection.iceConnectionState) {\n case ICE_STATE.CHECKING:\n LoggerProxy.logger.info('PeerConnectionManager:index#setPeerConnectionEvents --> ICE STATE CHECKING.');\n Metrics.postEvent({event: eventType.ICE_START, meeting});\n break;\n case ICE_STATE.COMPLETED:\n LoggerProxy.logger.info('PeerConnectionManager:index#setPeerConnectionEvents --> ICE STATE COMPLETED.');\n break;\n case ICE_STATE.CONNECTED:\n // Ice connection state goes to connected when both client and server sends STUN packets and\n // Established connected between them. Firefox does not trigger COMPLETED and only trigger CONNECTED\n Metrics.postEvent({event: eventType.ICE_END, meeting});\n Metrics.sendBehavioralMetric(\n BEHAVIORAL_METRICS.CONNECTION_SUCCESS,\n {\n correlation_id: meeting.correlationId,\n locus_id: meeting.locusId\n }\n );\n meeting.setNetworkStatus(NETWORK_STATUS.CONNECTED);\n meeting.reconnectionManager.iceReconnected();\n LoggerProxy.logger.info('PeerConnectionManager:index#setPeerConnectionEvents --> ICE STATE CONNECTED.');\n break;\n case ICE_STATE.CLOSED:\n LoggerProxy.logger.info('PeerConnectionManager:index#setPeerConnectionEvents --> ICE STATE CLOSED.');\n break;\n case ICE_STATE.DISCONNECTED:\n meeting.setNetworkStatus(NETWORK_STATUS.DISCONNECTED);\n meeting.reconnectionManager.waitForIceReconnect()\n .catch(() => {\n LoggerProxy.logger.info('PeerConnectionManager:index#setPeerConnectionEvents --> ICE STATE DISCONNECTED. Automatic Reconnection Timed Out.');\n\n connectionFailed();\n });\n LoggerProxy.logger.info('PeerConnectionManager:index#setPeerConnectionEvents --> ICE STATE DISCONNECTED.');\n break;\n case ICE_STATE.FAILED:\n LoggerProxy.logger.info('PeerConnectionManager:index#setPeerConnectionEvents --> ICE STATE FAILED.');\n // notify of ice failure\n // Ice failure is the only indicator currently for identifying the actual connection drop\n // Firefox takes sometime 10-15 seconds to go to failed state\n connectionFailed();\n break;\n default:\n break;\n }\n };\n\n peerConnection.onconnectionstatechange = () => {\n LoggerProxy.logger.info('PeerConnectionManager:index#setPeerConnectionEvents --> CONNECTION STATE CHANGE.');\n switch (peerConnection.connectionState) {\n case CONNECTION_STATE.NEW:\n LoggerProxy.logger.info('PeerConnectionManager:index#setPeerConnectionEvents --> CONNECTION STATE NEW.');\n break;\n case CONNECTION_STATE.CONNECTING:\n LoggerProxy.logger.info('PeerConnectionManager:index#setPeerConnectionEvents --> CONNECTION STATE CONNECTING.');\n break;\n case CONNECTION_STATE.CONNECTED:\n LoggerProxy.logger.info('PeerConnectionManager:index#setPeerConnectionEvents --> CONNECTION STATE CONNECTED.');\n break;\n case CONNECTION_STATE.CLOSED:\n LoggerProxy.logger.info('PeerConnectionManager:index#setPeerConnectionEvents --> CONNECTION STATE CLOSED.');\n break;\n case CONNECTION_STATE.DISCONNECTED:\n LoggerProxy.logger.info('PeerConnectionManager:index#setPeerConnectionEvents --> CONNECTION STATE DISCONNECTED.');\n break;\n case CONNECTION_STATE.FAILED:\n LoggerProxy.logger.info('PeerConnectionManager:index#setPeerConnectionEvents --> CONNECTION STATE FAILED.');\n // Special case happens only on chrome where there is no ICE FAILED event\n // only CONNECTION FAILED event gets triggered\n\n connectionFailed();\n break;\n default:\n break;\n }\n };\n};\n\nexport default pc;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAKA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AAaA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;;;;;;;AAEA,wBAAoB,IAAAA,yBAAA,GAApB;AAAA,IAAOC,SAAP,qBAAOA,SAAP;AAEA;AACA;AACA;AACA;;;AACA,IAAMC,EAAE,GAAG,EAAX;AAEA;AACA;AACA;AACA;AACA;AACA;;AACA,IAAMC,oBAAoB,GAAG,SAAvBA,oBAAuB,CAACC,QAAD,EAAWC,KAAX,EAAqB;EAChD;EACA;EACA,IAAIC,KAAJ;EACA,IAAIC,gBAAgB,GAAG,EAAvB;;EAEA,IAAIH,QAAQ,CAACC,KAAD,CAAR,CAAgBG,MAAhB,CAAuBC,gBAAvB,MAAkC,CAAC,CAAvC,EAA0C;IACxCH,KAAK,GAAGI,eAAA,CAAaC,QAAb,CAAsBC,SAAtB,CAAgCC,KAAxC;EACD,CAFD,MAGK;IACHP,KAAK,GAAGI,eAAA,CAAaC,QAAb,CAAsBC,SAAtB,CAAgCE,KAAxC;IACAP,gBAAgB,GAAGQ,cAAA,CAAIC,iBAAvB;IACAZ,QAAQ,CAACa,MAAT,CAAgBZ,KAAK,GAAG,CAAxB,EAA2B,CAA3B,EAA8BE,gBAA9B;EACD;;EACDH,QAAQ,CAACa,MAAT,CAAgBZ,KAAK,GAAG,CAAxB,EAA2B,CAA3B,YAAiCU,cAAA,CAAIG,MAArC,cAA+CZ,KAA/C;EAEA,OAAOF,QAAP;AACD,CAjBD;AAmBA;AACA;AACA;AACA;AACA;AACA;;;A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hDD;;EAkDAjG,cAAc,CAAC6H,uBAAf,GAAyC,YAAM;IAC7ChJ,oBAAA,CAAYC,MAAZ,CAAmBiI,IAAnB,CAAwB,kFAAxB;;IACA,QAAQ/G,cAAc,CAAC2F,eAAvB;MACE,KAAKmC,2BAAA,CAAiBC,GAAtB;QACElJ,oBAAA,CAAYC,MAAZ,CAAmBiI,IAAnB,CAAwB,+EAAxB;;QACA;;MACF,KAAKe,2BAAA,CAAiBE,UAAtB;QACEnJ,oBAAA,CAAYC,MAAZ,CAAmBiI,IAAnB,CAAwB,sFAAxB;;QACA;;MACF,KAAKe,2BAAA,CAAiBT,SAAtB;QACExI,oBAAA,CAAYC,MAAZ,CAAmBiI,IAAnB,CAAwB,qFAAxB;;QACA;;MACF,KAAKe,2BAAA,CAAiBjC,MAAtB;QACEhH,oBAAA,CAAYC,MAAZ,CAAmBiI,IAAnB,CAAwB,kFAAxB;;QACA;;MACF,KAAKe,2BAAA,CAAiBJ,YAAtB;QACE7I,oBAAA,CAAYC,MAAZ,CAAmBiI,IAAnB,CAAwB,wFAAxB;;QACA;;MACF,KAAKe,2BAAA,CAAiBF,MAAtB;QACE/I,oBAAA,CAAYC,MAAZ,CAAmBiI,IAAnB,CAAwB,kFAAxB,EADF,CAEE;QACA;;;QAEAd,gBAAgB;QAChB;;MACF;QACE;IAxBJ;EA0BD,CA5BD;AA6BD,CArHD;;eAuHehK,E"}
|
|
@@ -2,16 +2,48 @@
|
|
|
2
2
|
|
|
3
3
|
var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
|
|
4
4
|
|
|
5
|
+
var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
|
|
6
|
+
|
|
5
7
|
_Object$defineProperty(exports, "__esModule", {
|
|
6
8
|
value: true
|
|
7
9
|
});
|
|
8
10
|
|
|
9
11
|
exports.default = void 0;
|
|
10
|
-
|
|
12
|
+
|
|
13
|
+
var _parseInt2 = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/parse-int"));
|
|
14
|
+
|
|
15
|
+
var _keys = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/keys"));
|
|
16
|
+
|
|
17
|
+
var _tsSdp = require("@webex/ts-sdp");
|
|
18
|
+
|
|
19
|
+
var PeerConnectionUtils = {}; // max-fs values for all H264 profile levels
|
|
20
|
+
|
|
21
|
+
var maxFsForProfileLevel = {
|
|
22
|
+
10: 99,
|
|
23
|
+
11: 396,
|
|
24
|
+
12: 396,
|
|
25
|
+
13: 396,
|
|
26
|
+
20: 396,
|
|
27
|
+
21: 792,
|
|
28
|
+
22: 1620,
|
|
29
|
+
30: 1620,
|
|
30
|
+
31: 3600,
|
|
31
|
+
32: 5120,
|
|
32
|
+
40: 8192,
|
|
33
|
+
41: 8192,
|
|
34
|
+
42: 8704,
|
|
35
|
+
50: 22080,
|
|
36
|
+
51: 36864,
|
|
37
|
+
52: 36864,
|
|
38
|
+
60: 139264,
|
|
39
|
+
61: 139264,
|
|
40
|
+
62: 139264
|
|
41
|
+
};
|
|
42
|
+
var framesPerSecond = 30;
|
|
11
43
|
/**
|
|
12
44
|
* Convert C line to IPv4
|
|
13
|
-
* @param {
|
|
14
|
-
* @returns {
|
|
45
|
+
* @param {string} sdp
|
|
46
|
+
* @returns {string}
|
|
15
47
|
*/
|
|
16
48
|
|
|
17
49
|
PeerConnectionUtils.convertCLineToIpv4 = function (sdp) {
|
|
@@ -22,6 +54,70 @@ PeerConnectionUtils.convertCLineToIpv4 = function (sdp) {
|
|
|
22
54
|
replaceSdp = replaceSdp.replace(/c=IN IP6 .*/gi, 'c=IN IP4 0.0.0.0');
|
|
23
55
|
return replaceSdp;
|
|
24
56
|
};
|
|
57
|
+
/**
|
|
58
|
+
* estimate profile levels for max-fs & max-mbps values
|
|
59
|
+
* @param {string} sdp
|
|
60
|
+
* @param {number} maxFsValue
|
|
61
|
+
* @returns {string}
|
|
62
|
+
*/
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
PeerConnectionUtils.adjustH264Profile = function (sdp, maxFsValue) {
|
|
66
|
+
// converting with ts-sdp parser, no munging
|
|
67
|
+
var parsedSdp = (0, _tsSdp.parse)(sdp);
|
|
68
|
+
parsedSdp.avMedia.forEach(function (media) {
|
|
69
|
+
if (media.type === 'video') {
|
|
70
|
+
media.codecs.forEach(function (codec) {
|
|
71
|
+
var _codec$name;
|
|
72
|
+
|
|
73
|
+
if (((_codec$name = codec.name) === null || _codec$name === void 0 ? void 0 : _codec$name.toUpperCase()) === 'H264') {
|
|
74
|
+
// there should really be just 1 fmtp line, but just in case, we process all of them
|
|
75
|
+
codec.fmtParams = codec.fmtParams.map(function (fmtp) {
|
|
76
|
+
var parsedRegex = fmtp.match(/(.*)profile-level-id=(\w{4})(\w{2})(.*)/);
|
|
77
|
+
|
|
78
|
+
if (parsedRegex && parsedRegex.length === 5) {
|
|
79
|
+
var stuffBeforeProfileLevelId = parsedRegex[1];
|
|
80
|
+
var profile = parsedRegex[2].toLowerCase();
|
|
81
|
+
var levelId = (0, _parseInt2.default)(parsedRegex[3], 16);
|
|
82
|
+
var stuffAfterProfileLevelId = parsedRegex[4];
|
|
83
|
+
|
|
84
|
+
if (!maxFsForProfileLevel[levelId]) {
|
|
85
|
+
throw new Error("found unsupported h264 profile level id value in the SDP: ".concat(levelId));
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if (maxFsForProfileLevel[levelId] === maxFsValue) {
|
|
89
|
+
// profile level already matches our desired max-fs value, so we don't need to do anything
|
|
90
|
+
return fmtp;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
if (maxFsForProfileLevel[levelId] < maxFsValue) {
|
|
94
|
+
// profile level has too low max-fs, so we need to override it (this is upgrading)
|
|
95
|
+
return "".concat(fmtp, ";max-fs=").concat(maxFsValue, ";max-mbps=").concat(maxFsValue * framesPerSecond);
|
|
96
|
+
} // profile level has too high max-fs value, so we need to use a lower level
|
|
97
|
+
// find highest level that has the matching maxFs
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
var newLevelId = (0, _keys.default)(maxFsForProfileLevel).reverse().find(function (key) {
|
|
101
|
+
return maxFsForProfileLevel[key] === maxFsValue;
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
if (newLevelId) {
|
|
105
|
+
// Object.keys returns keys as strings, so we need to parse it to an int again and then convert to hex
|
|
106
|
+
var newLevelIdHex = (0, _parseInt2.default)(newLevelId, 10).toString(16);
|
|
107
|
+
return "".concat(stuffBeforeProfileLevelId, "profile-level-id=").concat(profile).concat(newLevelIdHex, ";max-mbps=").concat(maxFsValue * framesPerSecond).concat(stuffAfterProfileLevelId);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
throw new Error("unsupported maxFsValue: ".concat(maxFsValue));
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
return fmtp;
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
return parsedSdp.toString();
|
|
120
|
+
};
|
|
25
121
|
|
|
26
122
|
var _default = PeerConnectionUtils;
|
|
27
123
|
exports.default = _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["PeerConnectionUtils","convertCLineToIpv4","sdp","replaceSdp","replace"],"sources":["util.
|
|
1
|
+
{"version":3,"names":["PeerConnectionUtils","maxFsForProfileLevel","framesPerSecond","convertCLineToIpv4","sdp","replaceSdp","replace","adjustH264Profile","maxFsValue","parsedSdp","parse","avMedia","forEach","media","type","codecs","codec","name","toUpperCase","fmtParams","map","fmtp","parsedRegex","match","length","stuffBeforeProfileLevelId","profile","toLowerCase","levelId","stuffAfterProfileLevelId","Error","newLevelId","reverse","find","key","newLevelIdHex","toString"],"sources":["util.ts"],"sourcesContent":["import { parse } from '@webex/ts-sdp';\n\ninterface IPeerConnectionUtils {\n convertCLineToIpv4: (sdp: string) => string;\n adjustH264Profile: (sdp: string, maxFsValue: number) => string;\n}\n\nconst PeerConnectionUtils = {} as IPeerConnectionUtils;\n\n// max-fs values for all H264 profile levels\nconst maxFsForProfileLevel = {\n 10: 99,\n 11: 396,\n 12: 396,\n 13: 396,\n 20: 396,\n 21: 792,\n 22: 1620,\n 30: 1620,\n 31: 3600,\n 32: 5120,\n 40: 8192,\n 41: 8192,\n 42: 8704,\n 50: 22080,\n 51: 36864,\n 52: 36864,\n 60: 139264,\n 61: 139264,\n 62: 139264,\n};\n\nconst framesPerSecond = 30;\n\n/**\n * Convert C line to IPv4\n * @param {string} sdp\n * @returns {string}\n */\nPeerConnectionUtils.convertCLineToIpv4 = (sdp: string) => {\n let replaceSdp = sdp;\n\n // TODO: remove this once linus supports Ipv6 c line.currently linus rejects SDP with c line having ipv6 candidates we are\n // mocking ipv6 to ipv4 candidates\n // https://jira-eng-gpk2.cisco.com/jira/browse/SPARK-299232\n replaceSdp = replaceSdp.replace(/c=IN IP6 .*/gi, 'c=IN IP4 0.0.0.0');\n\n return replaceSdp;\n};\n\n/**\n * estimate profile levels for max-fs & max-mbps values\n * @param {string} sdp\n * @param {number} maxFsValue\n * @returns {string}\n */\nPeerConnectionUtils.adjustH264Profile = (sdp: string, maxFsValue: number) => {\n // converting with ts-sdp parser, no munging\n const parsedSdp = parse(sdp);\n\n parsedSdp.avMedia.forEach((media) => {\n if (media.type === 'video') {\n media.codecs.forEach((codec) => {\n if (codec.name?.toUpperCase() === 'H264') {\n // there should really be just 1 fmtp line, but just in case, we process all of them\n codec.fmtParams = codec.fmtParams.map((fmtp) => {\n const parsedRegex = fmtp.match(/(.*)profile-level-id=(\\w{4})(\\w{2})(.*)/);\n\n if (parsedRegex && parsedRegex.length === 5) {\n const stuffBeforeProfileLevelId = parsedRegex[1];\n const profile = parsedRegex[2].toLowerCase();\n const levelId = parseInt(parsedRegex[3], 16);\n const stuffAfterProfileLevelId = parsedRegex[4];\n\n if (!maxFsForProfileLevel[levelId]) {\n throw new Error(\n `found unsupported h264 profile level id value in the SDP: ${levelId}`\n );\n }\n\n if (maxFsForProfileLevel[levelId] === maxFsValue) {\n // profile level already matches our desired max-fs value, so we don't need to do anything\n return fmtp;\n }\n if (maxFsForProfileLevel[levelId] < maxFsValue) {\n // profile level has too low max-fs, so we need to override it (this is upgrading)\n return `${fmtp};max-fs=${maxFsValue};max-mbps=${maxFsValue * framesPerSecond}`;\n }\n\n // profile level has too high max-fs value, so we need to use a lower level\n\n // find highest level that has the matching maxFs\n const newLevelId = Object.keys(maxFsForProfileLevel)\n .reverse()\n .find((key) => maxFsForProfileLevel[key] === maxFsValue);\n\n if (newLevelId) {\n // Object.keys returns keys as strings, so we need to parse it to an int again and then convert to hex\n const newLevelIdHex = parseInt(newLevelId, 10).toString(16);\n\n return `${stuffBeforeProfileLevelId}profile-level-id=${profile}${newLevelIdHex};max-mbps=${maxFsValue * framesPerSecond}${stuffAfterProfileLevelId}`;\n }\n\n throw new Error(`unsupported maxFsValue: ${maxFsValue}`);\n }\n\n return fmtp;\n });\n }\n });\n }\n });\n\n return parsedSdp.toString();\n};\n\nexport default PeerConnectionUtils;\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;;AAOA,IAAMA,mBAAmB,GAAG,EAA5B,C,CAEA;;AACA,IAAMC,oBAAoB,GAAG;EAC3B,IAAI,EADuB;EAE3B,IAAI,GAFuB;EAG3B,IAAI,GAHuB;EAI3B,IAAI,GAJuB;EAK3B,IAAI,GALuB;EAM3B,IAAI,GANuB;EAO3B,IAAI,IAPuB;EAQ3B,IAAI,IARuB;EAS3B,IAAI,IATuB;EAU3B,IAAI,IAVuB;EAW3B,IAAI,IAXuB;EAY3B,IAAI,IAZuB;EAa3B,IAAI,IAbuB;EAc3B,IAAI,KAduB;EAe3B,IAAI,KAfuB;EAgB3B,IAAI,KAhBuB;EAiB3B,IAAI,MAjBuB;EAkB3B,IAAI,MAlBuB;EAmB3B,IAAI;AAnBuB,CAA7B;AAsBA,IAAMC,eAAe,GAAG,EAAxB;AAEA;AACA;AACA;AACA;AACA;;AACAF,mBAAmB,CAACG,kBAApB,GAAyC,UAAC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2B,OAAD,CAApB,KAAkCpB,UAAtC,EAAkD;gBAChD;gBACA,OAAOa,IAAP;cACD;;cACD,IAAIpB,oBAAoB,CAAC2B,OAAD,CAApB,GAAgCpB,UAApC,EAAgD;gBAC9C;gBACA,iBAAUa,IAAV,qBAAyBb,UAAzB,uBAAgDA,UAAU,GAAGN,eAA7D;cACD,CAnB0C,CAqB3C;cAEA;;;cACA,IAAM6B,UAAU,GAAG,mBAAY9B,oBAAZ,EAChB+B,OADgB,GAEhBC,IAFgB,CAEX,UAACC,GAAD;gBAAA,OAASjC,oBAAoB,CAACiC,GAAD,CAApB,KAA8B1B,UAAvC;cAAA,CAFW,CAAnB;;cAIA,IAAIuB,UAAJ,EAAgB;gBACd;gBACA,IAAMI,aAAa,GAAG,wBAASJ,UAAT,EAAqB,EAArB,EAAyBK,QAAzB,CAAkC,EAAlC,CAAtB;gBAEA,iBAAUX,yBAAV,8BAAuDC,OAAvD,SAAiES,aAAjE,uBAA2F3B,UAAU,GAAGN,eAAxG,SAA0H2B,wBAA1H;cACD;;cAED,MAAM,IAAIC,KAAJ,mCAAqCtB,UAArC,EAAN;YACD;;YAED,OAAOa,IAAP;UACD,CA1CiB,CAAlB;QA2CD;MACF,CA/CD;IAgDD;EACF,CAnDD;EAqDA,OAAOZ,SAAS,CAAC2B,QAAV,EAAP;AACD,CA1DD;;eA4DepC,mB"}
|
|
@@ -14,6 +14,8 @@ var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs2/regene
|
|
|
14
14
|
|
|
15
15
|
var _stringify = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/json/stringify"));
|
|
16
16
|
|
|
17
|
+
var _values = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/values"));
|
|
18
|
+
|
|
17
19
|
var _now = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/date/now"));
|
|
18
20
|
|
|
19
21
|
var _keys = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/keys"));
|
|
@@ -149,6 +151,34 @@ var Reachability = /*#__PURE__*/function () {
|
|
|
149
151
|
|
|
150
152
|
return gatherReachability;
|
|
151
153
|
}()
|
|
154
|
+
/**
|
|
155
|
+
* fetches reachability data and checks for cluster reachability
|
|
156
|
+
* @returns {boolean}
|
|
157
|
+
* @public
|
|
158
|
+
* @memberof Reachability
|
|
159
|
+
*/
|
|
160
|
+
|
|
161
|
+
}, {
|
|
162
|
+
key: "isAnyClusterReachable",
|
|
163
|
+
value: function isAnyClusterReachable() {
|
|
164
|
+
var reachable = false;
|
|
165
|
+
var reachabilityData = window.localStorage.getItem(_constants.REACHABILITY.localStorage);
|
|
166
|
+
|
|
167
|
+
if (reachabilityData) {
|
|
168
|
+
try {
|
|
169
|
+
var reachabilityResults = JSON.parse(reachabilityData);
|
|
170
|
+
reachable = (0, _values.default)(reachabilityResults).some(function (result) {
|
|
171
|
+
var _result$udp, _result$tcp;
|
|
172
|
+
|
|
173
|
+
return ((_result$udp = result.udp) === null || _result$udp === void 0 ? void 0 : _result$udp.reachable) === 'true' || ((_result$tcp = result.tcp) === null || _result$tcp === void 0 ? void 0 : _result$tcp.reachable) === 'true';
|
|
174
|
+
});
|
|
175
|
+
} catch (e) {
|
|
176
|
+
_loggerProxy.default.logger.error("Roap:request#attachReachabilityData --> Error in parsing reachability data: ".concat(e));
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
return reachable;
|
|
181
|
+
}
|
|
152
182
|
/**
|
|
153
183
|
* Generate peerConnection config settings
|
|
154
184
|
* @param {object} cluster
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["DEFAULT_TIMEOUT","VIDEO_MESH_TIMEOUT","Reachability","webex","reachabilityRequest","ReachabilityRequest","clusterLatencyResults","setup","window","localStorage","removeItem","REACHABILITY","LoggerProxy","logger","error","getClusters","clusters","performReachabilityCheck","results","setItem","log","cluster","iceServers","udp","tcp","map","url","username","credential","urls","iceCandidatePoolSize","iceTransportPolicy","key","config","peerConnection","RTCPeerConnection","peerConnectionError","startTime","begin","clusterList","buildPeerConnectionConfig","createPeerConnection","createOffer","offerToReceiveAudio","description","setLocalDescription","iceGatheringState","isVideoMesh","catch","iceGatheringStateError","all","then","parseIceResultsToReachabilityResults","reachabilityLatencyResults","logUnreachableClusters","unreachableList","forEach","unreachable","reachable","push","onicegatheringstatechange","COMPLETE","ICE_GATHERING_STATE","iceConnectionState","elapsed","getElapsedTime","setLatencyAndClose","onicecandidate","e","SERVER_REFLEXIVE","candidate","String","type","toLowerCase","timeout","ELAPSED","resolve","peerConnectionProxy","Proxy","get","target","property","targetMember","bind","set","value","clusterId","Reflect","handleIceGatheringStateChange","handleOnIceCandidate","setTimeout","CLOSED","CONNECTION_STATE","connectionState","list","getUnreachablClusters","iceResults","reachabilityMap","latencyResult","latencyInMilliseconds","toString","length","getLocalSDPForClusters","localSDPData","REACHABLE","UNREACHABLE","resultKey","intialState","close"],"sources":["index.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\n/* eslint-disable class-methods-use-this */\n/* globals window */\nimport _ from 'lodash';\n\nimport LoggerProxy from '../common/logs/logger-proxy';\nimport {\n ICE_GATHERING_STATE,\n CONNECTION_STATE,\n REACHABILITY\n} from '../constants';\n\nimport ReachabilityRequest from './request';\n\nconst DEFAULT_TIMEOUT = 3000;\nconst VIDEO_MESH_TIMEOUT = 1000;\n\n/**\n * @class Reachability\n * @export\n */\nexport default class Reachability {\n /**\n * Creates an instance of Reachability.\n * @param {object} webex\n * @memberof Reachability\n */\n constructor(webex) {\n this.webex = webex;\n\n /**\n * internal request object for the server\n * @instance\n * @type {Array}\n * @private\n * @memberof Reachability\n */\n this.reachabilityRequest = new ReachabilityRequest(this.webex);\n\n /**\n * internal object of clusters latency results\n * @instance\n * @type {object}\n * @private\n * @memberof Reachability\n */\n this.clusterLatencyResults = {};\n }\n\n\n /**\n * fetches reachability data\n * @returns {Object} reachability data\n * @public\n * @async\n * @memberof Reachability\n */\n async gatherReachability() {\n this.setup();\n\n // Remove stored reachability results to ensure no stale data\n if (window?.localStorage?.removeItem) {\n window.localStorage.removeItem(REACHABILITY.localStorage);\n }\n else {\n LoggerProxy.logger.error('Reachability:index#gatherReachability --> Error in accessing LocalStorage.');\n\n return {};\n }\n\n // Fetch clusters and measure latency\n try {\n const clusters = await this.reachabilityRequest.getClusters();\n\n // Perform Reachability Check\n const results = await this.performReachabilityCheck(clusters);\n\n window.localStorage.setItem(REACHABILITY.localStorage, JSON.stringify(results));\n\n LoggerProxy.logger.log('Reachability:index#gatherReachability --> Reachability checks completed');\n\n return results;\n }\n catch (getClusterError) {\n LoggerProxy.logger.error(`Reachability:index#gatherReachability --> Error in calling getClusters(): ${getClusterError}`);\n\n return {};\n }\n }\n\n\n /**\n * Generate peerConnection config settings\n * @param {object} cluster\n * @returns {object} peerConnectionConfig\n * @private\n * @memberof Reachability\n */\n buildPeerConnectionConfig(cluster) {\n const iceServers = _.uniq([\n ...cluster.udp,\n ...cluster.tcp\n ]).map((url) => ({\n username: '',\n credential: '',\n urls: [url]\n }));\n\n return {\n iceServers: [\n ...iceServers\n ],\n iceCandidatePoolSize: '0',\n iceTransportPolicy: 'all'\n };\n }\n\n\n /**\n * Creates an RTCPeerConnection\n * @param {object} cluster\n * @returns {RTCPeerConnection} peerConnection\n * @private\n * @memberof Reachability\n */\n createPeerConnection(cluster) {\n const {key, config} = cluster;\n\n try {\n const peerConnection = new window.RTCPeerConnection(config);\n\n peerConnection.key = key;\n\n return peerConnection;\n }\n catch (peerConnectionError) {\n LoggerProxy.logger.log(`Reachability:index#createPeerConnection --> Error creating peerConnection: ${peerConnectionError}`);\n\n return null;\n }\n }\n\n\n /**\n * Gets total elapsed time\n * @param {RTCPeerConnection} peerConnection\n * @returns {Number} Milliseconds\n * @private\n * @memberof Reachability\n */\n getElapsedTime(peerConnection) {\n const startTime = peerConnection.begin;\n\n delete peerConnection.begin;\n\n return Date.now() - startTime;\n }\n\n\n /**\n * creates offer and generates localSDP\n * @param {object} clusterList cluster List\n * @returns {Promise} Reachability latency results\n * @private\n * @memberof Reachability\n */\n getLocalSDPForClusters(clusterList) {\n let clusters = [...Object.keys(clusterList)];\n\n clusters = clusters.map(async (key) => {\n const cluster = clusterList[key];\n const config = this.buildPeerConnectionConfig(cluster);\n const peerConnection = this.createPeerConnection({key, config});\n const description = await peerConnection.createOffer({offerToReceiveAudio: true});\n\n peerConnection.begin = Date.now();\n peerConnection.setLocalDescription(description);\n\n return this.iceGatheringState(peerConnection, cluster.isVideoMesh ? VIDEO_MESH_TIMEOUT : DEFAULT_TIMEOUT)\n .catch((iceGatheringStateError) => {\n LoggerProxy.logger.log(`Reachability:index#getLocalSDPForClusters --> Error in getLocalSDP : ${iceGatheringStateError}`);\n });\n });\n\n return Promise.all(clusters)\n .then(this.parseIceResultsToReachabilityResults)\n .then((reachabilityLatencyResults) => {\n this.logUnreachableClusters();\n\n // return results\n return reachabilityLatencyResults;\n });\n }\n\n\n /**\n * Get list of all unreachable clusters\n * @returns {array} Unreachable clusters\n * @private\n * @memberof Reachability\n */\n getUnreachablClusters() {\n const unreachableList = [];\n const clusters = this.clusterLatencyResults;\n\n Object.keys(clusters).forEach((key) => {\n const cluster = clusters[key];\n\n if (cluster.unreachable && !cluster.reachable) {\n unreachableList.push(key);\n }\n });\n\n return unreachableList;\n }\n\n\n /**\n * Attach an event handler for the icegatheringstatechange\n * event and measure latency.\n * @param {RTCPeerConnection} peerConnection\n * @returns {undefined}\n * @private\n * @memberof Reachability\n */\n handleIceGatheringStateChange(peerConnection) {\n peerConnection.onicegatheringstatechange = () => {\n const {COMPLETE} = ICE_GATHERING_STATE;\n\n if (peerConnection.iceConnectionState === COMPLETE) {\n const elapsed = this.getElapsedTime(peerConnection);\n\n LoggerProxy.logger.log(`Reachability:index#onIceGatheringStateChange --> Successfully pinged ${peerConnection.key}:`, elapsed);\n this.setLatencyAndClose(peerConnection, elapsed);\n }\n };\n }\n\n\n /**\n * Attach an event handler for the icecandidate\n * event and measure latency.\n * @param {RTCPeerConnection} peerConnection\n * @returns {undefined}\n * @private\n * @memberof Reachability\n */\n handleOnIceCandidate(peerConnection) {\n peerConnection.onicecandidate = (e) => {\n const SERVER_REFLEXIVE = 'srflx';\n\n if (e.candidate && String(e.candidate.type).toLowerCase() === SERVER_REFLEXIVE) {\n const elapsed = this.getElapsedTime(peerConnection);\n\n LoggerProxy.logger.log(`Reachability:index#onIceCandidate --> Successfully pinged ${peerConnection.key}:`, elapsed);\n this.setLatencyAndClose(peerConnection, elapsed);\n }\n };\n }\n\n /**\n * An event handler on an RTCPeerConnection when the state of the ICE\n * candidate gathering process changes. Used to measure connection\n * speed.\n * @private\n * @param {RTCPeerConnection} peerConnection\n * @param {number} timeout\n * @returns {Promise}\n */\n iceGatheringState(peerConnection, timeout) {\n const ELAPSED = 'elapsed';\n\n return new Promise((resolve) => {\n const peerConnectionProxy = new window.Proxy(peerConnection, {\n get(target, property) {\n const targetMember = target[property];\n\n if (typeof (targetMember) === 'function') {\n return targetMember.bind(target);\n }\n\n return targetMember;\n },\n set: (target, property, value) => {\n // only intercept elapsed property\n if (property === ELAPSED) {\n resolve({clusterId: peerConnection.key, elapsed: value});\n\n return true;\n }\n\n // pass thru\n return window.Reflect.set(target, property, value);\n }\n });\n\n // Using peerConnection proxy so handle functions below\n // won't be coupled to our promise implementation\n this.handleIceGatheringStateChange(peerConnectionProxy);\n this.handleOnIceCandidate(peerConnectionProxy);\n\n // Set maximum timeout\n window.setTimeout(() => {\n const {CLOSED} = CONNECTION_STATE;\n\n // Close any open peerConnections\n if (peerConnectionProxy.connectionState !== CLOSED) {\n this.setLatencyAndClose(peerConnectionProxy, null);\n }\n }, timeout);\n });\n }\n\n\n /**\n * Make a log of unreachable clusters.\n * @returns {undefined}\n * @private\n * @memberof Reachability\n */\n logUnreachableClusters() {\n const list = this.getUnreachablClusters();\n\n list.forEach((cluster) => {\n LoggerProxy.logger.log(`Reachability:index#logUnreachableClusters --> No ice candidate for ${cluster}.`);\n });\n }\n\n\n /**\n * Calculates time to establish connection\n * @param {array} iceResults iceResults\n * @returns {object} reachabilityMap\n * @private\n * @memberof Reachability\n */\n parseIceResultsToReachabilityResults(iceResults) {\n const reachabilityMap = {};\n\n iceResults.forEach(({clusterId, elapsed}) => {\n let latencyResult;\n\n if (elapsed === null) {\n latencyResult = {reachable: 'false'};\n }\n else {\n latencyResult = {\n reachable: 'true',\n latencyInMilliseconds: (elapsed).toString()\n };\n }\n\n reachabilityMap[clusterId] = {\n udp: latencyResult,\n tcp: latencyResult\n };\n });\n\n return reachabilityMap;\n }\n\n\n /**\n * fetches reachability data\n * @param {object} clusterList\n * @returns {Promise<localSDPData>} reachability check results\n * @private\n * @memberof Reachability\n */\n performReachabilityCheck(clusterList) {\n if (!clusterList || !Object.keys(clusterList).length) {\n return Promise.resolve({});\n }\n\n return new Promise((resolve) => {\n this.getLocalSDPForClusters(clusterList)\n .then((localSDPData) => {\n if (!localSDPData || !Object.keys(localSDPData).length) {\n // TODO: handle the error condition properly and try retry\n LoggerProxy.logger.log('Reachability:index#performReachabilityCheck --> Local SDP is empty or has missing elements..returning');\n resolve({});\n }\n else {\n resolve(localSDPData);\n }\n })\n .catch((error) => {\n LoggerProxy.logger.error(`Reachability:index#performReachabilityCheck --> Error in getLocalSDPForClusters: ${error}`);\n resolve({});\n });\n });\n }\n\n\n /**\n * Records latency and closes the peerConnection\n * @param {RTCPeerConnection} peerConnection\n * @param {number} elapsed Latency in milliseconds\n * @returns {undefined}\n * @private\n * @memberof Reachability\n */\n setLatencyAndClose(peerConnection, elapsed) {\n const REACHABLE = 'reachable';\n const UNREACHABLE = 'unreachable';\n const {CLOSED} = CONNECTION_STATE;\n const {key} = peerConnection;\n const resultKey = elapsed === null ? UNREACHABLE : REACHABLE;\n const intialState = {[REACHABLE]: 0, [UNREACHABLE]: 0};\n\n if (peerConnection.connectionState === CLOSED) {\n LoggerProxy.logger.log(`Reachability:index#setLatencyAndClose --> Attempting to set latency of ${elapsed} on closed peerConnection.`);\n\n return;\n }\n\n this.clusterLatencyResults[key] = this.clusterLatencyResults[key] || intialState;\n this.clusterLatencyResults[key][resultKey] += 1;\n\n // Set to null in case this fired from\n // an event other than onIceCandidate\n peerConnection.onicecandidate = null;\n peerConnection.close();\n peerConnection.elapsed = elapsed;\n }\n\n\n /**\n * utility function\n * @returns {undefined}\n * @private\n * @memberof Reachability\n */\n setup() {\n this.clusterLatencyResults = {};\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA;;AACA;;AAMA;;AAEA,IAAMA,eAAe,GAAG,IAAxB;AACA,IAAMC,kBAAkB,GAAG,IAA3B;AAEA;AACA;AACA;AACA;;IACqBC,Y;EACnB;AACF;AACA;AACA;AACA;EACE,sBAAYC,KAAZ,EAAmB;IAAA;IACjB,KAAKA,KAAL,GAAaA,KAAb;IAEA;AACJ;AACA;AACA;AACA;AACA;AACA;;IACI,KAAKC,mBAAL,GAA2B,IAAIC,gBAAJ,CAAwB,KAAKF,KAA7B,CAA3B;IAEA;AACJ;AACA;AACA;AACA;AACA;AACA;;IACI,KAAKG,qBAAL,GAA6B,EAA7B;EACD;EAGD;AACF;AACA;AACA;AACA;AACA;AACA;;;;;;wGACE;QAAA;;QAAA;QAAA;UAAA;YAAA;cAAA;gBACE,KAAKC,KAAL,GADF,CAGE;;gBAHF,iBAIMC,MAJN,4DAIM,QAAQC,YAJd,iDAIM,qBAAsBC,UAJ5B;kBAAA;kBAAA;gBAAA;;gBAKIF,MAAM,CAACC,YAAP,CAAoBC,UAApB,CAA+BC,uBAAA,CAAaF,YAA5C;gBALJ;gBAAA;;cAAA;gBAQIG,oBAAA,CAAYC,MAAZ,CAAmBC,KAAnB,CAAyB,4EAAzB;;gBARJ,iCAUW,EAVX;;cAAA;gBAAA;gBAAA;gBAAA,OAe2B,KAAKV,mBAAL,CAAyBW,WAAzB,EAf3B;;cAAA;gBAeUC,QAfV;gBAAA;gBAAA,OAkB0B,KAAKC,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OAAjG;;QAEA;MACD;;MAED,KAAK1D,qBAAL,CAA2B0B,GAA3B,IAAkC,KAAK1B,qBAAL,CAA2B0B,GAA3B,KAAmC2E,WAArE;MACA,KAAKrG,qBAAL,CAA2B0B,GAA3B,EAAgC0E,SAAhC,KAA8C,CAA9C,CAf0C,CAiB1C;MACA;;MACAxE,cAAc,CAACiC,cAAf,GAAgC,IAAhC;MACAjC,cAAc,CAAC0E,KAAf;MACA1E,cAAc,CAAC8B,OAAf,GAAyBA,OAAzB;IACD;IAGD;AACF;AACA;AACA;AACA;AACA;;;;WACE,iBAAQ;MACN,KAAK1D,qBAAL,GAA6B,EAA7B;IACD"}
|
|
1
|
+
{"version":3,"names":["DEFAULT_TIMEOUT","VIDEO_MESH_TIMEOUT","Reachability","webex","reachabilityRequest","ReachabilityRequest","clusterLatencyResults","setup","window","localStorage","removeItem","REACHABILITY","LoggerProxy","logger","error","getClusters","clusters","performReachabilityCheck","results","setItem","log","reachable","reachabilityData","getItem","reachabilityResults","JSON","parse","some","result","udp","tcp","e","cluster","iceServers","map","url","username","credential","urls","iceCandidatePoolSize","iceTransportPolicy","key","config","peerConnection","RTCPeerConnection","peerConnectionError","startTime","begin","clusterList","buildPeerConnectionConfig","createPeerConnection","createOffer","offerToReceiveAudio","description","setLocalDescription","iceGatheringState","isVideoMesh","catch","iceGatheringStateError","all","then","parseIceResultsToReachabilityResults","reachabilityLatencyResults","logUnreachableClusters","unreachableList","forEach","unreachable","push","onicegatheringstatechange","COMPLETE","ICE_GATHERING_STATE","iceConnectionState","elapsed","getElapsedTime","setLatencyAndClose","onicecandidate","SERVER_REFLEXIVE","candidate","String","type","toLowerCase","timeout","ELAPSED","resolve","peerConnectionProxy","Proxy","get","target","property","targetMember","bind","set","value","clusterId","Reflect","handleIceGatheringStateChange","handleOnIceCandidate","setTimeout","CLOSED","CONNECTION_STATE","connectionState","list","getUnreachablClusters","iceResults","reachabilityMap","latencyResult","latencyInMilliseconds","toString","length","getLocalSDPForClusters","localSDPData","REACHABLE","UNREACHABLE","resultKey","intialState","close"],"sources":["index.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\n/* eslint-disable class-methods-use-this */\n/* globals window */\nimport _ from 'lodash';\n\nimport LoggerProxy from '../common/logs/logger-proxy';\nimport {\n ICE_GATHERING_STATE,\n CONNECTION_STATE,\n REACHABILITY\n} from '../constants';\n\nimport ReachabilityRequest from './request';\n\nconst DEFAULT_TIMEOUT = 3000;\nconst VIDEO_MESH_TIMEOUT = 1000;\n\n/**\n * @class Reachability\n * @export\n */\nexport default class Reachability {\n /**\n * Creates an instance of Reachability.\n * @param {object} webex\n * @memberof Reachability\n */\n constructor(webex) {\n this.webex = webex;\n\n /**\n * internal request object for the server\n * @instance\n * @type {Array}\n * @private\n * @memberof Reachability\n */\n this.reachabilityRequest = new ReachabilityRequest(this.webex);\n\n /**\n * internal object of clusters latency results\n * @instance\n * @type {object}\n * @private\n * @memberof Reachability\n */\n this.clusterLatencyResults = {};\n }\n\n\n /**\n * fetches reachability data\n * @returns {Object} reachability data\n * @public\n * @async\n * @memberof Reachability\n */\n async gatherReachability() {\n this.setup();\n\n // Remove stored reachability results to ensure no stale data\n if (window?.localStorage?.removeItem) {\n window.localStorage.removeItem(REACHABILITY.localStorage);\n }\n else {\n LoggerProxy.logger.error('Reachability:index#gatherReachability --> Error in accessing LocalStorage.');\n\n return {};\n }\n\n // Fetch clusters and measure latency\n try {\n const clusters = await this.reachabilityRequest.getClusters();\n\n // Perform Reachability Check\n const results = await this.performReachabilityCheck(clusters);\n\n window.localStorage.setItem(REACHABILITY.localStorage, JSON.stringify(results));\n\n LoggerProxy.logger.log('Reachability:index#gatherReachability --> Reachability checks completed');\n\n return results;\n }\n catch (getClusterError) {\n LoggerProxy.logger.error(`Reachability:index#gatherReachability --> Error in calling getClusters(): ${getClusterError}`);\n\n return {};\n }\n }\n\n /**\n * fetches reachability data and checks for cluster reachability\n * @returns {boolean}\n * @public\n * @memberof Reachability\n */\n isAnyClusterReachable() {\n let reachable = false;\n const reachabilityData = window.localStorage.getItem(REACHABILITY.localStorage);\n\n if (reachabilityData) {\n try {\n const reachabilityResults = JSON.parse(reachabilityData);\n\n reachable = Object.values(reachabilityResults).some((result) => result.udp?.reachable === 'true' || result.tcp?.reachable === 'true');\n }\n catch (e) {\n LoggerProxy.logger.error(`Roap:request#attachReachabilityData --> Error in parsing reachability data: ${e}`);\n }\n }\n\n return reachable;\n }\n\n\n /**\n * Generate peerConnection config settings\n * @param {object} cluster\n * @returns {object} peerConnectionConfig\n * @private\n * @memberof Reachability\n */\n buildPeerConnectionConfig(cluster) {\n const iceServers = _.uniq([\n ...cluster.udp,\n ...cluster.tcp\n ]).map((url) => ({\n username: '',\n credential: '',\n urls: [url]\n }));\n\n return {\n iceServers: [\n ...iceServers\n ],\n iceCandidatePoolSize: '0',\n iceTransportPolicy: 'all'\n };\n }\n\n\n /**\n * Creates an RTCPeerConnection\n * @param {object} cluster\n * @returns {RTCPeerConnection} peerConnection\n * @private\n * @memberof Reachability\n */\n createPeerConnection(cluster) {\n const {key, config} = cluster;\n\n try {\n const peerConnection = new window.RTCPeerConnection(config);\n\n peerConnection.key = key;\n\n return peerConnection;\n }\n catch (peerConnectionError) {\n LoggerProxy.logger.log(`Reachability:index#createPeerConnection --> Error creating peerConnection: ${peerConnectionError}`);\n\n return null;\n }\n }\n\n\n /**\n * Gets total elapsed time\n * @param {RTCPeerConnection} peerConnection\n * @returns {Number} Milliseconds\n * @private\n * @memberof Reachability\n */\n getElapsedTime(peerConnection) {\n const startTime = peerConnection.begin;\n\n delete peerConnection.begin;\n\n return Date.now() - startTime;\n }\n\n\n /**\n * creates offer and generates localSDP\n * @param {object} clusterList cluster List\n * @returns {Promise} Reachability latency results\n * @private\n * @memberof Reachability\n */\n getLocalSDPForClusters(clusterList) {\n let clusters = [...Object.keys(clusterList)];\n\n clusters = clusters.map(async (key) => {\n const cluster = clusterList[key];\n const config = this.buildPeerConnectionConfig(cluster);\n const peerConnection = this.createPeerConnection({key, config});\n const description = await peerConnection.createOffer({offerToReceiveAudio: true});\n\n peerConnection.begin = Date.now();\n peerConnection.setLocalDescription(description);\n\n return this.iceGatheringState(peerConnection, cluster.isVideoMesh ? VIDEO_MESH_TIMEOUT : DEFAULT_TIMEOUT)\n .catch((iceGatheringStateError) => {\n LoggerProxy.logger.log(`Reachability:index#getLocalSDPForClusters --> Error in getLocalSDP : ${iceGatheringStateError}`);\n });\n });\n\n return Promise.all(clusters)\n .then(this.parseIceResultsToReachabilityResults)\n .then((reachabilityLatencyResults) => {\n this.logUnreachableClusters();\n\n // return results\n return reachabilityLatencyResults;\n });\n }\n\n\n /**\n * Get list of all unreachable clusters\n * @returns {array} Unreachable clusters\n * @private\n * @memberof Reachability\n */\n getUnreachablClusters() {\n const unreachableList = [];\n const clusters = this.clusterLatencyResults;\n\n Object.keys(clusters).forEach((key) => {\n const cluster = clusters[key];\n\n if (cluster.unreachable && !cluster.reachable) {\n unreachableList.push(key);\n }\n });\n\n return unreachableList;\n }\n\n\n /**\n * Attach an event handler for the icegatheringstatechange\n * event and measure latency.\n * @param {RTCPeerConnection} peerConnection\n * @returns {undefined}\n * @private\n * @memberof Reachability\n */\n handleIceGatheringStateChange(peerConnection) {\n peerConnection.onicegatheringstatechange = () => {\n const {COMPLETE} = ICE_GATHERING_STATE;\n\n if (peerConnection.iceConnectionState === COMPLETE) {\n const elapsed = this.getElapsedTime(peerConnection);\n\n LoggerProxy.logger.log(`Reachability:index#onIceGatheringStateChange --> Successfully pinged ${peerConnection.key}:`, elapsed);\n this.setLatencyAndClose(peerConnection, elapsed);\n }\n };\n }\n\n\n /**\n * Attach an event handler for the icecandidate\n * event and measure latency.\n * @param {RTCPeerConnection} peerConnection\n * @returns {undefined}\n * @private\n * @memberof Reachability\n */\n handleOnIceCandidate(peerConnection) {\n peerConnection.onicecandidate = (e) => {\n const SERVER_REFLEXIVE = 'srflx';\n\n if (e.candidate && String(e.candidate.type).toLowerCase() === SERVER_REFLEXIVE) {\n const elapsed = this.getElapsedTime(peerConnection);\n\n LoggerProxy.logger.log(`Reachability:index#onIceCandidate --> Successfully pinged ${peerConnection.key}:`, elapsed);\n this.setLatencyAndClose(peerConnection, elapsed);\n }\n };\n }\n\n /**\n * An event handler on an RTCPeerConnection when the state of the ICE\n * candidate gathering process changes. Used to measure connection\n * speed.\n * @private\n * @param {RTCPeerConnection} peerConnection\n * @param {number} timeout\n * @returns {Promise}\n */\n iceGatheringState(peerConnection, timeout) {\n const ELAPSED = 'elapsed';\n\n return new Promise((resolve) => {\n const peerConnectionProxy = new window.Proxy(peerConnection, {\n get(target, property) {\n const targetMember = target[property];\n\n if (typeof (targetMember) === 'function') {\n return targetMember.bind(target);\n }\n\n return targetMember;\n },\n set: (target, property, value) => {\n // only intercept elapsed property\n if (property === ELAPSED) {\n resolve({clusterId: peerConnection.key, elapsed: value});\n\n return true;\n }\n\n // pass thru\n return window.Reflect.set(target, property, value);\n }\n });\n\n // Using peerConnection proxy so handle functions below\n // won't be coupled to our promise implementation\n this.handleIceGatheringStateChange(peerConnectionProxy);\n this.handleOnIceCandidate(peerConnectionProxy);\n\n // Set maximum timeout\n window.setTimeout(() => {\n const {CLOSED} = CONNECTION_STATE;\n\n // Close any open peerConnections\n if (peerConnectionProxy.connectionState !== CLOSED) {\n this.setLatencyAndClose(peerConnectionProxy, null);\n }\n }, timeout);\n });\n }\n\n\n /**\n * Make a log of unreachable clusters.\n * @returns {undefined}\n * @private\n * @memberof Reachability\n */\n logUnreachableClusters() {\n const list = this.getUnreachablClusters();\n\n list.forEach((cluster) => {\n LoggerProxy.logger.log(`Reachability:index#logUnreachableClusters --> No ice candidate for ${cluster}.`);\n });\n }\n\n\n /**\n * Calculates time to establish connection\n * @param {array} iceResults iceResults\n * @returns {object} reachabilityMap\n * @private\n * @memberof Reachability\n */\n parseIceResultsToReachabilityResults(iceResults) {\n const reachabilityMap = {};\n\n iceResults.forEach(({clusterId, elapsed}) => {\n let latencyResult;\n\n if (elapsed === null) {\n latencyResult = {reachable: 'false'};\n }\n else {\n latencyResult = {\n reachable: 'true',\n latencyInMilliseconds: (elapsed).toString()\n };\n }\n\n reachabilityMap[clusterId] = {\n udp: latencyResult,\n tcp: latencyResult\n };\n });\n\n return reachabilityMap;\n }\n\n\n /**\n * fetches reachability data\n * @param {object} clusterList\n * @returns {Promise<localSDPData>} reachability check results\n * @private\n * @memberof Reachability\n */\n performReachabilityCheck(clusterList) {\n if (!clusterList || !Object.keys(clusterList).length) {\n return Promise.resolve({});\n }\n\n return new Promise((resolve) => {\n this.getLocalSDPForClusters(clusterList)\n .then((localSDPData) => {\n if (!localSDPData || !Object.keys(localSDPData).length) {\n // TODO: handle the error condition properly and try retry\n LoggerProxy.logger.log('Reachability:index#performReachabilityCheck --> Local SDP is empty or has missing elements..returning');\n resolve({});\n }\n else {\n resolve(localSDPData);\n }\n })\n .catch((error) => {\n LoggerProxy.logger.error(`Reachability:index#performReachabilityCheck --> Error in getLocalSDPForClusters: ${error}`);\n resolve({});\n });\n });\n }\n\n\n /**\n * Records latency and closes the peerConnection\n * @param {RTCPeerConnection} peerConnection\n * @param {number} elapsed Latency in milliseconds\n * @returns {undefined}\n * @private\n * @memberof Reachability\n */\n setLatencyAndClose(peerConnection, elapsed) {\n const REACHABLE = 'reachable';\n const UNREACHABLE = 'unreachable';\n const {CLOSED} = CONNECTION_STATE;\n const {key} = peerConnection;\n const resultKey = elapsed === null ? UNREACHABLE : REACHABLE;\n const intialState = {[REACHABLE]: 0, [UNREACHABLE]: 0};\n\n if (peerConnection.connectionState === CLOSED) {\n LoggerProxy.logger.log(`Reachability:index#setLatencyAndClose --> Attempting to set latency of ${elapsed} on closed peerConnection.`);\n\n return;\n }\n\n this.clusterLatencyResults[key] = this.clusterLatencyResults[key] || intialState;\n this.clusterLatencyResults[key][resultKey] += 1;\n\n // Set to null in case this fired from\n // an event other than onIceCandidate\n peerConnection.onicecandidate = null;\n peerConnection.close();\n peerConnection.elapsed = elapsed;\n }\n\n\n /**\n * utility function\n * @returns {undefined}\n * @private\n * @memberof Reachability\n */\n setup() {\n this.clusterLatencyResults = {};\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA;;AACA;;AAMA;;AAEA,IAAMA,eAAe,GAAG,IAAxB;AACA,IAAMC,kBAAkB,GAAG,IAA3B;AAEA;AACA;AACA;AACA;;IACqBC,Y;EACnB;AACF;AACA;AACA;AACA;EACE,sBAAYC,KAAZ,EAAmB;IAAA;IACjB,KAAKA,KAAL,GAAaA,KAAb;IAEA;AACJ;AACA;AACA;AACA;AACA;AACA;;IACI,KAAKC,mBAAL,GAA2B,IAAIC,gBAAJ,CAAwB,KAAKF,KAA7B,CAA3B;IAEA;AACJ;AACA;AACA;AACA;AACA;AACA;;IACI,KAAKG,qBAAL,GAA6B,EAA7B;EACD;EAGD;AACF;AACA;AACA;AACA;AACA;AACA;;;;;;wGACE;QAAA;;QAAA;QAAA;UAAA;YAAA;cAAA;gBACE,KAAKC,KAAL,GADF,CAGE;;gBAHF,iBAIMC,MAJN,4DAIM,QAAQC,YAJd,iDAIM,qBAAsBC,UAJ5B;kBAAA;kBAAA;gBAAA;;gBAKIF,MAAM,CAACC,YAAP,CAAoBC,UAApB,CAA+BC,uBAAA,CAAaF,YAA5C;gBALJ;gBAAA;;cAAA;gBAQIG,oBAAA,CAAYC,MAAZ,CAAmBC,KAAnB,CAAyB,4EAAzB;;gBARJ,iCAUW,EAVX;;cAAA;gBAAA;gBAAA;gBAAA,OAe2B,KAAKV,mBAAL,CAAyBW,WAAzB,EAf3B;;cAAA;gBAeUC,QAfV;gBAAA;gBAAA,OAkB0B,KAAKC,wBAAL,CAA8BD,QAA9B,CAlB1B;;cAAA;gBAkBUE,OAlBV;gBAoBIV,MAAM,CAACC,YAAP,CAAoBU,OAApB,CAA4BR,uBAAA,CAAaF,YAAzC,EAAuD,wBAAeS,OAAf,CAAvD;;gBAEAN,oBAAA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ACE,4BAAmBxC,cAAnB,EAAmC6B,OAAnC,EAA4C;MAAA;;MAC1C,IAAMuC,SAAS,GAAG,WAAlB;MACA,IAAMC,WAAW,GAAG,aAApB;MACA,IAAOd,MAAP,GAAiBC,2BAAjB,CAAOD,MAAP;MACA,IAAOzD,GAAP,GAAcE,cAAd,CAAOF,GAAP;MACA,IAAMwE,SAAS,GAAGzC,OAAO,KAAK,IAAZ,GAAmBwC,WAAnB,GAAiCD,SAAnD;MACA,IAAMG,WAAW,mEAAKH,SAAL,EAAiB,CAAjB,+CAAqBC,WAArB,EAAmC,CAAnC,gBAAjB;;MAEA,IAAIrE,cAAc,CAACyD,eAAf,KAAmCF,MAAvC,EAA+C;QAC7CtF,oBAAA,CAAYC,MAAZ,CAAmBO,GAAnB,kFAAiGoD,OAAjG;;QAEA;MACD;;MAED,KAAKlE,qBAAL,CAA2BmC,GAA3B,IAAkC,KAAKnC,qBAAL,CAA2BmC,GAA3B,KAAmCyE,WAArE;MACA,KAAK5G,qBAAL,CAA2BmC,GAA3B,EAAgCwE,SAAhC,KAA8C,CAA9C,CAf0C,CAiB1C;MACA;;MACAtE,cAAc,CAACgC,cAAf,GAAgC,IAAhC;MACAhC,cAAc,CAACwE,KAAf;MACAxE,cAAc,CAAC6B,OAAf,GAAyBA,OAAzB;IACD;IAGD;AACF;AACA;AACA;AACA;AACA;;;;WACE,iBAAQ;MACN,KAAKlE,qBAAL,GAA6B,EAA7B;IACD"}
|
|
@@ -235,6 +235,14 @@ var TurnDiscovery = /*#__PURE__*/function () {
|
|
|
235
235
|
value: function doTurnDiscovery(meeting, isReconnecting) {
|
|
236
236
|
var _this2 = this;
|
|
237
237
|
|
|
238
|
+
var isAnyClusterReachable = meeting.webex.meetings.reachability.isAnyClusterReachable();
|
|
239
|
+
|
|
240
|
+
if (isAnyClusterReachable) {
|
|
241
|
+
_loggerProxy.default.logger.info('Roap:turnDiscovery#doTurnDiscovery --> reachability has not failed, skipping TURN discovery');
|
|
242
|
+
|
|
243
|
+
return _promise.default.resolve(undefined);
|
|
244
|
+
}
|
|
245
|
+
|
|
238
246
|
if (!meeting.config.experimental.enableTurnDiscovery) {
|
|
239
247
|
_loggerProxy.default.logger.info('Roap:turnDiscovery#doTurnDiscovery --> TURN discovery disabled in config, skipping it');
|
|
240
248
|
|