Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
t.pass('answer ready to signal');
// this was fixed into Chrome 51 with https://bugs.chromium.org/p/chromium/issues/detail?id=591971
if (answerWithCandidates.sdp.indexOf('a=rtpmap:126 H264') !== -1 &&
answerWithCandidates.sdp.indexOf('a=fmtp:126') === -1) {
var sections = SDPUtils.splitSections(answerWithCandidates.sdp);
var lines = SDPUtils.splitLines(sections[2]);
var idx = lines.indexOf('a=rtpmap:126 H264/90000');
lines.splice(idx + 1, 0, 'a=fmtp:126 profile-level-id=42e01f;level-asymmetry-allowed=1;packetization-mode=1');
sections[2] = lines.join('\r\n');
answerWithCandidates.sdp = sections.join('') + '\r\n';
}
if (preferredVideoCodec) {
var sections = SDPUtils.splitSections(answerWithCandidates.sdp);
var codecs = SDPUtils.parseRtpParameters(sections[2]).codecs;
t.ok(codecs[0].name === preferredVideoCodec, 'preferredVideoCodec is used');
}
return clientA.setRemoteDescription(answerWithCandidates);
})
.then(() => // wait for the iceConnectionState to become either connected/completed
function splitSimulcast(sdp) {
const sections = SDPUtils.splitSections(sdp);
const candidates = SDPUtils.matchPrefix(sections[1], 'a=candidate:');
const dtls = SDPUtils.getDtlsParameters(sections[1], sections[0]);
const ice = SDPUtils.getIceParameters(sections[1], sections[0]);
const rtpParameters = SDPUtils.parseRtpParameters(sections[1]);
// unified plan things.
rtpParameters.headerExtensions = rtpParameters.headerExtensions.filter(ext => {
return ext.uri !== 'urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id' &&
ext.uri !== 'urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id' &&
ext.uri !== 'urn:ietf:params:rtp-hdrext:sdes:mid';
});
sdp = 'v=0\r\n' +
'o=mozilla...THIS_IS_SDPARTA-61.0 8324701712193024513 0 IN IP4 0.0.0.0\r\n' +
's=-\r\n' +
't=0 0\r\n' +
'a=fingerprint:' + dtls.fingerprints[0].algorithm + ' ' + dtls.fingerprints[0].value + '\r\n' +
'a=ice-ufrag:' + ice.usernameFragment + '\r\n' +
'a=ice-pwd:' + ice.password + '\r\n' +
'a=group:BUNDLE 0 1\r\n' +
'a=msid-semantic:WMS *\r\n';
return;
}
var transceiver;
var iceGatherer;
var iceTransport;
var dtlsTransport;
var rtpSender;
var rtpReceiver;
var sendEncodingParameters;
var recvEncodingParameters;
var localCapabilities;
var track;
// FIXME: ensure the mediaSection has rtcp-mux set.
var remoteCapabilities = SDPUtils.parseRtpParameters(mediaSection);
var remoteIceParameters;
var remoteDtlsParameters;
if (!rejected) {
remoteIceParameters = SDPUtils.getIceParameters(mediaSection,
sessionpart);
remoteDtlsParameters = SDPUtils.getDtlsParameters(mediaSection,
sessionpart);
remoteDtlsParameters.role = 'client';
}
recvEncodingParameters =
SDPUtils.parseRtpEncodingParameters(mediaSection);
var cname;
// Gets the first SSRC. Note that with RTX there might be multiple
// SSRCs.
var remoteSsrc = SDPUtils.matchPrefix(mediaSection, 'a=ssrc:')
return;
}
var transceiver;
var iceGatherer;
var iceTransport;
var dtlsTransport;
var rtpSender;
var rtpReceiver;
var sendEncodingParameters;
var recvEncodingParameters;
var localCapabilities;
var track;
// FIXME: ensure the mediaSection has rtcp-mux set.
var remoteCapabilities = SDPUtils.parseRtpParameters(mediaSection);
var remoteIceParameters;
var remoteDtlsParameters;
if (!rejected) {
remoteIceParameters = SDPUtils.getIceParameters(mediaSection,
sessionpart);
remoteDtlsParameters = SDPUtils.getDtlsParameters(mediaSection,
sessionpart);
remoteDtlsParameters.role = 'client';
}
recvEncodingParameters =
SDPUtils.parseRtpEncodingParameters(mediaSection);
var cname;
// Gets the first SSRC. Note that with RTX there might be multiple
// SSRCs.
var remoteSsrc = SDPUtils.matchPrefix(mediaSection, 'a=ssrc:')
function mergeSimulcast(sdp) {
const sections = SDPUtils.splitSections(sdp);
const candidates = SDPUtils.matchPrefix(sections[1], 'a=candidate:');
const dtls = SDPUtils.getDtlsParameters(sections[1], sections[0]);
const ice = SDPUtils.getIceParameters(sections[1], sections[0]);
const rtpParameters = SDPUtils.parseRtpParameters(sections[1]);
sdp = 'v=0\r\n' +
'o=mozilla...THIS_IS_SDPARTA-61.0 8324701712193024513 0 IN IP4 0.0.0.0\r\n' +
's=-\r\n' +
't=0 0\r\n' +
'a=fingerprint:' + dtls.fingerprints[0].algorithm + ' ' + dtls.fingerprints[0].value + '\r\n' +
'a=ice-ufrag:' + ice.usernameFragment + '\r\n' +
'a=ice-pwd:' + ice.password + '\r\n' +
'a=group:BUNDLE 0\r\n' +
'a=msid-semantic:WMS *\r\n';
const codecs = SDPUtils.writeRtpDescription('video', rtpParameters);
sdp += codecs;
candidates.forEach(c => sdp += c + '\r\n');
return sdp;
}
sections.forEach(function(mediaSection, sdpMLineIndex) {
var caps = SDPUtils.parseRtpParameters(mediaSection);
self._pendingOffer[sdpMLineIndex].localCapabilities = caps;
});
this.transceivers = this._pendingOffer;
sections.forEach(function(mediaSection, sdpMLineIndex) {
var caps = SDPUtils.parseRtpParameters(mediaSection);
self._pendingOffer[sdpMLineIndex].localCapabilities = caps;
});
this.transceivers = this._pendingOffer;
sections.forEach(function(mediaSection, sdpMLineIndex) {
var caps = SDPUtils.parseRtpParameters(mediaSection);
self._pendingOffer[sdpMLineIndex].localCapabilities = caps;
});
this.transceivers = this._pendingOffer;
sections.forEach(function(mediaSection, sdpMLineIndex) {
var caps = SDPUtils.parseRtpParameters(mediaSection);
self._pendingOffer[sdpMLineIndex].localCapabilities = caps;
});
this.transceivers = this._pendingOffer;
sections.forEach(function(mediaSection, sdpMLineIndex) {
var caps = SDPUtils.parseRtpParameters(mediaSection);
self._pendingOffer[sdpMLineIndex].localCapabilities = caps;
});
this.transceivers = this._pendingOffer;