-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
e2ee: also enable on p2p connections #1107
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1113,8 +1113,6 @@ JitsiConference.prototype._setupNewTrack = function(newTrack) { | |
newTrack._setConference(this); | ||
|
||
this.eventEmitter.emit(JitsiConferenceEvents.TRACK_ADDED, newTrack); | ||
|
||
this._setupSenderE2EEForTrack(newTrack); | ||
}; | ||
|
||
/** | ||
|
@@ -1694,6 +1692,14 @@ JitsiConference.prototype.onRemoteTrackAdded = function(track) { | |
JitsiConference.prototype.onCallAccepted = function(session, answer) { | ||
if (this.p2pJingleSession === session) { | ||
logger.info('P2P setAnswer'); | ||
|
||
// Setup E2EE. | ||
const localTracks = this.getLocalTracks(); | ||
|
||
for (const track of localTracks) { | ||
this._setupSenderE2EEForTrack(session, track); | ||
} | ||
|
||
this.p2pJingleSession.setAnswer(answer); | ||
} | ||
}; | ||
|
@@ -1873,7 +1879,7 @@ JitsiConference.prototype._acceptJvbIncomingCall = function( | |
|
||
// Setup E2EE. | ||
for (const track of localTracks) { | ||
this._setupSenderE2EEForTrack(track); | ||
this._setupSenderE2EEForTrack(jingleSession, track); | ||
} | ||
}, | ||
error => { | ||
|
@@ -2633,6 +2639,11 @@ JitsiConference.prototype._acceptP2PIncomingCall = function( | |
jingleOffer, | ||
() => { | ||
logger.debug('Got RESULT for P2P "session-accept"'); | ||
|
||
// Setup E2EE. | ||
for (const track of localTracks) { | ||
this._setupSenderE2EEForTrack(jingleSession, track); | ||
} | ||
}, | ||
error => { | ||
logger.error( | ||
|
@@ -3320,17 +3331,17 @@ JitsiConference.prototype.setE2EEKey = function(key) { | |
* | ||
* @returns {void} | ||
*/ | ||
JitsiConference.prototype._setupSenderE2EEForTrack = function(track) { | ||
const jvbPc = this.jvbJingleSession ? this.jvbJingleSession.peerconnection : null; | ||
|
||
if (jvbPc && this._e2eeCtx) { | ||
const sender = jvbPc.findSenderForTrack(track.track); | ||
JitsiConference.prototype._setupSenderE2EEForTrack = function(session, track) { | ||
if (!this._e2eeCtx) { | ||
return; | ||
} | ||
const pc = session.peerconnection; | ||
const sender = pc.findSenderForTrack(track.track); | ||
|
||
if (sender) { | ||
this._e2eeCtx.handleSender(sender, track.getType()); | ||
} else { | ||
logger.warn(`Could not handle E2EE for local ${track.getType()} track: sender not found`); | ||
} | ||
if (sender) { | ||
this._e2eeCtx.handleSender(sender, track.getType()); | ||
} else { | ||
logger.warn(`Could not handle E2EE for local ${track.getType()} track: sender not found`); | ||
} | ||
}; | ||
|
||
|
@@ -3341,10 +3352,14 @@ JitsiConference.prototype._setupSenderE2EEForTrack = function(track) { | |
* @returns {void} | ||
*/ | ||
JitsiConference.prototype._setupReceiverE2EEForTrack = function(track) { | ||
const jvbPc = this.jvbJingleSession ? this.jvbJingleSession.peerconnection : null; | ||
if (!this._e2eeCtx) { | ||
return; | ||
} | ||
const session = track.isP2P ? this.p2pJingleSession : this.jvbJingleSession; | ||
const pc = session && session.peerconnection; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. use |
||
|
||
if (jvbPc && this._e2eeCtx) { | ||
const receiver = jvbPc.findReceiverForTrack(track.track); | ||
if (pc) { | ||
const receiver = pc.findReceiverForTrack(track.track); | ||
|
||
if (receiver) { | ||
this._e2eeCtx.handleReceiver(receiver, track.getType()); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We ccould use geetActiveTPC` here as well instead of passsing the session around.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but I want the peerconnection the track is received on, no matter what the current establishment status of the p2p ice connection is?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is taken care of by caller function already, isn't it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, this is called from JitsiConference.prototype.onCallAccepted (line 1701) for p2p and JitsiConference.prototype._acceptJvbIncomingCall for the sfu call. In both cases we know exactly where this is originating
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, gotcha.