From a131644dfb58a3832a17bbf70ec85c91bed7cc3b Mon Sep 17 00:00:00 2001 From: Robert Pintilii Date: Thu, 17 Mar 2022 14:18:49 +0200 Subject: [PATCH] fix(video-constraints) Fix calculations (#11161) Only calculate for Large Video on the web (otherwise native breaks) Take preferred max into calculations --- react/features/video-quality/subscriber.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/react/features/video-quality/subscriber.js b/react/features/video-quality/subscriber.js index b94fd2556..cc96ee8ca 100644 --- a/react/features/video-quality/subscriber.js +++ b/react/features/video-quality/subscriber.js @@ -279,14 +279,16 @@ function _updateReceiverVideoConstraints({ getState }) { const qualityLevel = getVideoQualityForResizableFilmstripThumbnails(state); visibleRemoteTrackSourceNames.forEach(sourceName => { - receiverConstraints.constraints[sourceName] = { 'maxHeight': qualityLevel }; + receiverConstraints.constraints[sourceName] = { 'maxHeight': Math.min(qualityLevel, + maxFrameHeight) }; }); } if (largeVideoSourceName) { let quality = maxFrameHeight; - if (!remoteScreenShares.find(id => id === largeVideoParticipantId)) { + if (navigator.product !== 'ReactNative' + && !remoteScreenShares.find(id => id === largeVideoParticipantId)) { quality = getVideoQualityForLargeVideo(); } receiverConstraints.constraints[largeVideoSourceName] = { 'maxHeight': quality }; @@ -326,14 +328,16 @@ function _updateReceiverVideoConstraints({ getState }) { const qualityLevel = getVideoQualityForResizableFilmstripThumbnails(state); visibleRemoteParticipants.forEach(participantId => { - receiverConstraints.constraints[participantId] = { 'maxHeight': qualityLevel }; + receiverConstraints.constraints[participantId] = { 'maxHeight': Math.min(qualityLevel, + maxFrameHeight) }; }); } if (largeVideoParticipantId) { let quality = maxFrameHeight; - if (!remoteScreenShares.find(id => id === largeVideoParticipantId)) { + if (navigator.product !== 'ReactNative' + && !remoteScreenShares.find(id => id === largeVideoParticipantId)) { quality = getVideoQualityForLargeVideo(); } receiverConstraints.constraints[largeVideoParticipantId] = { 'maxHeight': quality };