Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import Interop from '@jitsi/sdp-interop';
import transform from 'sdp-transform';
import logger from '/imports/startup/client/logger';
// sdp-interop library for unified-plan <-> plan-b translation
const interop = new Interop.Interop();
// Some heuristics to determine if the input SDP is Unified Plan
const isUnifiedPlan = (sdp) => {
const parsedSDP = transform.parse(sdp);
if (parsedSDP.media.length <= 3 && parsedSDP.media.every(m => ['video', 'audio', 'data'].indexOf(m.mid) !== -1)) {
logger.info({ logCode: 'sdp_utils_not_unified_plan' }, 'SDP does not look like Unified Plan');
return false;
}
logger.info({ logCode: 'sdp_utils_is_unified_plan' }, 'SDP looks like Unified Plan');
return true;
};
// Some heuristics to determine if the input SDP is Plan B
const isPlanB = (sdp) => {
this.options = options;
this.peerconnection
= new RTCUtils.RTCPeerConnectionType(iceConfig, constraints);
this.updateLog = [];
this.stats = {};
this.statsinterval = null;
/**
* @type {number} The max number of stats to keep in this.stats. Limit to
* 300 values, i.e. 5 minutes; set to 0 to disable
*/
this.maxstats = options.maxstats;
const Interop = require('@jitsi/sdp-interop').Interop;
this.interop = new Interop();
const Simulcast = require('@jitsi/sdp-simulcast');
this.simulcast = new Simulcast({ numOfLayers: SIMULCAST_LAYERS,
explodeRemoteSimulcast: false });
this.sdpConsistency = new SdpConsistency(this.toString());
/**
* Munges local SDP provided to the Jingle Session in order to prevent from
* sending SSRC updates on attach/detach and mute/unmute (for video).
* @type {LocalSdpMunger}
*/
this.localSdpMunger = new LocalSdpMunger(this);
/**
* TracablePeerConnection uses RTC's eventEmitter
* @type {EventEmitter}