瀏覽代碼

feat(video quality): add maxFullResolutionParticipants (#7403)

Add a config option with the default value of 2, which will cap the max recv video quality to SD if there's more than 2 participants in the conference while in the tile view mode.
j8
Paweł Domas 5 年之前
父節點
當前提交
b3b561f27a
沒有連結到貢獻者的電子郵件帳戶。
共有 3 個檔案被更改,包括 29 行新增2 行删除
  1. 4
    0
      config.js
  2. 1
    0
      react/features/base/config/configWhitelist.js
  3. 24
    2
      react/features/video-quality/middleware.js

+ 4
- 0
config.js 查看文件

@@ -123,6 +123,10 @@ var config = {
123 123
     // Sets the preferred resolution (height) for local video. Defaults to 720.
124 124
     // resolution: 720,
125 125
 
126
+    // How many participants while in the tile view mode, before the receiving video quality is reduced from HD to SD.
127
+    // Use -1 to disable.
128
+    // maxFullResolutionParticipants: 2
129
+
126 130
     // w3c spec-compliant video constraints to use for video capture. Currently
127 131
     // used by browsers that return true from lib-jitsi-meet's
128 132
     // util#browser#usesNewGumFlow. The constraints are independent from

+ 1
- 0
react/features/base/config/configWhitelist.js 查看文件

@@ -122,6 +122,7 @@ export default [
122 122
     'ignoreStartMuted',
123 123
     'liveStreamingEnabled',
124 124
     'localRecording',
125
+    'maxFullResolutionParticipants',
125 126
     'minParticipants',
126 127
     'nick',
127 128
     'openBridgeChannel',

+ 24
- 2
react/features/video-quality/middleware.js 查看文件

@@ -7,6 +7,7 @@ import {
7 7
     setMaxReceiverVideoQuality,
8 8
     setPreferredVideoQuality
9 9
 } from '../base/conference';
10
+import { getParticipantCount } from '../base/participants';
10 11
 import { MiddlewareRegistry, StateListenerRegistry } from '../base/redux';
11 12
 import { shouldDisplayTileView } from '../video-layout';
12 13
 
@@ -46,21 +47,42 @@ StateListenerRegistry.register(
46 47
         const { reducedUI } = state['features/base/responsive-ui'];
47 48
         const _shouldDisplayTileView = shouldDisplayTileView(state);
48 49
         const thumbnailSize = state['features/filmstrip']?.tileViewDimensions?.thumbnailSize;
50
+        const participantCount = getParticipantCount(state);
49 51
 
50 52
         return {
51 53
             displayTileView: _shouldDisplayTileView,
54
+            participantCount,
52 55
             reducedUI,
53 56
             thumbnailHeight: thumbnailSize?.height
54 57
         };
55 58
     },
56
-    /* listener */ ({ displayTileView, reducedUI, thumbnailHeight }, { dispatch, getState }) => {
57
-        const { maxReceiverVideoQuality } = getState()['features/base/conference'];
59
+    /* listener */ ({ displayTileView, participantCount, reducedUI, thumbnailHeight }, { dispatch, getState }) => {
60
+        const state = getState();
61
+        const { maxReceiverVideoQuality } = state['features/base/conference'];
62
+        const { maxFullResolutionParticipants = 2 } = state['features/base/config'];
63
+
58 64
         let newMaxRecvVideoQuality = VIDEO_QUALITY_LEVELS.HIGH;
59 65
 
60 66
         if (reducedUI) {
61 67
             newMaxRecvVideoQuality = VIDEO_QUALITY_LEVELS.LOW;
62 68
         } else if (displayTileView && !Number.isNaN(thumbnailHeight)) {
63 69
             newMaxRecvVideoQuality = getNearestReceiverVideoQualityLevel(thumbnailHeight);
70
+
71
+            // Override HD level calculated for the thumbnail height when # of participants threshold is exceeded
72
+            if (maxReceiverVideoQuality !== newMaxRecvVideoQuality && maxFullResolutionParticipants !== -1) {
73
+                const override
74
+                    = participantCount > maxFullResolutionParticipants
75
+                        && newMaxRecvVideoQuality > VIDEO_QUALITY_LEVELS.STANDARD;
76
+
77
+                logger.info(`The nearest receiver video quality level for thumbnail height: ${thumbnailHeight}, `
78
+                    + `is: ${newMaxRecvVideoQuality}, `
79
+                    + `override: ${String(override)}, `
80
+                    + `max full res N: ${maxFullResolutionParticipants}`);
81
+
82
+                if (override) {
83
+                    newMaxRecvVideoQuality = VIDEO_QUALITY_LEVELS.STANDARD;
84
+                }
85
+            }
64 86
         }
65 87
 
66 88
         if (maxReceiverVideoQuality !== newMaxRecvVideoQuality) {

Loading…
取消
儲存