@@ -24,7 +24,6 @@ import P2PEncryptor from '../Calls/P2P/P2PEncryptor';
24
24
const JOIN_TRACKS = true ;
25
25
const UNIFY_SDP = true ;
26
26
const UNIFY_CANDIDATE = true ;
27
- const DATACHANNEL = true ;
28
27
const TG_CALLS = true ;
29
28
const TG_CALLS_MEDIA_STATE = true ;
30
29
const TG_CALLS_SDP = true ;
@@ -1725,32 +1724,28 @@ class CallStore extends EventEmitter {
1725
1724
}
1726
1725
1727
1726
p2pCreateChannel ( connection ) {
1728
- if ( DATACHANNEL ) {
1729
- const channel = connection . createDataChannel ( 'data' , {
1730
- id : 0 ,
1731
- negotiated : true
1732
- } ) ;
1733
- channel . onmessage = e => {
1734
- LOG_P2P_CALL ( '[channel] onmessage' , e ) ;
1735
- const { data } = e ;
1736
- this . p2pApplyCallDataChannelData ( JSON . parse ( data ) ) ;
1737
- } ;
1738
- channel . onopen = ( ) => {
1739
- const { currentCall } = this ;
1740
- if ( ! currentCall ) return ;
1741
-
1742
- const { callId } = currentCall ;
1727
+ const channel = connection . createDataChannel ( 'data' , {
1728
+ id : 0 ,
1729
+ negotiated : true
1730
+ } ) ;
1731
+ channel . onmessage = e => {
1732
+ LOG_P2P_CALL ( '[channel] onmessage' , e ) ;
1733
+ const { data } = e ;
1734
+ this . p2pApplyCallDataChannelData ( JSON . parse ( data ) ) ;
1735
+ } ;
1736
+ channel . onopen = ( ) => {
1737
+ const { currentCall } = this ;
1738
+ if ( ! currentCall ) return ;
1743
1739
1744
- const mediaState = this . p2pGetMediaState ( callId , 'input' ) ;
1745
- if ( ! mediaState ) return ;
1740
+ const { callId } = currentCall ;
1746
1741
1747
- this . p2pSendMediaState ( callId , mediaState ) ;
1748
- } ;
1742
+ const mediaState = this . p2pGetMediaState ( callId , 'input' ) ;
1743
+ if ( ! mediaState ) return ;
1749
1744
1750
- return channel ;
1751
- }
1745
+ this . p2pSendMediaState ( callId , mediaState ) ;
1746
+ } ;
1752
1747
1753
- return null ;
1748
+ return channel ;
1754
1749
}
1755
1750
1756
1751
async p2pJoinCall ( callId ) {
@@ -1933,9 +1928,7 @@ class CallStore extends EventEmitter {
1933
1928
const { connection } = currentCall ;
1934
1929
if ( ! connection ) return ;
1935
1930
1936
- if ( DATACHANNEL ) {
1937
- currentCall . channel = this . p2pCreateChannel ( connection ) ;
1938
- }
1931
+ currentCall . channel = this . p2pCreateChannel ( connection ) ;
1939
1932
1940
1933
const senders = connection . getSenders ( ) ;
1941
1934
if ( senders . some ( x => x . track ) ) return ;
@@ -2180,11 +2173,7 @@ class CallStore extends EventEmitter {
2180
2173
p2pSendMediaIsMuted ( callId , kind , isMuted ) {
2181
2174
LOG_P2P_CALL ( 'p2pSendMediaIsMuted' , callId , kind , isMuted ) ;
2182
2175
2183
- if ( DATACHANNEL ) {
2184
- this . p2pSendDataChannelData ( JSON . stringify ( { type : 'media' , kind, isMuted } ) ) ;
2185
- } else {
2186
- this . p2pSendCallSignalingData ( callId , JSON . stringify ( { type : 'media' , kind, isMuted } ) ) ;
2187
- }
2176
+ this . p2pSendDataChannelData ( JSON . stringify ( { type : 'media' , kind, isMuted } ) ) ;
2188
2177
}
2189
2178
2190
2179
p2pSendMediaState ( callId , mediaState ) {
0 commit comments