Skip to content

Commit

Permalink
fix(E2EE): Switch to VP8 when E2EE is enabled.
Browse files Browse the repository at this point in the history
No other codecs are supported currently.
  • Loading branch information
jallamsetty1 authored and subhamcyara committed Jul 19, 2024
1 parent 8e337be commit 9aaf25b
Showing 1 changed file with 8 additions and 17 deletions.
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

0 comments on commit 9aaf25b

Please sign in to comment.