Skip to content
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

fix(E2EE): Switch to VP8 when E2EE is enabled. #2377

Merged
merged 1 commit into from
Oct 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 8 additions & 17 deletions modules/RTC/CodecSelection.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,20 +117,6 @@ export class CodecSelection {
.some(supportedCodec => supportedCodec.mimeType.toLowerCase() === `${MediaType.VIDEO}/${codec}`));
}

/**
* Filters VP9 from the list of the preferred video codecs for JVB if E2EE is enabled.
*
* @returns {Array}
*/
_maybeFilterJvbCodecs() {
// TODO - remove this check when support for VP9-E2EE is introduced.
if (this.conference.isE2EEEnabled()) {
return this.codecPreferenceOrder.jvb.filter(codec => codec !== CodecMimeType.VP9);
}

return this.codecPreferenceOrder.jvb;
}

/**
* Sets the codec on the media session based on the codec preference order configured in config.js and the supported
* codecs published by the remote participants in their presence.
Expand All @@ -144,9 +130,14 @@ export class CodecSelection {
return;
}
const currentCodecOrder = session.peerconnection.getConfiguredVideoCodecs();
const localPreferredCodecOrder = session === this.conference.jvbJingleSession
? this._maybeFilterJvbCodecs()
: this.codecPreferenceOrder.p2p;
const isJvbSession = session === this.conference.jvbJingleSession;

let localPreferredCodecOrder = isJvbSession ? this.codecPreferenceOrder.jvb : this.codecPreferenceOrder.p2p;

// E2EE is curently supported only for VP8 codec.
if (this.conference.isE2EEEnabled() && isJvbSession) {
localPreferredCodecOrder = [ CodecMimeType.VP8 ];
}

const remoteParticipants = this.conference.getParticipants().map(participant => participant.getId());
const remoteCodecsPerParticipant = remoteParticipants?.map(remote => {
Expand Down