|
@@ -1114,17 +1114,7 @@ JitsiConference.prototype._setupNewTrack = function(newTrack) {
|
1114
|
1114
|
|
1115
|
1115
|
this.eventEmitter.emit(JitsiConferenceEvents.TRACK_ADDED, newTrack);
|
1116
|
1116
|
|
1117
|
|
- // Setup E2EE handling, if supported.
|
1118
|
|
- if (!this.isP2PActive() && this._e2eeCtx) {
|
1119
|
|
- const activeTPC = this.getActivePeerConnection();
|
1120
|
|
- const sender = activeTPC ? activeTPC.findSenderForTrack(newTrack.track) : null;
|
1121
|
|
-
|
1122
|
|
- if (sender) {
|
1123
|
|
- this._e2eeCtx.handleSender(sender, newTrack.getType());
|
1124
|
|
- } else {
|
1125
|
|
- logger.warn(`Could not handle E2EE for local ${newTrack.getType()} track: sender not found`);
|
1126
|
|
- }
|
1127
|
|
- }
|
|
1117
|
+ this._setupSenderE2EEForTrack(newTrack);
|
1128
|
1118
|
};
|
1129
|
1119
|
|
1130
|
1120
|
/**
|
|
@@ -1654,16 +1644,7 @@ JitsiConference.prototype.onRemoteTrackAdded = function(track) {
|
1654
|
1644
|
}
|
1655
|
1645
|
|
1656
|
1646
|
// Setup E2EE handling, if supported.
|
1657
|
|
- if (!this.isP2PActive() && this._e2eeCtx) {
|
1658
|
|
- const activeTPC = this.getActivePeerConnection();
|
1659
|
|
- const receiver = activeTPC ? activeTPC.findReceiverForTrack(track.track) : null;
|
1660
|
|
-
|
1661
|
|
- if (receiver) {
|
1662
|
|
- this._e2eeCtx.handleReceiver(receiver, track.getType());
|
1663
|
|
- } else {
|
1664
|
|
- logger.warn(`Could not handle E2EE for remote ${track.getType()} track: receiver not found`);
|
1665
|
|
- }
|
1666
|
|
- }
|
|
1647
|
+ this._setupReceiverE2EEForTrack(track);
|
1667
|
1648
|
|
1668
|
1649
|
const id = track.getParticipantId();
|
1669
|
1650
|
const participant = this.getParticipantById(id);
|
|
@@ -1739,8 +1720,6 @@ JitsiConference.prototype.onTransportInfo = function(session, transportInfo) {
|
1739
|
1720
|
* @param {JitsiRemoteTrack} removedTrack
|
1740
|
1721
|
*/
|
1741
|
1722
|
JitsiConference.prototype.onRemoteTrackRemoved = function(removedTrack) {
|
1742
|
|
- // TODO: handle E2EE.
|
1743
|
|
-
|
1744
|
1723
|
this.getParticipants().forEach(participant => {
|
1745
|
1724
|
const tracks = participant.getTracks();
|
1746
|
1725
|
|
|
@@ -1879,6 +1858,8 @@ JitsiConference.prototype._acceptJvbIncomingCall = function(
|
1879
|
1858
|
this._setBridgeChannel(jingleOffer, jingleSession.peerconnection);
|
1880
|
1859
|
|
1881
|
1860
|
// Add local tracks to the session
|
|
1861
|
+ const localTracks = this.getLocalTracks();
|
|
1862
|
+
|
1882
|
1863
|
try {
|
1883
|
1864
|
jingleSession.acceptOffer(
|
1884
|
1865
|
jingleOffer,
|
|
@@ -1889,13 +1870,18 @@ JitsiConference.prototype._acceptJvbIncomingCall = function(
|
1889
|
1870
|
if (this.isP2PActive() && this.jvbJingleSession) {
|
1890
|
1871
|
this._suspendMediaTransferForJvbConnection();
|
1891
|
1872
|
}
|
|
1873
|
+
|
|
1874
|
+ // Setup E2EE.
|
|
1875
|
+ for (const track of localTracks) {
|
|
1876
|
+ this._setupSenderE2EEForTrack(track);
|
|
1877
|
+ }
|
1892
|
1878
|
},
|
1893
|
1879
|
error => {
|
1894
|
1880
|
GlobalOnErrorHandler.callErrorHandler(error);
|
1895
|
1881
|
logger.error(
|
1896
|
1882
|
'Failed to accept incoming Jingle session', error);
|
1897
|
1883
|
},
|
1898
|
|
- this.getLocalTracks()
|
|
1884
|
+ localTracks
|
1899
|
1885
|
);
|
1900
|
1886
|
|
1901
|
1887
|
// Start callstats as soon as peerconnection is initialized,
|
|
@@ -3327,3 +3313,43 @@ JitsiConference.prototype.setE2EEKey = function(key) {
|
3327
|
3313
|
|
3328
|
3314
|
this._e2eeCtx.setKey(key);
|
3329
|
3315
|
};
|
|
3316
|
+
|
|
3317
|
+/**
|
|
3318
|
+ * Setup E2EE for the sending side, if supported.
|
|
3319
|
+ * Note that this is only done for the JVB Peer Connecction.
|
|
3320
|
+ *
|
|
3321
|
+ * @returns {void}
|
|
3322
|
+ */
|
|
3323
|
+JitsiConference.prototype._setupSenderE2EEForTrack = function(track) {
|
|
3324
|
+ const jvbPc = this.jvbJingleSession ? this.jvbJingleSession.peerconnection : null;
|
|
3325
|
+
|
|
3326
|
+ if (jvbPc && this._e2eeCtx) {
|
|
3327
|
+ const sender = jvbPc.findSenderForTrack(track.track);
|
|
3328
|
+
|
|
3329
|
+ if (sender) {
|
|
3330
|
+ this._e2eeCtx.handleSender(sender, track.getType());
|
|
3331
|
+ } else {
|
|
3332
|
+ logger.warn(`Could not handle E2EE for local ${track.getType()} track: sender not found`);
|
|
3333
|
+ }
|
|
3334
|
+ }
|
|
3335
|
+};
|
|
3336
|
+
|
|
3337
|
+/**
|
|
3338
|
+ * Setup E2EE for the receiving side, if supported.
|
|
3339
|
+ * Note that this is only done for the JVB Peer Connecction.
|
|
3340
|
+ *
|
|
3341
|
+ * @returns {void}
|
|
3342
|
+ */
|
|
3343
|
+JitsiConference.prototype._setupReceiverE2EEForTrack = function(track) {
|
|
3344
|
+ const jvbPc = this.jvbJingleSession ? this.jvbJingleSession.peerconnection : null;
|
|
3345
|
+
|
|
3346
|
+ if (jvbPc && this._e2eeCtx) {
|
|
3347
|
+ const receiver = jvbPc.findReceiverForTrack(track.track);
|
|
3348
|
+
|
|
3349
|
+ if (receiver) {
|
|
3350
|
+ this._e2eeCtx.handleReceiver(receiver, track.getType());
|
|
3351
|
+ } else {
|
|
3352
|
+ logger.warn(`Could not handle E2EE for remote ${track.getType()} track: receiver not found`);
|
|
3353
|
+ }
|
|
3354
|
+ }
|
|
3355
|
+};
|