@@ -23,7 +23,6 @@ import P2PEncryptor from '../Calls/P2P/P2PEncryptor';
23
23
24
24
const JOIN_TRACKS = true ;
25
25
const UNIFY_SDP = true ;
26
- const UNIFY_CANDIDATE = true ;
27
26
export const TG_CALLS_SDP_STRING = true ;
28
27
29
28
export function LOG_CALL ( str , ...data ) {
@@ -2084,11 +2083,10 @@ class CallStore extends EventEmitter {
2084
2083
}
2085
2084
case 'candidate' : {
2086
2085
let candidate = data ;
2087
- if ( UNIFY_CANDIDATE ) {
2088
- candidate = P2PSdpBuilder . generateCandidate ( candidate . candidate ) ;
2089
- candidate . sdpMLineIndex = data . sdpMLineIndex ;
2090
- candidate . sdpMid = data . sdpMid ;
2091
- }
2086
+ candidate = P2PSdpBuilder . generateCandidate ( candidate . candidate ) ;
2087
+ candidate . sdpMLineIndex = data . sdpMLineIndex ;
2088
+ candidate . sdpMid = data . sdpMid ;
2089
+
2092
2090
if ( candidate ) {
2093
2091
const iceCandidate = new RTCIceCandidate ( candidate ) ;
2094
2092
if ( ! connection . remoteDescription ) {
@@ -2106,14 +2104,13 @@ class CallStore extends EventEmitter {
2106
2104
case 'Candidates' : {
2107
2105
const candidates = [ ] ;
2108
2106
let candidate = data ;
2109
- if ( UNIFY_CANDIDATE ) {
2110
- data . candidates . forEach ( x => {
2111
- candidate = P2PSdpBuilder . generateCandidate ( x ) ;
2112
- candidate . sdpMLineIndex = 0 ;
2107
+ data . candidates . forEach ( x => {
2108
+ candidate = P2PSdpBuilder . generateCandidate ( x ) ;
2109
+ candidate . sdpMLineIndex = 0 ;
2110
+
2111
+ candidates . push ( candidate ) ;
2112
+ } ) ;
2113
2113
2114
- candidates . push ( candidate ) ;
2115
- } ) ;
2116
- }
2117
2114
if ( candidates . length > 0 ) {
2118
2115
candidates . forEach ( async x => {
2119
2116
const iceCandidate = new RTCIceCandidate ( x ) ;
@@ -2168,18 +2165,13 @@ class CallStore extends EventEmitter {
2168
2165
2169
2166
p2pSendIceCandidate ( callId , iceCandidate ) {
2170
2167
LOG_P2P_CALL ( 'p2pSendIceCandidate' , callId , iceCandidate ) ;
2171
- if ( UNIFY_CANDIDATE ) {
2172
- let { candidate, sdpMLineIndex } = iceCandidate ;
2173
- if ( sdpMLineIndex !== 0 ) {
2174
- return ;
2175
- }
2176
-
2177
- candidate = p2pParseCandidate ( candidate ) ;
2178
- this . p2pSendCallSignalingData ( callId , JSON . stringify ( { '@type' : 'Candidates' , candidates : [ candidate ] } ) ) ;
2179
- } else {
2180
- const { candidate, sdpMLineIndex, sdpMid } = iceCandidate ;
2181
- this . p2pSendCallSignalingData ( callId , JSON . stringify ( { type : 'candidate' , candidate, sdpMLineIndex, sdpMid } ) ) ;
2168
+ let { candidate, sdpMLineIndex } = iceCandidate ;
2169
+ if ( sdpMLineIndex !== 0 ) {
2170
+ return ;
2182
2171
}
2172
+
2173
+ candidate = p2pParseCandidate ( candidate ) ;
2174
+ this . p2pSendCallSignalingData ( callId , JSON . stringify ( { '@type' : 'Candidates' , candidates : [ candidate ] } ) ) ;
2183
2175
}
2184
2176
2185
2177
p2pSendInitialSetup ( callId , initialSetup ) {
0 commit comments