浏览代码

ref: one place for setting max recv frame height

Moves the logic from all different places into single state
listener to combine all inputs into a single output.
master
paweldomas 5 年前
父节点
当前提交
bf7aa39947

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

3
 import {
3
 import {
4
     CONFERENCE_JOINED,
4
     CONFERENCE_JOINED,
5
     KICKED_OUT,
5
     KICKED_OUT,
6
-    VIDEO_QUALITY_LEVELS,
7
     conferenceLeft,
6
     conferenceLeft,
8
-    getCurrentConference,
9
-    setPreferredVideoQuality
7
+    getCurrentConference
10
 } from '../base/conference';
8
 } from '../base/conference';
11
 import { hideDialog, isDialogOpen } from '../base/dialog';
9
 import { hideDialog, isDialogOpen } from '../base/dialog';
12
 import { setActiveModalId } from '../base/modal';
10
 import { setActiveModalId } from '../base/modal';
32
         dispatch(setToolboxEnabled(!reducedUI));
30
         dispatch(setToolboxEnabled(!reducedUI));
33
         dispatch(setFilmstripEnabled(!reducedUI));
31
         dispatch(setFilmstripEnabled(!reducedUI));
34
 
32
 
35
-        dispatch(
36
-            setPreferredVideoQuality(
37
-                reducedUI
38
-                    ? VIDEO_QUALITY_LEVELS.LOW
39
-                    : VIDEO_QUALITY_LEVELS.HIGH));
40
-
41
         break;
33
         break;
42
     }
34
     }
43
 
35
 

+ 13
- 1
react/features/filmstrip/actionTypes.js 查看文件

34
  *
34
  *
35
  * {
35
  * {
36
  *     type: SET_TILE_VIEW_DIMENSIONS,
36
  *     type: SET_TILE_VIEW_DIMENSIONS,
37
- *     dimensions: Object
37
+ *     dimensions: {
38
+ *         gridDimensions: {
39
+ *             columns: number,
40
+ *             height: number,
41
+ *             visibleRows: number,
42
+ *             width: number
43
+ *         },
44
+ *         thumbnailSize: {
45
+ *             height: number,
46
+ *             width: number
47
+ *         },
48
+ *         filmstripWidth: number
49
+ *     }
38
  * }
50
  * }
39
  */
51
  */
40
 export const SET_TILE_VIEW_DIMENSIONS = 'SET_TILE_VIEW_DIMENSIONS';
52
 export const SET_TILE_VIEW_DIMENSIONS = 'SET_TILE_VIEW_DIMENSIONS';

+ 25
- 1
react/features/filmstrip/actions.native.js 查看文件

3
 import {
3
 import {
4
     SET_FILMSTRIP_ENABLED,
4
     SET_FILMSTRIP_ENABLED,
5
     SET_FILMSTRIP_HOVERED,
5
     SET_FILMSTRIP_HOVERED,
6
-    SET_FILMSTRIP_VISIBLE
6
+    SET_FILMSTRIP_VISIBLE,
7
+    SET_TILE_VIEW_DIMENSIONS
7
 } from './actionTypes';
8
 } from './actionTypes';
8
 
9
 
9
 /**
10
 /**
53
         visible
54
         visible
54
     };
55
     };
55
 }
56
 }
57
+
58
+/**
59
+ * Sets the dimensions of the tile view grid. The action is only partially implemented on native as not all
60
+ * of the values are currently used. Check the description of {@link SET_TILE_VIEW_DIMENSIONS} for the full set
61
+ * of properties.
62
+ *
63
+ * @param {Object} dimensions - The tile view dimensions.
64
+ * @param {Object} thumbnailSize - The size of an individual video thumbnail.
65
+ * @param {number} thumbnailSize.height - The height of an individual video thumbnail.
66
+ * @param {number} thumbnailSize.width - The width of an individual video thumbnail.
67
+ * @returns {{
68
+ *     type: SET_TILE_VIEW_DIMENSIONS,
69
+ *     dimensions: Object
70
+ * }}
71
+ */
72
+export function setTileViewDimensions({ thumbnailSize }: Object) {
73
+    return {
74
+        type: SET_TILE_VIEW_DIMENSIONS,
75
+        dimensions: {
76
+            thumbnailSize
77
+        }
78
+    };
79
+}

+ 8
- 7
react/features/filmstrip/components/native/TileView.js 查看文件

8
 } from 'react-native';
8
 } from 'react-native';
9
 import type { Dispatch } from 'redux';
9
 import type { Dispatch } from 'redux';
10
 
10
 
11
-import {
12
-    getNearestReceiverVideoQualityLevel,
13
-    setMaxReceiverVideoQuality
14
-} from '../../../base/conference';
15
 import { connect } from '../../../base/redux';
11
 import { connect } from '../../../base/redux';
16
 import { ASPECT_RATIO_NARROW } from '../../../base/responsive-ui/constants';
12
 import { ASPECT_RATIO_NARROW } from '../../../base/responsive-ui/constants';
13
+import { setTileViewDimensions } from '../../actions';
17
 
14
 
18
 import Thumbnail from './Thumbnail';
15
 import Thumbnail from './Thumbnail';
19
 import styles from './styles';
16
 import styles from './styles';
266
      * @returns {void}
263
      * @returns {void}
267
      */
264
      */
268
     _updateReceiverQuality() {
265
     _updateReceiverQuality() {
269
-        const { height } = this._getTileDimensions();
270
-        const qualityLevel = getNearestReceiverVideoQualityLevel(height);
266
+        const { height, width } = this._getTileDimensions();
271
 
267
 
272
-        this.props.dispatch(setMaxReceiverVideoQuality(qualityLevel));
268
+        this.props.dispatch(setTileViewDimensions({
269
+            thumbnailSize: {
270
+                height,
271
+                width
272
+            }
273
+        }));
273
     }
274
     }
274
 }
275
 }
275
 
276
 

+ 0
- 4
react/features/filmstrip/middleware.web.js 查看文件

1
 // @flow
1
 // @flow
2
 
2
 
3
 import Filmstrip from '../../../modules/UI/videolayout/Filmstrip';
3
 import Filmstrip from '../../../modules/UI/videolayout/Filmstrip';
4
-import { getNearestReceiverVideoQualityLevel, setMaxReceiverVideoQuality } from '../base/conference';
5
 import { MiddlewareRegistry } from '../base/redux';
4
 import { MiddlewareRegistry } from '../base/redux';
6
 import { CLIENT_RESIZED } from '../base/responsive-ui';
5
 import { CLIENT_RESIZED } from '../base/responsive-ui';
7
 import {
6
 import {
48
 
47
 
49
         if (shouldDisplayTileView(state)) {
48
         if (shouldDisplayTileView(state)) {
50
             const { width, height } = state['features/filmstrip'].tileViewDimensions.thumbnailSize;
49
             const { width, height } = state['features/filmstrip'].tileViewDimensions.thumbnailSize;
51
-            const qualityLevel = getNearestReceiverVideoQualityLevel(height);
52
-
53
-            store.dispatch(setMaxReceiverVideoQuality(qualityLevel));
54
 
50
 
55
             // Once the thumbnails are reactified this should be moved there too.
51
             // Once the thumbnails are reactified this should be moved there too.
56
             Filmstrip.resizeThumbnailsForTileView(width, height, true);
52
             Filmstrip.resizeThumbnailsForTileView(width, height, true);

+ 0
- 6
react/features/video-layout/subscriber.js 查看文件

2
 
2
 
3
 import debounce from 'lodash/debounce';
3
 import debounce from 'lodash/debounce';
4
 
4
 
5
-import {
6
-    VIDEO_QUALITY_LEVELS,
7
-    setMaxReceiverVideoQuality
8
-} from '../base/conference';
9
 import {
5
 import {
10
     getPinnedParticipant,
6
     getPinnedParticipant,
11
     pinParticipant
7
     pinParticipant
32
         dispatch(selectParticipant());
28
         dispatch(selectParticipant());
33
 
29
 
34
         if (!displayTileView) {
30
         if (!displayTileView) {
35
-            dispatch(setMaxReceiverVideoQuality(VIDEO_QUALITY_LEVELS.HIGH));
36
-
37
             if (_getAutoPinSetting()) {
31
             if (_getAutoPinSetting()) {
38
                 _updateAutoPinnedParticipant(store);
32
                 _updateAutoPinnedParticipant(store);
39
             }
33
             }

+ 41
- 3
react/features/video-quality/middleware.js 查看文件

1
 // @flow
1
 // @flow
2
 
2
 
3
-import { CONFERENCE_JOINED } from '../base/conference/actionTypes';
4
-import { setPreferredVideoQuality } from '../base/conference/actions';
5
-import { MiddlewareRegistry } from '../base/redux';
3
+import {
4
+    CONFERENCE_JOINED,
5
+    VIDEO_QUALITY_LEVELS,
6
+    getNearestReceiverVideoQualityLevel,
7
+    setMaxReceiverVideoQuality,
8
+    setPreferredVideoQuality
9
+} from '../base/conference';
10
+import { MiddlewareRegistry, StateListenerRegistry } from '../base/redux';
11
+import { shouldDisplayTileView } from '../video-layout';
6
 
12
 
7
 import logger from './logger';
13
 import logger from './logger';
8
 
14
 
31
 
37
 
32
     return result;
38
     return result;
33
 });
39
 });
40
+
41
+/**
42
+ * Implements a state listener in order to calculate max receiver video quality.
43
+ */
44
+StateListenerRegistry.register(
45
+    /* selector */ state => {
46
+        const { reducedUI } = state['features/base/responsive-ui'];
47
+        const _shouldDisplayTileView = shouldDisplayTileView(state);
48
+        const thumbnailSize = state['features/filmstrip']?.tileViewDimensions?.thumbnailSize;
49
+
50
+        return {
51
+            displayTileView: _shouldDisplayTileView,
52
+            reducedUI,
53
+            thumbnailHeight: thumbnailSize?.height
54
+        };
55
+    },
56
+    /* listener */ ({ displayTileView, reducedUI, thumbnailHeight }, { dispatch, getState }) => {
57
+        const { maxReceiverVideoQuality } = getState()['features/base/conference'];
58
+        let newMaxRecvVideoQuality = VIDEO_QUALITY_LEVELS.HIGH;
59
+
60
+        if (reducedUI) {
61
+            newMaxRecvVideoQuality = VIDEO_QUALITY_LEVELS.LOW;
62
+        } else if (displayTileView && !Number.isNaN(thumbnailHeight)) {
63
+            newMaxRecvVideoQuality = getNearestReceiverVideoQualityLevel(thumbnailHeight);
64
+        }
65
+
66
+        if (maxReceiverVideoQuality !== newMaxRecvVideoQuality) {
67
+            dispatch(setMaxReceiverVideoQuality(newMaxRecvVideoQuality));
68
+        }
69
+    }, {
70
+        deepEquals: true
71
+    });

正在加载...
取消
保存