Browse Source

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

Also, use the configured resolution to set it as the max received frame size.
j8
Saúl Ibarra Corretgé 5 years ago
parent
commit
7d513738d2

+ 1
- 0
react/features/app/middlewares.any.js View File

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

+ 4
- 1
react/features/base/conference/middleware.js View File

460
  */
460
  */
461
 function _setReceiverVideoConstraint(conference, preferred, max) {
461
 function _setReceiverVideoConstraint(conference, preferred, max) {
462
     if (conference) {
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 View File

3
 import { jitsiLocalStorage } from 'js-utils';
3
 import { jitsiLocalStorage } from 'js-utils';
4
 
4
 
5
 import { APP_WILL_MOUNT } from '../app';
5
 import { APP_WILL_MOUNT } from '../app';
6
+import { getFeatureFlag } from '../flags/functions';
6
 import { addKnownDomains } from '../known-domains';
7
 import { addKnownDomains } from '../known-domains';
7
 import { MiddlewareRegistry } from '../redux';
8
 import { MiddlewareRegistry } from '../redux';
8
 import { parseURIString } from '../util';
9
 import { parseURIString } from '../util';
107
         config.p2p = { enabled: !settings.disableP2P };
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
     dispatch({
117
     dispatch({
111
         type: _UPDATE_CONFIG,
118
         type: _UPDATE_CONFIG,
112
         config
119
         config

+ 7
- 0
react/features/base/flags/constants.js View File

81
  */
81
  */
82
 export const RECORDING_ENABLED = 'recording.enabled';
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
  * Flag indicating if server URL change is enabled.
92
  * Flag indicating if server URL change is enabled.
86
  * Default: enabled (true)
93
  * Default: enabled (true)

+ 2
- 2
react/features/conference/middleware.js View File

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

+ 1
- 2
react/features/video-layout/subscriber.js View File

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

+ 33
- 0
react/features/video-quality/middleware.js View File

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…
Cancel
Save