Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
fmtps.forEach(fmtp => {
let fmtpConfig = transform.parseParams(fmtp.config);
// Reconfiguring the FMTP to coerce endpoints to obey to audio spec
// IF audioCodec was defined in the spec
if (spec[audioCodec]) {
let configProfile = this._fetchOPUSProfileParams(spec[audioCodec]);
fmtp.config = configProfile;
}
});
}
});
}
});
return transform.write(res);
}
static getContentDescription (sdp) {
var res = transform.parse(sdp);
res.media = res.media.filter(SdpWrapper.isContentSlides);
// No content:slides media in this one
if (res.media.length <= 0) {
return;
}
var mangledSdp = transform.write(res);
if(typeof mangledSdp != undefined && mangledSdp && mangledSdp != "") {
return mangledSdp;
}
else
return sdp;
}
remoteMediaObj.rids.push(
{
id : rid.id,
direction : 'recv'
});
}
}
remoteMediaObj.rtcpMux = 'rtcp-mux';
remoteMediaObj.rtcpRsize = 'rtcp-rsize';
// Push it.
sdpObj.media.push(remoteMediaObj);
}
const sdp = sdpTransform.write(sdpObj);
return sdp;
}
}
});
video.ssrcGroups = video.ssrcGroups || [];
if (video.ssrcGroups.find(group => group.semantics === 'SIM')) {
// Group already exists, no need to do anything
return desc;
}
video.ssrcGroups.push({
semantics: 'SIM',
ssrcs: ssrcs.join(' ')
});
}
return new RTCSessionDescription({
type: desc.type,
sdp: transform.write(sdp)
});
};
if (session['media'][videoIdx]['ssrcGroups']) {
let ssrcGroup = session['media'][videoIdx].ssrcGroups[0];
let ssrcs = ssrcGroup.ssrcs;
let videoSsrc = ssrcs.split(" ")[0];
console.log('ssrcs => %s, video %s', ssrcs, videoSsrc);
let newSsrcs = session['media'][videoIdx].ssrcs;
newSsrcs = newSsrcs.filter(item => item.id == videoSsrc);
session['media'][videoIdx].ssrcGroups = [];
session['media'][videoIdx].ssrcs = newSsrcs;
}
let tmp = desc;
tmp.sdp = sdpTransform.write(session);
return tmp;
}
delete mLine.ssrcs[i];
}
}
for (i = 0; i < mLine.ssrcs.length; i++) {
if (typeof mLine.ssrcs[i] !== 'undefined') {
newSsrcLines.push(mLine.ssrcs[i]);
}
}
mLine.ssrcs = replaceDefaultUnifiedPlanMsid(newSsrcLines);
}
});
}
const resStr = transform.write(session);
return new RTCSessionDescription({
type: desc.type,
sdp: resStr
});
};
let headerExtension = stream.rtpParameters.headerExtensions[i];
media.ext.push({
value: headerExtension.id,
uri: headerExtension.uri
});
}
description.media.push(media);
}
description.groups.push({
type: 'LS',
mids: mids.join(' ')
});
return sdp_transform.write(description);
}
}
exports.processOffer = function (sdp, preference = {}, direction) {
var sdpObj = transform.parse(sdp);
filterVP9Payload(sdpObj);
var finalProfile = filterH264Payload(sdpObj, preference, direction);
var audioFormat = filterAudioPayload(sdpObj, preference.audio);
var videoFormat = filterVideoPayload(sdpObj, preference.video);
if (videoFormat && videoFormat.codec === 'h264') {
videoFormat.profile = finalProfile;
}
sdp = transform.write(sdpObj);
return { sdp, audioFormat, videoFormat};
};
`Removing bandwidth limit for mline ${mLine.type}`);
delete mLine.bandwidth;
} else {
logger.debug(`Enforcing limit ${limitKbps}kbps`
+ ` for mline ${mLine.type}`);
mLine.bandwidth = [
{
type: 'AS',
limit: limitKbps
}
];
}
}
});
return transform.write(desc);
}
}
validPayloads = res.media[mediaIndex].rtp.map(function(elem) {
return elem.payload;
});
res.media[mediaIndex].fmtp = res.media[mediaIndex].fmtp.filter(function(elem) {
return validPayloads.indexOf(elem.payload) >= 0;
});
res.media[mediaIndex].rtcpFb = res.media[mediaIndex].rtcpFb.filter(function(elem) {
return validPayloads.indexOf(elem.payload) >= 0;
});
res.media[mediaIndex].payloads = validPayloads.join(' ');
return sdpTransform.write(res);
};