Merge pull request #12368 from prlanzarin/u23-eole

fix(video): check if encodings array is empty before trying to apply bitrate
This commit is contained in:
Anton Georgiev 2021-05-12 16:08:04 -04:00 committed by GitHub
commit 6f9096f410
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 4 deletions

View File

@ -280,8 +280,7 @@ class VideoProvider extends Component {
this.disconnectStreams(streamsToDisconnect);
if (CAMERA_QUALITY_THRESHOLDS_ENABLED) {
const floorStream = streams.find(vs => vs.floor === true);
this.updateThreshold(this.props.totalNumberOfStreams, floorStream);
this.updateThreshold(this.props.totalNumberOfStreams);
}
}

View File

@ -691,11 +691,14 @@ class VideoService {
const { track } = sender;
if (track && track.kind === 'video') {
const parameters = sender.getParameters();
if (!parameters.encodings) {
const normalizedBitrate = bitrate * 1000;
// The encoder parameters might not be up yet; if that's the case,
// add a filler object so we can alter the parameters anyways
if (parameters.encodings == null || parameters.encodings.length === 0) {
parameters.encodings = [{}];
}
const normalizedBitrate = bitrate * 1000;
// Only reset bitrate if it changed in some way to avoid enconder fluctuations
if (parameters.encodings[0].maxBitrate !== normalizedBitrate) {
parameters.encodings[0].maxBitrate = normalizedBitrate;