瀏覽代碼

rn,flags: add ability to override resolution using a flag

Also, use the configured resolution to set it as the max received frame size.
master
Saúl Ibarra Corretgé 4 年之前
父節點
當前提交
7d513738d2

+ 1
- 0
react/features/app/middlewares.any.js 查看文件

@@ -41,6 +41,7 @@ import '../subtitles/middleware';
41 41
 import '../toolbox/middleware';
42 42
 import '../transcribing/middleware';
43 43
 import '../video-layout/middleware';
44
+import '../video-quality/middleware';
44 45
 import '../videosipgw/middleware';
45 46
 
46 47
 import './middleware';

+ 4
- 1
react/features/base/conference/middleware.js 查看文件

@@ -460,7 +460,10 @@ function _sendTones({ getState }, next, action) {
460 460
  */
461 461
 function _setReceiverVideoConstraint(conference, preferred, max) {
462 462
     if (conference) {
463
-        conference.setReceiverVideoConstraint(Math.min(preferred, max));
463
+        const value = Math.min(preferred, max);
464
+
465
+        conference.setReceiverVideoConstraint(value);
466
+        logger.info(`setReceiverVideoConstraint: ${value}`);
464 467
     }
465 468
 }
466 469
 

+ 7
- 0
react/features/base/config/middleware.js 查看文件

@@ -3,6 +3,7 @@
3 3
 import { jitsiLocalStorage } from 'js-utils';
4 4
 
5 5
 import { APP_WILL_MOUNT } from '../app';
6
+import { getFeatureFlag } from '../flags/functions';
6 7
 import { addKnownDomains } from '../known-domains';
7 8
 import { MiddlewareRegistry } from '../redux';
8 9
 import { parseURIString } from '../util';
@@ -107,6 +108,12 @@ function _setConfig({ dispatch, getState }, next, action) {
107 108
         config.p2p = { enabled: !settings.disableP2P };
108 109
     }
109 110
 
111
+    const resolutionFlag = getFeatureFlag(state, 'resolution');
112
+
113
+    if (typeof resolutionFlag !== 'undefined') {
114
+        config.resolution = resolutionFlag;
115
+    }
116
+
110 117
     dispatch({
111 118
         type: _UPDATE_CONFIG,
112 119
         config

+ 7
- 0
react/features/base/flags/constants.js 查看文件

@@ -81,6 +81,13 @@ export const RAISE_HAND_ENABLED = 'raise-hand.enabled';
81 81
  */
82 82
 export const RECORDING_ENABLED = 'recording.enabled';
83 83
 
84
+/**
85
+ * Flag indicating the local and (maximum) remote video resolution. Overrides
86
+ * the server configuration.
87
+ * Default: (unset).
88
+ */
89
+export const RESOLUTION = 'resolution';
90
+
84 91
 /**
85 92
  * Flag indicating if server URL change is enabled.
86 93
  * Default: enabled (true)

+ 2
- 2
react/features/conference/middleware.js 查看文件

@@ -6,7 +6,7 @@ import {
6 6
     VIDEO_QUALITY_LEVELS,
7 7
     conferenceLeft,
8 8
     getCurrentConference,
9
-    setPreferredVideoQuality
9
+    setMaxReceiverVideoQuality
10 10
 } from '../base/conference';
11 11
 import { hideDialog, isDialogOpen } from '../base/dialog';
12 12
 import { setActiveModalId } from '../base/modal';
@@ -33,7 +33,7 @@ MiddlewareRegistry.register(store => next => action => {
33 33
         dispatch(setFilmstripEnabled(!reducedUI));
34 34
 
35 35
         dispatch(
36
-            setPreferredVideoQuality(
36
+            setMaxReceiverVideoQuality(
37 37
                 reducedUI
38 38
                     ? VIDEO_QUALITY_LEVELS.LOW
39 39
                     : VIDEO_QUALITY_LEVELS.HIGH));

+ 1
- 2
react/features/video-layout/subscriber.js 查看文件

@@ -32,8 +32,7 @@ StateListenerRegistry.register(
32 32
         dispatch(selectParticipant());
33 33
 
34 34
         if (!displayTileView) {
35
-            dispatch(
36
-                setMaxReceiverVideoQuality(VIDEO_QUALITY_LEVELS.HIGH));
35
+            dispatch(setMaxReceiverVideoQuality(VIDEO_QUALITY_LEVELS.HIGH));
37 36
 
38 37
             if (_getAutoPinSetting()) {
39 38
                 _updateAutoPinnedParticipant(store);

+ 33
- 0
react/features/video-quality/middleware.js 查看文件

@@ -0,0 +1,33 @@
1
+// @flow
2
+
3
+import { CONFERENCE_JOINED } from '../base/conference/actionTypes';
4
+import { setPreferredVideoQuality } from '../base/conference/actions';
5
+import { MiddlewareRegistry } from '../base/redux';
6
+
7
+import logger from './logger';
8
+
9
+/**
10
+ * Implements the middleware of the feature video-quality.
11
+ *
12
+ * @param {Store} store - The redux store.
13
+ * @returns {Function}
14
+ */
15
+MiddlewareRegistry.register(({ dispatch, getState }) => next => action => {
16
+    const result = next(action);
17
+
18
+    switch (action.type) {
19
+    case CONFERENCE_JOINED: {
20
+        if (navigator.product === 'ReactNative') {
21
+            const { resolution } = getState()['features/base/config'];
22
+
23
+            if (typeof resolution !== 'undefined') {
24
+                dispatch(setPreferredVideoQuality(Number.parseInt(resolution, 10)));
25
+                logger.info(`Configured preferred receiver video frame height to: ${resolution}`);
26
+            }
27
+        }
28
+        break;
29
+    }
30
+    }
31
+
32
+    return result;
33
+});

Loading…
取消
儲存