|
@@ -33,6 +33,7 @@ export class CodecSelection {
|
33
|
33
|
this.conference = conference;
|
34
|
34
|
this.options = options;
|
35
|
35
|
this.codecPreferenceOrder = {};
|
|
36
|
+ this.visitorCodecs = [];
|
36
|
37
|
|
37
|
38
|
for (const connectionType of Object.keys(options)) {
|
38
|
39
|
// eslint-disable-next-line prefer-const
|
|
@@ -93,6 +94,9 @@ export class CodecSelection {
|
93
|
94
|
this.conference.on(
|
94
|
95
|
JitsiConferenceEvents._MEDIA_SESSION_STARTED,
|
95
|
96
|
session => this._selectPreferredCodec(session));
|
|
97
|
+ this.conference.on(
|
|
98
|
+ JitsiConferenceEvents.CONFERENCE_VISITOR_CODECS_CHANGED,
|
|
99
|
+ codecList => this._updateVisitorCodecs(codecList));
|
96
|
100
|
this.conference.on(
|
97
|
101
|
JitsiConferenceEvents.USER_JOINED,
|
98
|
102
|
() => this._selectPreferredCodec());
|
|
@@ -162,6 +166,9 @@ export class CodecSelection {
|
162
|
166
|
return [];
|
163
|
167
|
});
|
164
|
168
|
|
|
169
|
+ // Include the visitor codecs.
|
|
170
|
+ this.visitorCodecs.length && remoteCodecsPerParticipant.push(this.visitorCodecs);
|
|
171
|
+
|
165
|
172
|
const selectedCodecOrder = localPreferredCodecOrder.reduce((acc, localCodec) => {
|
166
|
173
|
let codecNotSupportedByRemote = false;
|
167
|
174
|
|
|
@@ -198,6 +205,21 @@ export class CodecSelection {
|
198
|
205
|
}
|
199
|
206
|
}
|
200
|
207
|
|
|
208
|
+ /**
|
|
209
|
+ * Updates the aggregate list of the codecs supported by all the visitors in the call and calculates the
|
|
210
|
+ * selected codec if needed.
|
|
211
|
+ * @param {Array} codecList - visitor codecs.
|
|
212
|
+ * @returns {void}
|
|
213
|
+ */
|
|
214
|
+ _updateVisitorCodecs(codecList) {
|
|
215
|
+ if (this.visitorCodecs === codecList) {
|
|
216
|
+ return;
|
|
217
|
+ }
|
|
218
|
+
|
|
219
|
+ this.visitorCodecs = codecList;
|
|
220
|
+ this._selectPreferredCodec();
|
|
221
|
+ }
|
|
222
|
+
|
201
|
223
|
/**
|
202
|
224
|
* Returns the current codec preference order for the given connection type.
|
203
|
225
|
*
|