@@ -24,7 +24,6 @@ import P2PEncryptor from '../Calls/P2P/P2PEncryptor';
2424const JOIN_TRACKS = true ;
2525const UNIFY_SDP = true ;
2626const UNIFY_CANDIDATE = true ;
27- const TG_CALLS_SDP = true ;
2827export const TG_CALLS_SDP_STRING = true ;
2928
3029export function LOG_CALL ( str , ...data ) {
@@ -1825,33 +1824,23 @@ class CallStore extends EventEmitter {
18251824 if ( inputVideo ) {
18261825 inputVideo . srcObject = inputStream ;
18271826 }
1828- if ( TG_CALLS_SDP ) {
1829- this . p2pAppendInputStream ( inputStream ) ;
1830- const { offerReceived } = this . currentCall ;
1831- if ( offerReceived ) {
1832- console . log ( '[InitialSetup] after p2pAppendInputStream' ) ;
1833- this . currentCall . offerReceived = false ;
18341827
1835- const answer = await connection . createAnswer ( ) ;
1828+ this . p2pAppendInputStream ( inputStream ) ;
1829+ const { offerReceived } = this . currentCall ;
1830+ if ( offerReceived ) {
1831+ console . log ( '[InitialSetup] after p2pAppendInputStream' ) ;
1832+ this . currentCall . offerReceived = false ;
18361833
1837- console . log ( '[sdp] local' , answer . type , answer . sdp ) ;
1838- await connection . setLocalDescription ( answer ) ;
1834+ const answer = await connection . createAnswer ( ) ;
18391835
1840- const initialSetup = p2pParseSdp ( answer . sdp ) ;
1841- initialSetup [ '@type' ] = 'InitialSetup' ;
1836+ console . log ( '[sdp] local' , answer . type , answer . sdp ) ;
1837+ await connection . setLocalDescription ( answer ) ;
18421838
1843- console . log ( '[InitialSetup] send 2' ) ;
1844- this . p2pSendInitialSetup ( callId , initialSetup ) ;
1845- }
1846- } else {
1847- if ( is_outgoing ) {
1848- this . p2pAppendInputStream ( inputStream ) ;
1849- } else {
1850- LOG_P2P_CALL ( 'try invoke p2pAppendInputStream' , connection . localDescription , connection . remoteDescription ) ;
1851- if ( connection . localDescription && connection . remoteDescription ) {
1852- this . p2pAppendInputStream ( inputStream ) ;
1853- }
1854- }
1839+ const initialSetup = p2pParseSdp ( answer . sdp ) ;
1840+ initialSetup [ '@type' ] = 'InitialSetup' ;
1841+
1842+ console . log ( '[InitialSetup] send 2' ) ;
1843+ this . p2pSendInitialSetup ( callId , initialSetup ) ;
18551844 }
18561845 }
18571846
@@ -1894,16 +1883,13 @@ class CallStore extends EventEmitter {
18941883
18951884 console . log ( '[sdp] local' , offer . sdp ) ;
18961885 await connection . setLocalDescription ( offer ) ;
1897- if ( TG_CALLS_SDP ) {
1898- const initialSetup = p2pParseSdp ( offer . sdp ) ;
1899- initialSetup [ '@type' ] = 'InitialSetup' ;
1900- currentCall . offerSent = true ;
19011886
1902- console . log ( '[InitialSetup] send 0' ) ;
1903- this . p2pSendInitialSetup ( callId , initialSetup ) ;
1904- } else {
1905- this . p2pSendSdp ( callId , offer ) ;
1906- }
1887+ const initialSetup = p2pParseSdp ( offer . sdp ) ;
1888+ initialSetup [ '@type' ] = 'InitialSetup' ;
1889+ currentCall . offerSent = true ;
1890+
1891+ console . log ( '[InitialSetup] send 0' ) ;
1892+ this . p2pSendInitialSetup ( callId , initialSetup ) ;
19071893 }
19081894 } ;
19091895
0 commit comments