Skip to content

Commit

Permalink
Fix issues with setMaxVideoBW and updateSimulcastLayersBitrate (#1733)
Browse files Browse the repository at this point in the history
  • Loading branch information
lodoyun authored Jul 1, 2021
1 parent 28e6434 commit 2cccc6f
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions erizo_controller/erizoClient/src/Stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,14 @@ const Stream = (altConnectionHelpers, specInput) => {
const translated = (maxVideoBW * 1000 * 0.90) - (50 * 40 * 8);
log.info(`message: Setting maxVideoBW, streamId: ${that.getID()}, maxVideoBW: ${maxVideoBW}, translated: ${translated}`);
that.maxVideoBW = translated;
// Make sure all the current parameters respect the new limit
if (videoSenderLicodeParameters) {
Object.keys(videoSenderLicodeParameters).forEach((key) => {
const senderParam = videoSenderLicodeParameters[key];
senderParam.maxBitrate = senderParam.maxBitrate > that.maxVideoBW ?
that.maxVideoBW : senderParam.maxBitrate;
});
}
} else {
that.maxVideoBW = maxVideoBW;
}
Expand Down Expand Up @@ -617,16 +625,14 @@ const Stream = (altConnectionHelpers, specInput) => {
that.updateSimulcastLayersBitrate = (bitrates) => {
if (that.pc && that.local) {
// limit with maxVideoBW
const limitedBitrates = bitrates;
const limitedBitrates = Object.assign({}, bitrates);
Object.keys(limitedBitrates).forEach((key) => {
// explicitly passing undefined means assigning the max for that layer
if (limitedBitrates[key] > that.maxVideoBW || limitedBitrates[key] === undefined) {
log.info('message: updateSimulcastLayersBitrate defaulting to max bitrate,' +
`, layer :${key}, requested: ${limitedBitrates[key]}, max: ${that.maxVideoBW}`);
limitedBitrates[key] = that.maxVideoBW;
}
limitedBitrates[key] =
limitedBitrates[key] > that.maxVideoBW ? that.maxVideoBW : limitedBitrates[key];
});
setEncodingConfig('maxBitrate', limitedBitrates);
that.applySenderEncoderParameters();
Expand Down

0 comments on commit 2cccc6f

Please sign in to comment.