From 9aaf25bfec60b2ac1b9373b2238b2fe21542c488 Mon Sep 17 00:00:00 2001 From: Jaya Allamsetty Date: Tue, 17 Oct 2023 12:38:22 -0400 Subject: [PATCH] fix(E2EE): Switch to VP8 when E2EE is enabled. No other codecs are supported currently. --- modules/RTC/CodecSelection.js | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/modules/RTC/CodecSelection.js b/modules/RTC/CodecSelection.js index a592edd6a0..48e5671fed 100644 --- a/modules/RTC/CodecSelection.js +++ b/modules/RTC/CodecSelection.js @@ -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. @@ -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 => {