Comparing version 1.3.0 to 1.4.0
{ | ||
"name": "sdp", | ||
"version": "1.3.0", | ||
"version": "1.4.0", | ||
"description": "SDP parsing and serialization utilities", | ||
@@ -5,0 +5,0 @@ "main": "sdp.js", |
33
sdp.js
@@ -435,2 +435,35 @@ /* eslint-env node */ | ||
// parses http://draft.ortc.org/#rtcrtcpparameters* | ||
SDPUtils.parseRtcpParameters = function(mediaSection) { | ||
var rtcpParameters = {}; | ||
var cname; | ||
// Gets the first SSRC. Note that with RTX there might be multiple | ||
// SSRCs. | ||
var remoteSsrc = SDPUtils.matchPrefix(mediaSection, 'a=ssrc:') | ||
.map(function(line) { | ||
return SDPUtils.parseSsrcMedia(line); | ||
}) | ||
.filter(function(obj) { | ||
return obj.attribute === 'cname'; | ||
})[0]; | ||
if (remoteSsrc) { | ||
rtcpParameters.cname = remoteSsrc.value; | ||
rtcpParameters.ssrc = remoteSsrc.ssrc; | ||
} | ||
// Edge uses the compound attribute instead of reducedSize | ||
// compound is !reducedSize | ||
var rsize = SDPUtils.matchPrefix(mediaSection, 'a=rtcp-rsize'); | ||
rtcpParameters.reducedSize = rsize.length > 0; | ||
rtcpParameters.compound = rsize.length === 0; | ||
// parses the rtcp-mux attrŅbute. | ||
// Note that Edge does not support unmuxed RTCP. | ||
var mux = SDPUtils.matchPrefix(mediaSection, 'a=rtcp-mux'); | ||
rtcpParameters.mux = mux.length > 0; | ||
return rtcpParameters; | ||
}; | ||
// parses either a=msid: or a=ssrc:... msid lines an returns | ||
@@ -437,0 +470,0 @@ // the id of the MediaStream and MediaStreamTrack. |
@@ -205,1 +205,11 @@ /* jshint node: true */ | ||
}); | ||
test('parseRtcpParameters', function(t) { | ||
var rtcp = SDPUtils.parseRtcpParameters(videoSDP); | ||
t.ok(rtcp.cname === 'VrveQctHgkwqDKj6', 'parsed RTCP cname'); | ||
t.ok(rtcp.ssrc === 1734522595, 'parsed RTCP ssrc'); | ||
t.ok(rtcp.reducedSize === true, 'parsed RTCP reducedSize'); | ||
t.ok(rtcp.compound === false, 'parsed RTCP compound'); | ||
t.ok(rtcp.mux === true, 'parse RTCP mux'); | ||
t.end(); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
27727
718