Ver código fonte

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 anos atrás
pai
commit
b3b561f27a
Nenhuma conta vinculada ao e-mail do autor do commit

+ 4
- 0
config.js Ver arquivo

123
     // Sets the preferred resolution (height) for local video. Defaults to 720.
123
     // Sets the preferred resolution (height) for local video. Defaults to 720.
124
     // resolution: 720,
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
     // w3c spec-compliant video constraints to use for video capture. Currently
130
     // w3c spec-compliant video constraints to use for video capture. Currently
127
     // used by browsers that return true from lib-jitsi-meet's
131
     // used by browsers that return true from lib-jitsi-meet's
128
     // util#browser#usesNewGumFlow. The constraints are independent from
132
     // util#browser#usesNewGumFlow. The constraints are independent from

+ 1
- 0
react/features/base/config/configWhitelist.js Ver arquivo

122
     'ignoreStartMuted',
122
     'ignoreStartMuted',
123
     'liveStreamingEnabled',
123
     'liveStreamingEnabled',
124
     'localRecording',
124
     'localRecording',
125
+    'maxFullResolutionParticipants',
125
     'minParticipants',
126
     'minParticipants',
126
     'nick',
127
     'nick',
127
     'openBridgeChannel',
128
     'openBridgeChannel',

+ 24
- 2
react/features/video-quality/middleware.js Ver arquivo

7
     setMaxReceiverVideoQuality,
7
     setMaxReceiverVideoQuality,
8
     setPreferredVideoQuality
8
     setPreferredVideoQuality
9
 } from '../base/conference';
9
 } from '../base/conference';
10
+import { getParticipantCount } from '../base/participants';
10
 import { MiddlewareRegistry, StateListenerRegistry } from '../base/redux';
11
 import { MiddlewareRegistry, StateListenerRegistry } from '../base/redux';
11
 import { shouldDisplayTileView } from '../video-layout';
12
 import { shouldDisplayTileView } from '../video-layout';
12
 
13
 
46
         const { reducedUI } = state['features/base/responsive-ui'];
47
         const { reducedUI } = state['features/base/responsive-ui'];
47
         const _shouldDisplayTileView = shouldDisplayTileView(state);
48
         const _shouldDisplayTileView = shouldDisplayTileView(state);
48
         const thumbnailSize = state['features/filmstrip']?.tileViewDimensions?.thumbnailSize;
49
         const thumbnailSize = state['features/filmstrip']?.tileViewDimensions?.thumbnailSize;
50
+        const participantCount = getParticipantCount(state);
49
 
51
 
50
         return {
52
         return {
51
             displayTileView: _shouldDisplayTileView,
53
             displayTileView: _shouldDisplayTileView,
54
+            participantCount,
52
             reducedUI,
55
             reducedUI,
53
             thumbnailHeight: thumbnailSize?.height
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
         let newMaxRecvVideoQuality = VIDEO_QUALITY_LEVELS.HIGH;
64
         let newMaxRecvVideoQuality = VIDEO_QUALITY_LEVELS.HIGH;
59
 
65
 
60
         if (reducedUI) {
66
         if (reducedUI) {
61
             newMaxRecvVideoQuality = VIDEO_QUALITY_LEVELS.LOW;
67
             newMaxRecvVideoQuality = VIDEO_QUALITY_LEVELS.LOW;
62
         } else if (displayTileView && !Number.isNaN(thumbnailHeight)) {
68
         } else if (displayTileView && !Number.isNaN(thumbnailHeight)) {
63
             newMaxRecvVideoQuality = getNearestReceiverVideoQualityLevel(thumbnailHeight);
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
         if (maxReceiverVideoQuality !== newMaxRecvVideoQuality) {
88
         if (maxReceiverVideoQuality !== newMaxRecvVideoQuality) {

Carregando…
Cancelar
Salvar