Переглянути джерело

fix(CodecSelection) Switch codec to VP8 when E2EE is enabled. (#2322)

release-8443
Jaya Allamsetty 2 роки тому
джерело
коміт
739d802595
Аккаунт користувача з таким Email не знайдено
2 змінених файлів з 30 додано та 3 видалено
  1. 22
    3
      modules/RTC/CodecSelection.js
  2. 8
    0
      modules/RTC/CodecSelection.spec.js

+ 22
- 3
modules/RTC/CodecSelection.js Переглянути файл

@@ -70,12 +70,17 @@ export class CodecSelection {
70 70
             // Push VP9 to the end of the list so that the client continues to decode VP9 even if its not
71 71
             // preferable to encode VP9 (because of browser bugs on the encoding side or added complexity on mobile
72 72
             // devices).
73
-            if (!browser.supportsVP9()) {
73
+            if (!browser.supportsVP9() || this.conference.isE2EEEnabled()) {
74 74
                 const index = selectedOrder.findIndex(codec => codec === CodecMimeType.VP9);
75 75
 
76 76
                 if (index !== -1) {
77 77
                     selectedOrder.splice(index, 1);
78
-                    selectedOrder.push(CodecMimeType.VP9);
78
+
79
+                    // Remove VP9 from the list when E2EE is enabled since it is not supported.
80
+                    // TODO - remove this check when support for VP9-E2EE is introduced.
81
+                    if (!this.conference.isE2EEEnabled()) {
82
+                        selectedOrder.push(CodecMimeType.VP9);
83
+                    }
79 84
                 }
80 85
             }
81 86
 
@@ -110,6 +115,20 @@ export class CodecSelection {
110 115
                 .some(supportedCodec => supportedCodec.mimeType.toLowerCase() === `${MediaType.VIDEO}/${codec}`));
111 116
     }
112 117
 
118
+    /**
119
+     * Filters VP9 from the list of the preferred video codecs for JVB if E2EE is enabled.
120
+     *
121
+     * @returns {Array}
122
+     */
123
+    _maybeFilterJvbCodecs() {
124
+        // TODO - remove this check when support for VP9-E2EE is introduced.
125
+        if (this.conference.isE2EEEnabled()) {
126
+            return this.codecPreferenceOrder.jvb.filter(codec => codec !== CodecMimeType.VP9);
127
+        }
128
+
129
+        return this.codecPreferenceOrder.jvb;
130
+    }
131
+
113 132
     /**
114 133
      * Sets the codec on the media session based on the codec preference order configured in config.js and the supported
115 134
      * codecs published by the remote participants in their presence.
@@ -124,7 +143,7 @@ export class CodecSelection {
124 143
         }
125 144
         const currentCodecOrder = session.peerconnection.getConfiguredVideoCodecs();
126 145
         const localPreferredCodecOrder = session === this.conference.jvbJingleSession
127
-            ? this.codecPreferenceOrder.jvb
146
+            ? this._maybeFilterJvbCodecs()
128 147
             : this.codecPreferenceOrder.p2p;
129 148
 
130 149
         const remoteParticipants = this.conference.getParticipants().map(participant => participant.getId());

+ 8
- 0
modules/RTC/CodecSelection.spec.js Переглянути файл

@@ -68,6 +68,14 @@ class MockConference extends Listenable {
68 68
         return this.participants;
69 69
     }
70 70
 
71
+    /**
72
+     * Checks if E2EE is enabled.
73
+     * @returns {boolean}
74
+     */
75
+    isE2EEEnabled() {
76
+        return false;
77
+    }
78
+
71 79
     /**
72 80
      * Removes the participant from the conference.
73 81
      * @param {MockParticipant} endpoint

Завантаження…
Відмінити
Зберегти