Skip to content

Commit 96b0f6e

Browse files
author
evgeny-nadymov
committed
Remove DATACHANNEL flag
1 parent ce576f1 commit 96b0f6e

File tree

3 files changed

+29
-34
lines changed

3 files changed

+29
-34
lines changed

src/Components/Calls/CallPanel.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,11 @@ class CallPanel extends React.Component {
146146
};
147147

148148
handleClose = () => {
149+
if (this.isFullScreen()) {
150+
this.exitFullscreen();
151+
return;
152+
}
153+
149154
this.handleDiscard(null);
150155
};
151156

src/Components/Calls/GroupCallSettings.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,15 +150,16 @@ class GroupCallSettings extends React.Component {
150150
closeStreams() {
151151
const { inputAudioStream, inputAudioDeviceId, inputVideoStream, inputVideoDeviceId } = this.state;
152152
if (inputAudioStream) {
153-
if (!CallStore.currentGroupCall || !CallStore.currentCall || inputAudioDeviceId === CallStore.getInputAudioDeviceId()) {
153+
if (!CallStore.currentGroupCall && !CallStore.currentCall || inputAudioDeviceId === CallStore.getInputAudioDeviceId()) {
154154
inputAudioStream.getAudioTracks().forEach(x => {
155155
x.stop();
156156
});
157157
}
158158
}
159+
159160
if (inputVideoStream) {
160-
if (!CallStore.currentGroupCall || !CallStore.currentCall || inputVideoDeviceId === CallStore.getInputVideoDeviceId()) {
161-
inputVideoStream.getAudioTracks().forEach(x => {
161+
if (!CallStore.currentGroupCall && !CallStore.currentCall || inputVideoDeviceId === CallStore.getInputVideoDeviceId()) {
162+
inputVideoStream.getVideoTracks().forEach(x => {
162163
x.stop();
163164
});
164165
}

src/Stores/CallStore.js

Lines changed: 20 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import P2PEncryptor from '../Calls/P2P/P2PEncryptor';
2424
const JOIN_TRACKS = true;
2525
const UNIFY_SDP = true;
2626
const UNIFY_CANDIDATE = true;
27-
const DATACHANNEL = true;
2827
const TG_CALLS = true;
2928
const TG_CALLS_MEDIA_STATE = true;
3029
const TG_CALLS_SDP = true;
@@ -1725,32 +1724,28 @@ class CallStore extends EventEmitter {
17251724
}
17261725

17271726
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;
17431739

1744-
const mediaState = this.p2pGetMediaState(callId, 'input');
1745-
if (!mediaState) return;
1740+
const { callId } = currentCall;
17461741

1747-
this.p2pSendMediaState(callId, mediaState);
1748-
};
1742+
const mediaState = this.p2pGetMediaState(callId, 'input');
1743+
if (!mediaState) return;
17491744

1750-
return channel;
1751-
}
1745+
this.p2pSendMediaState(callId, mediaState);
1746+
};
17521747

1753-
return null;
1748+
return channel;
17541749
}
17551750

17561751
async p2pJoinCall(callId) {
@@ -1933,9 +1928,7 @@ class CallStore extends EventEmitter {
19331928
const { connection } = currentCall;
19341929
if (!connection) return;
19351930

1936-
if (DATACHANNEL) {
1937-
currentCall.channel = this.p2pCreateChannel(connection);
1938-
}
1931+
currentCall.channel = this.p2pCreateChannel(connection);
19391932

19401933
const senders = connection.getSenders();
19411934
if (senders.some(x => x.track)) return;
@@ -2180,11 +2173,7 @@ class CallStore extends EventEmitter {
21802173
p2pSendMediaIsMuted(callId, kind, isMuted) {
21812174
LOG_P2P_CALL('p2pSendMediaIsMuted', callId, kind, isMuted);
21822175

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 }));
21882177
}
21892178

21902179
p2pSendMediaState(callId, mediaState) {

0 commit comments

Comments
 (0)