|
@@ -1113,8 +1113,6 @@ JitsiConference.prototype._setupNewTrack = function(newTrack) {
|
1113
|
1113
|
newTrack._setConference(this);
|
1114
|
1114
|
|
1115
|
1115
|
this.eventEmitter.emit(JitsiConferenceEvents.TRACK_ADDED, newTrack);
|
1116
|
|
-
|
1117
|
|
- this._setupSenderE2EEForTrack(newTrack);
|
1118
|
1116
|
};
|
1119
|
1117
|
|
1120
|
1118
|
/**
|
|
@@ -1698,6 +1696,14 @@ JitsiConference.prototype.onRemoteTrackAdded = function(track) {
|
1698
|
1696
|
JitsiConference.prototype.onCallAccepted = function(session, answer) {
|
1699
|
1697
|
if (this.p2pJingleSession === session) {
|
1700
|
1698
|
logger.info('P2P setAnswer');
|
|
1699
|
+
|
|
1700
|
+ // Setup E2EE.
|
|
1701
|
+ const localTracks = this.getLocalTracks();
|
|
1702
|
+
|
|
1703
|
+ for (const track of localTracks) {
|
|
1704
|
+ this._setupSenderE2EEForTrack(session, track);
|
|
1705
|
+ }
|
|
1706
|
+
|
1701
|
1707
|
this.p2pJingleSession.setAnswer(answer);
|
1702
|
1708
|
}
|
1703
|
1709
|
};
|
|
@@ -1877,7 +1883,7 @@ JitsiConference.prototype._acceptJvbIncomingCall = function(
|
1877
|
1883
|
|
1878
|
1884
|
// Setup E2EE.
|
1879
|
1885
|
for (const track of localTracks) {
|
1880
|
|
- this._setupSenderE2EEForTrack(track);
|
|
1886
|
+ this._setupSenderE2EEForTrack(jingleSession, track);
|
1881
|
1887
|
}
|
1882
|
1888
|
},
|
1883
|
1889
|
error => {
|
|
@@ -2637,6 +2643,11 @@ JitsiConference.prototype._acceptP2PIncomingCall = function(
|
2637
|
2643
|
jingleOffer,
|
2638
|
2644
|
() => {
|
2639
|
2645
|
logger.debug('Got RESULT for P2P "session-accept"');
|
|
2646
|
+
|
|
2647
|
+ // Setup E2EE.
|
|
2648
|
+ for (const track of localTracks) {
|
|
2649
|
+ this._setupSenderE2EEForTrack(jingleSession, track);
|
|
2650
|
+ }
|
2640
|
2651
|
},
|
2641
|
2652
|
error => {
|
2642
|
2653
|
logger.error(
|
|
@@ -3324,17 +3335,17 @@ JitsiConference.prototype.setE2EEKey = function(key) {
|
3324
|
3335
|
*
|
3325
|
3336
|
* @returns {void}
|
3326
|
3337
|
*/
|
3327
|
|
-JitsiConference.prototype._setupSenderE2EEForTrack = function(track) {
|
3328
|
|
- const jvbPc = this.jvbJingleSession ? this.jvbJingleSession.peerconnection : null;
|
3329
|
|
-
|
3330
|
|
- if (jvbPc && this._e2eeCtx) {
|
3331
|
|
- const sender = jvbPc.findSenderForTrack(track.track);
|
|
3338
|
+JitsiConference.prototype._setupSenderE2EEForTrack = function(session, track) {
|
|
3339
|
+ if (!this._e2eeCtx) {
|
|
3340
|
+ return;
|
|
3341
|
+ }
|
|
3342
|
+ const pc = session.peerconnection;
|
|
3343
|
+ const sender = pc.findSenderForTrack(track.track);
|
3332
|
3344
|
|
3333
|
|
- if (sender) {
|
3334
|
|
- this._e2eeCtx.handleSender(sender, track.getType());
|
3335
|
|
- } else {
|
3336
|
|
- logger.warn(`Could not handle E2EE for local ${track.getType()} track: sender not found`);
|
3337
|
|
- }
|
|
3345
|
+ if (sender) {
|
|
3346
|
+ this._e2eeCtx.handleSender(sender, track.getType());
|
|
3347
|
+ } else {
|
|
3348
|
+ logger.warn(`Could not handle E2EE for local ${track.getType()} track: sender not found`);
|
3338
|
3349
|
}
|
3339
|
3350
|
};
|
3340
|
3351
|
|
|
@@ -3345,10 +3356,14 @@ JitsiConference.prototype._setupSenderE2EEForTrack = function(track) {
|
3345
|
3356
|
* @returns {void}
|
3346
|
3357
|
*/
|
3347
|
3358
|
JitsiConference.prototype._setupReceiverE2EEForTrack = function(track) {
|
3348
|
|
- const jvbPc = this.jvbJingleSession ? this.jvbJingleSession.peerconnection : null;
|
|
3359
|
+ if (!this._e2eeCtx) {
|
|
3360
|
+ return;
|
|
3361
|
+ }
|
|
3362
|
+ const session = track.isP2P ? this.p2pJingleSession : this.jvbJingleSession;
|
|
3363
|
+ const pc = session && session.peerconnection;
|
3349
|
3364
|
|
3350
|
|
- if (jvbPc && this._e2eeCtx) {
|
3351
|
|
- const receiver = jvbPc.findReceiverForTrack(track.track);
|
|
3365
|
+ if (pc) {
|
|
3366
|
+ const receiver = pc.findReceiverForTrack(track.track);
|
3352
|
3367
|
|
3353
|
3368
|
if (receiver) {
|
3354
|
3369
|
this._e2eeCtx.handleReceiver(receiver, track.getType());
|