|
|
|
|
|
|
2085
|
};
|
2085
|
};
|
|
2086
|
|
2086
|
|
|
2087
|
/**
|
2087
|
/**
|
|
2088
|
- * Configures the stream encodings depending on the video type and the bitrates configured.
|
|
|
|
|
|
2088
|
+ * Configures the stream encodings depending on the video type, scalability mode and the bitrate settings for the codec
|
|
|
|
2089
|
+ * that is currently selected.
|
|
2089
|
*
|
2090
|
*
|
|
2090
|
* @param {JitsiLocalTrack} - The local track for which the sender encodings have to configured.
|
2091
|
* @param {JitsiLocalTrack} - The local track for which the sender encodings have to configured.
|
|
2091
|
* @returns {Promise} promise that will be resolved when the operation is successful and rejected otherwise.
|
2092
|
* @returns {Promise} promise that will be resolved when the operation is successful and rejected otherwise.
|
|
|
|
|
|
|
2099
|
const promises = [];
|
2100
|
const promises = [];
|
|
2100
|
|
2101
|
|
|
2101
|
for (const track of this.getLocalVideoTracks()) {
|
2102
|
for (const track of this.getLocalVideoTracks()) {
|
|
2102
|
- promises.push(this.setSenderVideoConstraints(this._senderMaxHeights.get(track.getSourceName()), track));
|
|
|
|
|
|
2103
|
+ const maxHeight = this._senderMaxHeights.get(track.getSourceName()) ?? VIDEO_QUALITY_LEVELS[0].height;
|
|
|
|
2104
|
+
|
|
|
|
2105
|
+ promises.push(this.setSenderVideoConstraints(maxHeight, track));
|
|
2103
|
}
|
2106
|
}
|
|
2104
|
|
2107
|
|
|
2105
|
return Promise.allSettled(promises);
|
2108
|
return Promise.allSettled(promises);
|
|
|
|
|
|
|
2271
|
const activeState = this.tpcUtils.calculateEncodingsActiveState(localVideoTrack, codec, frameHeight);
|
2274
|
const activeState = this.tpcUtils.calculateEncodingsActiveState(localVideoTrack, codec, frameHeight);
|
|
2272
|
const scaleFactors = this.tpcUtils.calculateEncodingsScaleFactor(localVideoTrack, codec, frameHeight);
|
2275
|
const scaleFactors = this.tpcUtils.calculateEncodingsScaleFactor(localVideoTrack, codec, frameHeight);
|
|
2273
|
const scalabilityModes = this.tpcUtils.calculateEncodingsScalabilityMode(localVideoTrack, codec, frameHeight);
|
2276
|
const scalabilityModes = this.tpcUtils.calculateEncodingsScalabilityMode(localVideoTrack, codec, frameHeight);
|
|
|
|
2277
|
+ const sourceName = localVideoTrack.getSourceName();
|
|
2274
|
let needsUpdate = false;
|
2278
|
let needsUpdate = false;
|
|
2275
|
|
2279
|
|
|
2276
|
for (const idx in parameters.encodings) {
|
2280
|
for (const idx in parameters.encodings) {
|
|
|
|
|
|
|
2320
|
}
|
2324
|
}
|
|
2321
|
|
2325
|
|
|
2322
|
if (!needsUpdate) {
|
2326
|
if (!needsUpdate) {
|
|
|
|
2327
|
+ this._senderMaxHeights.set(sourceName, frameHeight);
|
|
|
|
2328
|
+
|
|
2323
|
return Promise.resolve();
|
2329
|
return Promise.resolve();
|
|
2324
|
}
|
2330
|
}
|
|
2325
|
|
2331
|
|
|
2326
|
logger.info(`${this} setting max height=${frameHeight},encodings=${JSON.stringify(parameters.encodings)}`);
|
2332
|
logger.info(`${this} setting max height=${frameHeight},encodings=${JSON.stringify(parameters.encodings)}`);
|
|
2327
|
|
2333
|
|
|
2328
|
return videoSender.setParameters(parameters).then(() => {
|
2334
|
return videoSender.setParameters(parameters).then(() => {
|
|
2329
|
- this._senderMaxHeights.set(localVideoTrack.getSourceName(), frameHeight);
|
|
|
|
|
|
2335
|
+ this._senderMaxHeights.set(sourceName, frameHeight);
|
|
2330
|
localVideoTrack.maxEnabledResolution = frameHeight;
|
2336
|
localVideoTrack.maxEnabledResolution = frameHeight;
|
|
2331
|
this.eventEmitter.emit(RTCEvents.LOCAL_TRACK_MAX_ENABLED_RESOLUTION_CHANGED, localVideoTrack);
|
2337
|
this.eventEmitter.emit(RTCEvents.LOCAL_TRACK_MAX_ENABLED_RESOLUTION_CHANGED, localVideoTrack);
|
|
2332
|
});
|
2338
|
});
|