File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -65,6 +65,7 @@ export function adapterFactory({window} = {}, options = {
65
65
chromeShim . fixNegotiationNeeded ( window , browserDetails ) ;
66
66
67
67
commonShim . shimRTCIceCandidate ( window , browserDetails ) ;
68
+ commonShim . shimRTCIceCandidateRelayProtocol ( window , browserDetails ) ;
68
69
commonShim . shimConnectionState ( window , browserDetails ) ;
69
70
commonShim . shimMaxMessageSize ( window , browserDetails ) ;
70
71
commonShim . shimSendThrowTypeError ( window , browserDetails ) ;
@@ -124,6 +125,7 @@ export function adapterFactory({window} = {}, options = {
124
125
safariShim . shimAudioContext ( window , browserDetails ) ;
125
126
126
127
commonShim . shimRTCIceCandidate ( window , browserDetails ) ;
128
+ commonShim . shimRTCIceCandidateRelayProtocol ( window , browserDetails ) ;
127
129
commonShim . shimMaxMessageSize ( window , browserDetails ) ;
128
130
commonShim . shimSendThrowTypeError ( window , browserDetails ) ;
129
131
commonShim . removeExtmapAllowMixed ( window , browserDetails ) ;
Original file line number Diff line number Diff line change @@ -63,6 +63,31 @@ export function shimRTCIceCandidate(window) {
63
63
} ) ;
64
64
}
65
65
66
+ export function shimRTCIceCandidateRelayProtocol ( window ) {
67
+ if ( ! window . RTCIceCandidate || ( window . RTCIceCandidate && 'relayProtocol' in
68
+ window . RTCIceCandidate . prototype ) ) {
69
+ return ;
70
+ }
71
+
72
+ // Hook up the augmented candidate in onicecandidate and
73
+ // addEventListener('icecandidate', ...)
74
+ utils . wrapPeerConnectionEvent ( window , 'icecandidate' , e => {
75
+ if ( e . candidate ) {
76
+ const parsedCandidate = SDPUtils . parseCandidate ( e . candidate . candidate ) ;
77
+ if ( parsedCandidate . type === 'relay' ) {
78
+ // This is a libwebrtc-specific mapping of local type preference
79
+ // to relayProtocol.
80
+ e . candidate . relayProtocol = {
81
+ 0 : 'tls' ,
82
+ 1 : 'tcp' ,
83
+ 2 : 'udp' ,
84
+ } [ parsedCandidate . priority >> 24 ] ;
85
+ }
86
+ }
87
+ return e ;
88
+ } ) ;
89
+ }
90
+
66
91
export function shimMaxMessageSize ( window , browserDetails ) {
67
92
if ( ! window . RTCPeerConnection ) {
68
93
return ;
You can’t perform that action at this time.
0 commit comments