1- /*! adapterjs - v0.14.2 -6d236da - 2017-05-22 */
1+ /*! adapterjs - v0.14.3 -6d236da - 2017-05-24 */
22
33// Adapter's interface.
44var AdapterJS = AdapterJS || { } ;
@@ -12,7 +12,7 @@ AdapterJS.options = AdapterJS.options || {};
1212// AdapterJS.options.hidePluginInstallPrompt = true;
1313
1414// AdapterJS version
15- AdapterJS . VERSION = '0.14.2 -6d236da' ;
15+ AdapterJS . VERSION = '0.14.3 -6d236da' ;
1616
1717// This function will be called when the WebRTC API is ready to be used
1818// Whether it is the native implementation (Chrome, Firefox, Opera) or
@@ -636,6 +636,11 @@ if ( (navigator.mozGetUserMedia ||
636636 ///////////////////////////////////////////////////////////////////
637637 // INJECTION OF GOOGLE'S ADAPTER.JS CONTENT
638638
639+ // Store the original native RTCPC in msRTCPeerConnection object
640+ if ( navigator . userAgent . match ( / E d g e \/ ( \d + ) .( \d + ) $ / ) && window . RTCPeerConnection ) {
641+ window . msRTCPeerConnection = window . RTCPeerConnection ;
642+ }
643+
639644/* jshint ignore:start */
640645( function ( f ) { if ( typeof exports === "object" && typeof module !== "undefined" ) { module . exports = f ( ) } else if ( typeof define === "function" && define . amd ) { define ( [ ] , f ) } else { var g ; if ( typeof window !== "undefined" ) { g = window } else if ( typeof global !== "undefined" ) { g = global } else if ( typeof self !== "undefined" ) { g = self } else { g = this } g . adapter = f ( ) } } ) ( function ( ) { var define , module , exports ; return ( function e ( t , n , r ) { function s ( o , u ) { if ( ! n [ o ] ) { if ( ! t [ o ] ) { var a = typeof require == "function" && require ; if ( ! u && a ) return a ( o , ! 0 ) ; if ( i ) return i ( o , ! 0 ) ; var f = new Error ( "Cannot find module '" + o + "'" ) ; throw f . code = "MODULE_NOT_FOUND" , f } var l = n [ o ] = { exports :{ } } ; t [ o ] [ 0 ] . call ( l . exports , function ( e ) { var n = t [ o ] [ 1 ] [ e ] ; return s ( n ?n :e ) } , l , l . exports , e , t , n , r ) } return n [ o ] . exports } var i = typeof require == "function" && require ; for ( var o = 0 ; o < r . length ; o ++ ) s ( r [ o ] ) ; return s } ) ( { 1 :[ function ( requirecopy , module , exports ) {
641646 /* eslint-env node */
@@ -862,6 +867,15 @@ SDPUtils.parseSsrcMedia = function(line) {
862867 return parts ;
863868} ;
864869
870+ // Extracts the MID (RFC 5888) from a media section.
871+ // returns the MID or undefined if no mid line was found.
872+ SDPUtils . getMid = function ( mediaSection ) {
873+ var mid = SDPUtils . matchPrefix ( mediaSection , 'a=mid:' ) [ 0 ] ;
874+ if ( mid ) {
875+ return mid . substr ( 6 ) ;
876+ }
877+ }
878+
865879// Extracts DTLS parameters from SDP media section or sessionpart.
866880// FIXME: for consistency with other functions this should only
867881// get the fingerprint line as input. See also getIceParameters.
@@ -873,10 +887,11 @@ SDPUtils.getDtlsParameters = function(mediaSection, sessionpart) {
873887 return line . indexOf ( 'a=fingerprint:' ) === 0 ;
874888 } ) [ 0 ] . substr ( 14 ) ;
875889 // Note: a=setup line is ignored since we use the 'auto' role.
890+ // Note2: 'algorithm' is not case sensitive except in Edge.
876891 var dtlsParameters = {
877892 role : 'auto' ,
878893 fingerprints : [ {
879- algorithm : fpLine . split ( ' ' ) [ 0 ] ,
894+ algorithm : fpLine . split ( ' ' ) [ 0 ] . toLowerCase ( ) ,
880895 value : fpLine . split ( ' ' ) [ 1 ]
881896 } ]
882897 } ;
@@ -982,8 +997,21 @@ SDPUtils.writeRtpDescription = function(kind, caps) {
982997 sdp += SDPUtils . writeFmtp ( codec ) ;
983998 sdp += SDPUtils . writeRtcpFb ( codec ) ;
984999 } ) ;
985- // FIXME: add headerExtensions, fecMechanismş and rtcp.
1000+ var maxptime = 0 ;
1001+ caps . codecs . forEach ( function ( codec ) {
1002+ if ( codec . maxptime > maxptime ) {
1003+ maxptime = codec . maxptime ;
1004+ }
1005+ } ) ;
1006+ if ( maxptime > 0 ) {
1007+ sdp += 'a=maxptime:' + maxptime + '\r\n' ;
1008+ }
9861009 sdp += 'a=rtcp-mux\r\n' ;
1010+
1011+ caps . headerExtensions . forEach ( function ( extension ) {
1012+ sdp += SDPUtils . writeExtmap ( extension ) ;
1013+ } ) ;
1014+ // FIXME: write fecMechanisms.
9871015 return sdp ;
9881016} ;
9891017
@@ -1024,7 +1052,6 @@ SDPUtils.parseRtpEncodingParameters = function(mediaSection) {
10241052 ssrc : primarySsrc ,
10251053 codecPayloadType : parseInt ( codec . parameters . apt , 10 ) ,
10261054 rtx : {
1027- payloadType : codec . payloadType ,
10281055 ssrc : secondarySsrc
10291056 }
10301057 } ;
@@ -1060,6 +1087,61 @@ SDPUtils.parseRtpEncodingParameters = function(mediaSection) {
10601087 return encodingParameters ;
10611088} ;
10621089
1090+ // parses http://draft.ortc.org/#rtcrtcpparameters*
1091+ SDPUtils . parseRtcpParameters = function ( mediaSection ) {
1092+ var rtcpParameters = { } ;
1093+
1094+ var cname ;
1095+ // Gets the first SSRC. Note that with RTX there might be multiple
1096+ // SSRCs.
1097+ var remoteSsrc = SDPUtils . matchPrefix ( mediaSection , 'a=ssrc:' )
1098+ . map ( function ( line ) {
1099+ return SDPUtils . parseSsrcMedia ( line ) ;
1100+ } )
1101+ . filter ( function ( obj ) {
1102+ return obj . attribute === 'cname' ;
1103+ } ) [ 0 ] ;
1104+ if ( remoteSsrc ) {
1105+ rtcpParameters . cname = remoteSsrc . value ;
1106+ rtcpParameters . ssrc = remoteSsrc . ssrc ;
1107+ }
1108+
1109+ // Edge uses the compound attribute instead of reducedSize
1110+ // compound is !reducedSize
1111+ var rsize = SDPUtils . matchPrefix ( mediaSection , 'a=rtcp-rsize' ) ;
1112+ rtcpParameters . reducedSize = rsize . length > 0 ;
1113+ rtcpParameters . compound = rsize . length === 0 ;
1114+
1115+ // parses the rtcp-mux attrіbute.
1116+ // Note that Edge does not support unmuxed RTCP.
1117+ var mux = SDPUtils . matchPrefix ( mediaSection , 'a=rtcp-mux' ) ;
1118+ rtcpParameters . mux = mux . length > 0 ;
1119+
1120+ return rtcpParameters ;
1121+ } ;
1122+
1123+ // parses either a=msid: or a=ssrc:... msid lines an returns
1124+ // the id of the MediaStream and MediaStreamTrack.
1125+ SDPUtils . parseMsid = function ( mediaSection ) {
1126+ var parts ;
1127+ var spec = SDPUtils . matchPrefix ( mediaSection , 'a=msid:' ) ;
1128+ if ( spec . length === 1 ) {
1129+ parts = spec [ 0 ] . substr ( 7 ) . split ( ' ' ) ;
1130+ return { stream : parts [ 0 ] , track : parts [ 1 ] } ;
1131+ }
1132+ var planB = SDPUtils . matchPrefix ( mediaSection , 'a=ssrc:' )
1133+ . map ( function ( line ) {
1134+ return SDPUtils . parseSsrcMedia ( line ) ;
1135+ } )
1136+ . filter ( function ( parts ) {
1137+ return parts . attribute === 'msid' ;
1138+ } ) ;
1139+ if ( planB . length > 0 ) {
1140+ parts = planB [ 0 ] . value . split ( ' ' ) ;
1141+ return { stream : parts [ 0 ] , track : parts [ 1 ] } ;
1142+ }
1143+ } ;
1144+
10631145SDPUtils . writeSessionBoilerplate = function ( ) {
10641146 // FIXME: sess-id should be an NTP timestamp.
10651147 return 'v=0\r\n' +
@@ -1092,17 +1174,31 @@ SDPUtils.writeMediaSection = function(transceiver, caps, type, stream) {
10921174 sdp += 'a=inactive\r\n' ;
10931175 }
10941176
1095- // FIXME: for RTX there might be multiple SSRCs. Not implemented in Edge yet.
10961177 if ( transceiver . rtpSender ) {
1178+ // spec.
10971179 var msid = 'msid:' + stream . id + ' ' +
10981180 transceiver . rtpSender . track . id + '\r\n' ;
10991181 sdp += 'a=' + msid ;
1182+
1183+ // for Chrome.
11001184 sdp += 'a=ssrc:' + transceiver . sendEncodingParameters [ 0 ] . ssrc +
11011185 ' ' + msid ;
1186+ if ( transceiver . sendEncodingParameters [ 0 ] . rtx ) {
1187+ sdp += 'a=ssrc:' + transceiver . sendEncodingParameters [ 0 ] . rtx . ssrc +
1188+ ' ' + msid ;
1189+ sdp += 'a=ssrc-group:FID ' +
1190+ transceiver . sendEncodingParameters [ 0 ] . ssrc + ' ' +
1191+ transceiver . sendEncodingParameters [ 0 ] . rtx . ssrc +
1192+ '\r\n' ;
1193+ }
11021194 }
11031195 // FIXME: this should be written by writeRtpDescription.
11041196 sdp += 'a=ssrc:' + transceiver . sendEncodingParameters [ 0 ] . ssrc +
11051197 ' cname:' + SDPUtils . localCName + '\r\n' ;
1198+ if ( transceiver . rtpSender && transceiver . sendEncodingParameters [ 0 ] . rtx ) {
1199+ sdp += 'a=ssrc:' + transceiver . sendEncodingParameters [ 0 ] . rtx . ssrc +
1200+ ' cname:' + SDPUtils . localCName + '\r\n' ;
1201+ }
11061202 return sdp ;
11071203} ;
11081204
@@ -1127,6 +1223,16 @@ SDPUtils.getDirection = function(mediaSection, sessionpart) {
11271223 return 'sendrecv' ;
11281224} ;
11291225
1226+ SDPUtils . getKind = function ( mediaSection ) {
1227+ var lines = SDPUtils . splitLines ( mediaSection ) ;
1228+ var mline = lines [ 0 ] . split ( ' ' ) ;
1229+ return mline [ 0 ] . substr ( 2 ) ;
1230+ } ;
1231+
1232+ SDPUtils . isRejected = function ( mediaSection ) {
1233+ return mediaSection . split ( ' ' , 2 ) [ 1 ] === '0' ;
1234+ } ;
1235+
11301236// Expose public methods.
11311237module . exports = SDPUtils ;
11321238
@@ -3765,7 +3871,11 @@ module.exports = {
37653871 }
37663872 var cc = { } ;
37673873 Object . keys ( c ) . forEach ( function ( key ) {
3768- if ( key === 'require' || key === 'advanced' || key === 'mediaSource' ) {
3874+ if ( key === 'require' || key === 'advanced' ) {
3875+ return ;
3876+ }
3877+ if ( typeof c [ key ] === 'string' ) {
3878+ cc [ key ] = c [ key ] ;
37693879 return ;
37703880 }
37713881 var r = ( typeof c [ key ] === 'object' ) ? c [ key ] : { ideal : c [ key ] } ;
@@ -3778,6 +3888,15 @@ module.exports = {
37783888 }
37793889 return ( name === 'deviceId' ) ? 'sourceId' : name ;
37803890 } ;
3891+
3892+ // HACK : Specially handling: if deviceId is an object with exact property,
3893+ // change it such that deviceId value is not in exact property
3894+ // Reason : AJS-286 (deviceId in WebRTC samples not in the format specified as specifications)
3895+ if ( oldname ( '' , key ) === 'sourceId' && r . exact !== undefined ) {
3896+ r . ideal = r . exact ;
3897+ r . exact = undefined ;
3898+ }
3899+
37813900 if ( r . ideal !== undefined ) {
37823901 cc . optional = cc . optional || [ ] ;
37833902 var oc = { } ;
0 commit comments