|
@@ -31,6 +31,7 @@ export class CodecSelection {
|
31
|
31
|
*/
|
32
|
32
|
constructor(conference, options) {
|
33
|
33
|
this.conference = conference;
|
|
34
|
+ this.options = options;
|
34
|
35
|
|
35
|
36
|
// VP8 cannot be disabled and it will be the default codec when no preference is set.
|
36
|
37
|
this.disabledCodec = options.disabledCodec === CodecMimeType.VP8
|
|
@@ -43,7 +44,8 @@ export class CodecSelection {
|
43
|
44
|
|
44
|
45
|
this.jvbPreferredCodec = jvbCodec && this._isCodecSupported(jvbCodec) ? jvbCodec : CodecMimeType.VP8;
|
45
|
46
|
this.p2pPreferredCodec = p2pCodec && this._isCodecSupported(p2pCodec) ? p2pCodec : CodecMimeType.VP8;
|
46
|
|
- this.enforcePreferredCodec = options.enforcePreferredCodec;
|
|
47
|
+ logger.debug(`Codec preferences for the conference are JVB: ${this.jvbPreferredCodec},
|
|
48
|
+ P2P: ${this.p2pPreferredCodec}`);
|
47
|
49
|
|
48
|
50
|
// Do not prefer VP9 on Firefox because of the following bug.
|
49
|
51
|
// https://bugzilla.mozilla.org/show_bug.cgi?id=1633876
|
|
@@ -129,25 +131,23 @@ export class CodecSelection {
|
129
|
131
|
_onParticipantJoined(id) {
|
130
|
132
|
const session = this.conference.jvbJingleSession;
|
131
|
133
|
|
132
|
|
- if (session && !this.enforcePreferredCodec) {
|
|
134
|
+ if (session && !this.options.enforcePreferredCodec) {
|
133
|
135
|
const peerMediaInfo = session.signalingLayer.getPeerMediaInfo(id, MediaType.VIDEO);
|
134
|
136
|
|
135
|
|
- if (peerMediaInfo) {
|
136
|
|
- const newCodec = peerMediaInfo.codecType;
|
137
|
|
- const currentCodec = session.getConfiguredVideoCodec();
|
138
|
|
-
|
139
|
|
- // Add the participant to the list of participants that
|
140
|
|
- // don't support the preferred codec.
|
141
|
|
- if (newCodec !== this.jvbPreferredCodec) {
|
142
|
|
- this.nonPreferredParticipants.push(id);
|
143
|
|
- }
|
144
|
|
- logger.warn(`Current: ${currentCodec}, new: ${newCodec}`);
|
145
|
|
- if (newCodec
|
146
|
|
- && newCodec !== this.jvbPreferredCodec
|
147
|
|
- && newCodec !== currentCodec
|
148
|
|
- && this._isCodecSupported(newCodec)) {
|
149
|
|
- session.setVideoCodecs(newCodec);
|
150
|
|
- }
|
|
137
|
+ if (!peerMediaInfo) {
|
|
138
|
+ return;
|
|
139
|
+ }
|
|
140
|
+ const newCodec = peerMediaInfo.codecType;
|
|
141
|
+ const currentCodec = session.getConfiguredVideoCodec();
|
|
142
|
+
|
|
143
|
+ if (newCodec
|
|
144
|
+ && newCodec !== this.jvbPreferredCodec
|
|
145
|
+ && newCodec !== currentCodec
|
|
146
|
+ && this._isCodecSupported(newCodec)) {
|
|
147
|
+
|
|
148
|
+ // Add the participant to the list of participants that don't support the preferred codec.
|
|
149
|
+ this.nonPreferredParticipants.push(id);
|
|
150
|
+ session.setVideoCodecs(newCodec);
|
151
|
151
|
}
|
152
|
152
|
}
|
153
|
153
|
}
|
|
@@ -164,7 +164,7 @@ export class CodecSelection {
|
164
|
164
|
_onParticipantLeft(id) {
|
165
|
165
|
const session = this.conference.jvbJingleSession;
|
166
|
166
|
|
167
|
|
- if (session && !this.enforcePreferredCodec) {
|
|
167
|
+ if (session && !this.options.enforcePreferredCodec) {
|
168
|
168
|
const index = this.nonPreferredParticipants.findIndex(participantId => participantId === id);
|
169
|
169
|
|
170
|
170
|
if (index > -1) {
|