Pārlūkot izejas kodu

ref(video-quality): Move all related code.

master
Hristo Terezov 5 gadus atpakaļ
vecāks
revīzija
b02d96231c

+ 0
- 24
react/features/base/conference/actionTypes.js Parādīt failu

@@ -163,19 +163,6 @@ export const SET_DESKTOP_SHARING_ENABLED
163 163
  */
164 164
 export const SET_FOLLOW_ME = 'SET_FOLLOW_ME';
165 165
 
166
-/**
167
- * The type of (redux) action which sets the maximum video height that should be
168
- * received from remote participants, even if the user prefers a larger video
169
- * height.
170
- *
171
- * {
172
- *     type: SET_MAX_RECEIVER_VIDEO_QUALITY,
173
- *     maxReceiverVideoQuality: number
174
- * }
175
- */
176
-export const SET_MAX_RECEIVER_VIDEO_QUALITY
177
-    = 'SET_MAX_RECEIVER_VIDEO_QUALITY';
178
-
179 166
 /**
180 167
  * The type of (redux) action which sets the password to join or lock a specific
181 168
  * {@code JitsiConference}.
@@ -210,17 +197,6 @@ export const SET_PASSWORD_FAILED = 'SET_PASSWORD_FAILED';
210 197
  */
211 198
 export const SET_PENDING_SUBJECT_CHANGE = 'SET_PENDING_SUBJECT_CHANGE';
212 199
 
213
-/**
214
- * The type of (redux) action which sets the preferred maximum video height that
215
- * should be sent to and received from remote participants.
216
- *
217
- * {
218
- *     type: SET_PREFERRED_VIDEO_QUALITY,
219
- *     preferredVideoQuality: number
220
- * }
221
- */
222
-export const SET_PREFERRED_VIDEO_QUALITY = 'SET_PREFERRED_VIDEO_QUALITY';
223
-
224 200
 /**
225 201
  * The type of (redux) action which sets the name of the room of the
226 202
  * conference to be joined.

+ 0
- 37
react/features/base/conference/actions.js Parādīt failu

@@ -45,10 +45,8 @@ import {
45 45
     SEND_TONES,
46 46
     SET_DESKTOP_SHARING_ENABLED,
47 47
     SET_FOLLOW_ME,
48
-    SET_MAX_RECEIVER_VIDEO_QUALITY,
49 48
     SET_PASSWORD,
50 49
     SET_PASSWORD_FAILED,
51
-    SET_PREFERRED_VIDEO_QUALITY,
52 50
     SET_ROOM,
53 51
     SET_PENDING_SUBJECT_CHANGE,
54 52
     SET_START_MUTED_POLICY
@@ -615,23 +613,6 @@ export function setFollowMe(enabled: boolean) {
615 613
     };
616 614
 }
617 615
 
618
-/**
619
- * Sets the max frame height that should be received from remote videos.
620
- *
621
- * @param {number} maxReceiverVideoQuality - The max video frame height to
622
- * receive.
623
- * @returns {{
624
- *     type: SET_MAX_RECEIVER_VIDEO_QUALITY,
625
- *     maxReceiverVideoQuality: number
626
- * }}
627
- */
628
-export function setMaxReceiverVideoQuality(maxReceiverVideoQuality: number) {
629
-    return {
630
-        type: SET_MAX_RECEIVER_VIDEO_QUALITY,
631
-        maxReceiverVideoQuality
632
-    };
633
-}
634
-
635 616
 /**
636 617
  * Sets the password to join or lock a specific JitsiConference.
637 618
  *
@@ -698,24 +679,6 @@ export function setPassword(
698 679
     };
699 680
 }
700 681
 
701
-/**
702
- * Sets the max frame height the user prefers to send and receive from the
703
- * remote participants.
704
- *
705
- * @param {number} preferredVideoQuality - The max video resolution to send and
706
- * receive.
707
- * @returns {{
708
- *     type: SET_PREFERRED_VIDEO_QUALITY,
709
- *     preferredVideoQuality: number
710
- * }}
711
- */
712
-export function setPreferredVideoQuality(preferredVideoQuality: number) {
713
-    return {
714
-        type: SET_PREFERRED_VIDEO_QUALITY,
715
-        preferredVideoQuality
716
-    };
717
-}
718
-
719 682
 /**
720 683
  * Sets (the name of) the room of the conference to be joined.
721 684
  *

+ 0
- 12
react/features/base/conference/constants.js Parādīt failu

@@ -34,15 +34,3 @@ export const EMAIL_COMMAND = 'email';
34 34
  * from the outside is not cool but it should suffice for now.
35 35
  */
36 36
 export const JITSI_CONFERENCE_URL_KEY = Symbol('url');
37
-
38
-/**
39
- * The supported remote video resolutions. The values are currently based on
40
- * available simulcast layers.
41
- *
42
- * @type {object}
43
- */
44
-export const VIDEO_QUALITY_LEVELS = {
45
-    HIGH: 720,
46
-    STANDARD: 360,
47
-    LOW: 180
48
-};

+ 1
- 95
react/features/base/conference/middleware.js Parādīt failu

@@ -20,7 +20,7 @@ import {
20 20
     PARTICIPANT_UPDATED,
21 21
     PIN_PARTICIPANT
22 22
 } from '../participants';
23
-import { MiddlewareRegistry, StateListenerRegistry } from '../redux';
23
+import { MiddlewareRegistry } from '../redux';
24 24
 import { TRACK_ADDED, TRACK_REMOVED } from '../tracks';
25 25
 
26 26
 import {
@@ -28,7 +28,6 @@ import {
28 28
     CONFERENCE_JOINED,
29 29
     CONFERENCE_SUBJECT_CHANGED,
30 30
     CONFERENCE_WILL_LEAVE,
31
-    DATA_CHANNEL_OPENED,
32 31
     SEND_TONES,
33 32
     SET_PENDING_SUBJECT_CHANGE,
34 33
     SET_ROOM
@@ -81,9 +80,6 @@ MiddlewareRegistry.register(store => next => action => {
81 80
         _conferenceWillLeave();
82 81
         break;
83 82
 
84
-    case DATA_CHANNEL_OPENED:
85
-        return _syncReceiveVideoQuality(store, next, action);
86
-
87 83
     case PARTICIPANT_UPDATED:
88 84
         return _updateLocalParticipantInConference(store, next, action);
89 85
 
@@ -104,31 +100,6 @@ MiddlewareRegistry.register(store => next => action => {
104 100
     return next(action);
105 101
 });
106 102
 
107
-/**
108
- * Registers a change handler for state['features/base/conference'] to update
109
- * the preferred video quality levels based on user preferred and internal
110
- * settings.
111
- */
112
-StateListenerRegistry.register(
113
-    /* selector */ state => state['features/base/conference'],
114
-    /* listener */ (currentState, store, previousState = {}) => {
115
-        const {
116
-            conference,
117
-            maxReceiverVideoQuality,
118
-            preferredVideoQuality
119
-        } = currentState;
120
-        const changedConference = conference !== previousState.conference;
121
-        const changedPreferredVideoQuality
122
-            = preferredVideoQuality !== previousState.preferredVideoQuality;
123
-        const changedMaxVideoQuality = maxReceiverVideoQuality !== previousState.maxReceiverVideoQuality;
124
-
125
-        if (changedConference || changedPreferredVideoQuality || changedMaxVideoQuality) {
126
-            _setReceiverVideoConstraint(conference, preferredVideoQuality, maxReceiverVideoQuality);
127
-        }
128
-        if (changedConference || changedPreferredVideoQuality) {
129
-            _setSenderVideoConstraint(conference, preferredVideoQuality);
130
-        }
131
-    });
132 103
 
133 104
 /**
134 105
  * Makes sure to leave a failed conference in order to release any allocated
@@ -448,44 +419,6 @@ function _sendTones({ getState }, next, action) {
448 419
     return next(action);
449 420
 }
450 421
 
451
-/**
452
- * Helper function for updating the preferred receiver video constraint, based
453
- * on the user preference and the internal maximum.
454
- *
455
- * @param {JitsiConference} conference - The JitsiConference instance for the
456
- * current call.
457
- * @param {number} preferred - The user preferred max frame height.
458
- * @param {number} max - The maximum frame height the application should
459
- * receive.
460
- * @returns {void}
461
- */
462
-function _setReceiverVideoConstraint(conference, preferred, max) {
463
-    if (conference) {
464
-        const value = Math.min(preferred, max);
465
-
466
-        conference.setReceiverVideoConstraint(value);
467
-        logger.info(`setReceiverVideoConstraint: ${value}`);
468
-    }
469
-}
470
-
471
-/**
472
- * Helper function for updating the preferred sender video constraint, based
473
- * on the user preference.
474
- *
475
- * @param {JitsiConference} conference - The JitsiConference instance for the
476
- * current call.
477
- * @param {number} preferred - The user preferred max frame height.
478
- * @returns {void}
479
- */
480
-function _setSenderVideoConstraint(conference, preferred) {
481
-    if (conference) {
482
-        conference.setSenderVideoConstraint(preferred)
483
-            .catch(err => {
484
-                logger.error(`Changing sender resolution to ${preferred} failed - ${err} `);
485
-            });
486
-    }
487
-}
488
-
489 422
 /**
490 423
  * Notifies the feature base/conference that the action
491 424
  * {@code SET_ROOM} is being dispatched within a specific
@@ -539,33 +472,6 @@ function _syncConferenceLocalTracksWithState({ getState }, action) {
539 472
     return promise || Promise.resolve();
540 473
 }
541 474
 
542
-/**
543
- * Sets the maximum receive video quality.
544
- *
545
- * @param {Store} store - The redux store in which the specified {@code action}
546
- * is being dispatched.
547
- * @param {Dispatch} next - The redux {@code dispatch} function to dispatch the
548
- * specified {@code action} to the specified {@code store}.
549
- * @param {Action} action - The redux action {@code DATA_CHANNEL_STATUS_CHANGED}
550
- * which is being dispatched in the specified {@code store}.
551
- * @private
552
- * @returns {Object} The value returned by {@code next(action)}.
553
- */
554
-function _syncReceiveVideoQuality({ getState }, next, action) {
555
-    const {
556
-        conference,
557
-        maxReceiverVideoQuality,
558
-        preferredVideoQuality
559
-    } = getState()['features/base/conference'];
560
-
561
-    _setReceiverVideoConstraint(
562
-        conference,
563
-        preferredVideoQuality,
564
-        maxReceiverVideoQuality);
565
-
566
-    return next(action);
567
-}
568
-
569 475
 /**
570 476
  * Notifies the feature base/conference that the action {@code TRACK_ADDED}
571 477
  * or {@code TRACK_REMOVED} is being dispatched within a specific redux store.

+ 1
- 18
react/features/base/conference/reducer.js Parādīt failu

@@ -18,15 +18,12 @@ import {
18 18
     P2P_STATUS_CHANGED,
19 19
     SET_DESKTOP_SHARING_ENABLED,
20 20
     SET_FOLLOW_ME,
21
-    SET_MAX_RECEIVER_VIDEO_QUALITY,
22 21
     SET_PASSWORD,
23 22
     SET_PENDING_SUBJECT_CHANGE,
24
-    SET_PREFERRED_VIDEO_QUALITY,
25 23
     SET_ROOM,
26 24
     SET_SIP_GATEWAY_ENABLED,
27 25
     SET_START_MUTED_POLICY
28 26
 } from './actionTypes';
29
-import { VIDEO_QUALITY_LEVELS } from './constants';
30 27
 import { isRoomValid } from './functions';
31 28
 
32 29
 const DEFAULT_STATE = {
@@ -35,11 +32,9 @@ const DEFAULT_STATE = {
35 32
     joining: undefined,
36 33
     leaving: undefined,
37 34
     locked: undefined,
38
-    maxReceiverVideoQuality: VIDEO_QUALITY_LEVELS.HIGH,
39 35
     membersOnly: undefined,
40 36
     password: undefined,
41
-    passwordRequired: undefined,
42
-    preferredVideoQuality: VIDEO_QUALITY_LEVELS.HIGH
37
+    passwordRequired: undefined
43 38
 };
44 39
 
45 40
 /**
@@ -90,24 +85,12 @@ ReducerRegistry.register(
90 85
         case SET_LOCATION_URL:
91 86
             return set(state, 'room', undefined);
92 87
 
93
-        case SET_MAX_RECEIVER_VIDEO_QUALITY:
94
-            return set(
95
-                state,
96
-                'maxReceiverVideoQuality',
97
-                action.maxReceiverVideoQuality);
98
-
99 88
         case SET_PASSWORD:
100 89
             return _setPassword(state, action);
101 90
 
102 91
         case SET_PENDING_SUBJECT_CHANGE:
103 92
             return set(state, 'pendingSubjectChange', action.subject);
104 93
 
105
-        case SET_PREFERRED_VIDEO_QUALITY:
106
-            return set(
107
-                state,
108
-                'preferredVideoQuality',
109
-                action.preferredVideoQuality);
110
-
111 94
         case SET_ROOM:
112 95
             return _setRoom(state, action);
113 96
 

+ 23
- 0
react/features/video-quality/actionTypes.js Parādīt failu

@@ -0,0 +1,23 @@
1
+/**
2
+ * The type of (redux) action which sets the preferred maximum video height that
3
+ * should be sent to and received from remote participants.
4
+ *
5
+ * {
6
+ *     type: SET_PREFERRED_VIDEO_QUALITY,
7
+ *     preferredVideoQuality: number
8
+ * }
9
+ */
10
+export const SET_PREFERRED_VIDEO_QUALITY = 'SET_PREFERRED_VIDEO_QUALITY';
11
+
12
+
13
+/**
14
+ * The type of (redux) action which sets the maximum video height that should be
15
+ * received from remote participants, even if the user prefers a larger video
16
+ * height.
17
+ *
18
+ * {
19
+ *     type: SET_MAX_RECEIVER_VIDEO_QUALITY,
20
+ *     maxReceiverVideoQuality: number
21
+ * }
22
+ */
23
+export const SET_MAX_RECEIVER_VIDEO_QUALITY = 'SET_MAX_RECEIVER_VIDEO_QUALITY';

+ 37
- 2
react/features/video-quality/actions.js Parādīt failu

@@ -2,10 +2,45 @@
2 2
 
3 3
 import type { Dispatch } from 'redux';
4 4
 
5
-import { VIDEO_QUALITY_LEVELS } from '../base/conference';
6
-
5
+import { SET_MAX_RECEIVER_VIDEO_QUALITY, SET_PREFERRED_VIDEO_QUALITY } from './actionTypes';
6
+import { VIDEO_QUALITY_LEVELS } from './constants';
7 7
 import logger from './logger';
8 8
 
9
+/**
10
+ * Sets the max frame height the user prefers to send and receive from the
11
+ * remote participants.
12
+ *
13
+ * @param {number} preferredVideoQuality - The max video resolution to send and
14
+ * receive.
15
+ * @returns {{
16
+ *     type: SET_PREFERRED_VIDEO_QUALITY,
17
+ *     preferredVideoQuality: number
18
+ * }}
19
+ */
20
+export function setPreferredVideoQuality(preferredVideoQuality: number) {
21
+    return {
22
+        type: SET_PREFERRED_VIDEO_QUALITY,
23
+        preferredVideoQuality
24
+    };
25
+}
26
+
27
+/**
28
+ * Sets the max frame height that should be received from remote videos.
29
+ *
30
+ * @param {number} maxReceiverVideoQuality - The max video frame height to
31
+ * receive.
32
+ * @returns {{
33
+ *     type: SET_MAX_RECEIVER_VIDEO_QUALITY,
34
+ *     maxReceiverVideoQuality: number
35
+ * }}
36
+ */
37
+export function setMaxReceiverVideoQuality(maxReceiverVideoQuality: number) {
38
+    return {
39
+        type: SET_MAX_RECEIVER_VIDEO_QUALITY,
40
+        maxReceiverVideoQuality
41
+    };
42
+}
43
+
9 44
 
10 45
 /**
11 46
  * Sets the maximum video size the local participant should send and receive from

+ 2
- 2
react/features/video-quality/components/OverflowMenuVideoQualityItem.web.js Parādīt failu

@@ -2,7 +2,6 @@
2 2
 
3 3
 import React, { Component } from 'react';
4 4
 
5
-import { VIDEO_QUALITY_LEVELS } from '../../base/conference/constants';
6 5
 import { translate } from '../../base/i18n';
7 6
 import {
8 7
     Icon,
@@ -12,6 +11,7 @@ import {
12 11
     IconVideoQualitySD
13 12
 } from '../../base/icons';
14 13
 import { connect } from '../../base/redux';
14
+import { VIDEO_QUALITY_LEVELS } from '../constants';
15 15
 
16 16
 /**
17 17
  * A map of of selectable receive resolutions to corresponding icons.
@@ -104,7 +104,7 @@ class OverflowMenuVideoQualityItem extends Component<Props> {
104 104
 function _mapStateToProps(state) {
105 105
     return {
106 106
         _audioOnly: state['features/base/audio-only'].enabled,
107
-        _videoQuality: state['features/base/conference'].preferredVideoQuality
107
+        _videoQuality: state['features/video-quality'].preferredVideoQuality
108 108
     };
109 109
 }
110 110
 

+ 4
- 2
react/features/video-quality/components/VideoQualitySlider.web.js Parādīt failu

@@ -6,10 +6,11 @@ import type { Dispatch } from 'redux';
6 6
 
7 7
 import { createToolbarEvent, sendAnalytics } from '../../analytics';
8 8
 import { setAudioOnly } from '../../base/audio-only';
9
-import { VIDEO_QUALITY_LEVELS, setPreferredVideoQuality } from '../../base/conference';
10 9
 import { translate } from '../../base/i18n';
11 10
 import JitsiMeetJS from '../../base/lib-jitsi-meet';
12 11
 import { connect } from '../../base/redux';
12
+import { setPreferredVideoQuality } from '../actions';
13
+import { VIDEO_QUALITY_LEVELS } from '../constants';
13 14
 import logger from '../logger';
14 15
 
15 16
 const {
@@ -380,7 +381,8 @@ class VideoQualitySlider extends Component<Props> {
380 381
  */
381 382
 function _mapStateToProps(state) {
382 383
     const { enabled: audioOnly } = state['features/base/audio-only'];
383
-    const { p2p, preferredVideoQuality } = state['features/base/conference'];
384
+    const { p2p } = state['features/base/conference'];
385
+    const { preferredVideoQuality } = state['features/video-quality'];
384 386
 
385 387
     return {
386 388
         _audioOnly: audioOnly,

+ 11
- 1
react/features/video-quality/constants.js Parādīt failu

@@ -1,4 +1,14 @@
1
-import { VIDEO_QUALITY_LEVELS } from '../base/conference';
1
+/**
2
+ * The supported remote video resolutions. The values are currently based on
3
+ * available simulcast layers.
4
+ *
5
+ * @type {object}
6
+ */
7
+export const VIDEO_QUALITY_LEVELS = {
8
+    HIGH: 720,
9
+    STANDARD: 360,
10
+    LOW: 180
11
+};
2 12
 
3 13
 /**
4 14
  * Maps quality level names used in the config.videoQuality.minHeightForQualityLvl to the quality level constants used

+ 1
- 3
react/features/video-quality/functions.js Parādīt failu

@@ -1,8 +1,6 @@
1 1
 // @flow
2 2
 
3
-import { VIDEO_QUALITY_LEVELS } from '../base/conference';
4
-
5
-import { CFG_LVL_TO_APP_QUALITY_LVL } from './constants';
3
+import { CFG_LVL_TO_APP_QUALITY_LVL, VIDEO_QUALITY_LEVELS } from './constants';
6 4
 
7 5
 
8 6
 /**

+ 1
- 0
react/features/video-quality/index.js Parādīt failu

@@ -1,4 +1,5 @@
1 1
 export * from './components';
2 2
 export * from './actions';
3
+export * from './actionTypes';
3 4
 
4 5
 import './reducer';

+ 113
- 4
react/features/video-quality/middleware.js Parādīt failu

@@ -2,14 +2,14 @@
2 2
 
3 3
 import {
4 4
     CONFERENCE_JOINED,
5
-    VIDEO_QUALITY_LEVELS,
6
-    setMaxReceiverVideoQuality,
7
-    setPreferredVideoQuality
5
+    DATA_CHANNEL_OPENED
8 6
 } from '../base/conference';
9 7
 import { getParticipantCount } from '../base/participants';
10 8
 import { MiddlewareRegistry, StateListenerRegistry } from '../base/redux';
11 9
 import { shouldDisplayTileView } from '../video-layout';
12 10
 
11
+import { setPreferredVideoQuality, setMaxReceiverVideoQuality } from './actions';
12
+import { VIDEO_QUALITY_LEVELS } from './constants';
13 13
 import { getReceiverVideoQualityLevel } from './functions';
14 14
 import logger from './logger';
15 15
 import { getMinHeightForQualityLvlMap } from './selector';
@@ -21,6 +21,10 @@ import { getMinHeightForQualityLvlMap } from './selector';
21 21
  * @returns {Function}
22 22
  */
23 23
 MiddlewareRegistry.register(({ dispatch, getState }) => next => action => {
24
+    if (action.type === DATA_CHANNEL_OPENED) {
25
+        return _syncReceiveVideoQuality(getState, next, action);
26
+    }
27
+
24 28
     const result = next(action);
25 29
 
26 30
     switch (action.type) {
@@ -59,7 +63,7 @@ StateListenerRegistry.register(
59 63
     },
60 64
     /* listener */ ({ displayTileView, participantCount, reducedUI, thumbnailHeight }, { dispatch, getState }) => {
61 65
         const state = getState();
62
-        const { maxReceiverVideoQuality } = state['features/base/conference'];
66
+        const { maxReceiverVideoQuality } = state['features/video-quality'];
63 67
         const { maxFullResolutionParticipants = 2 } = state['features/base/config'];
64 68
 
65 69
         let newMaxRecvVideoQuality = VIDEO_QUALITY_LEVELS.HIGH;
@@ -92,3 +96,108 @@ StateListenerRegistry.register(
92 96
     }, {
93 97
         deepEquals: true
94 98
     });
99
+
100
+/**
101
+ * Helper function for updating the preferred receiver video constraint, based
102
+ * on the user preference and the internal maximum.
103
+ *
104
+ * @param {JitsiConference} conference - The JitsiConference instance for the
105
+ * current call.
106
+ * @param {number} preferred - The user preferred max frame height.
107
+ * @param {number} max - The maximum frame height the application should
108
+ * receive.
109
+ * @returns {void}
110
+ */
111
+function _setReceiverVideoConstraint(conference, preferred, max) {
112
+    if (conference) {
113
+        const value = Math.min(preferred, max);
114
+
115
+        conference.setReceiverVideoConstraint(value);
116
+        logger.info(`setReceiverVideoConstraint: ${value}`);
117
+    }
118
+}
119
+
120
+/**
121
+ * Helper function for updating the preferred sender video constraint, based
122
+ * on the user preference.
123
+ *
124
+ * @param {JitsiConference} conference - The JitsiConference instance for the
125
+ * current call.
126
+ * @param {number} preferred - The user preferred max frame height.
127
+ * @returns {void}
128
+ */
129
+function _setSenderVideoConstraint(conference, preferred) {
130
+    if (conference) {
131
+        conference.setSenderVideoConstraint(preferred)
132
+            .catch(err => {
133
+                logger.error(`Changing sender resolution to ${preferred} failed - ${err} `);
134
+            });
135
+    }
136
+}
137
+
138
+/**
139
+ * Sets the maximum receive video quality.
140
+ *
141
+ * @param {Function} getState - The redux function which returns the current redux state.
142
+ * @param {Dispatch} next - The redux {@code dispatch} function to dispatch the
143
+ * specified {@code action} to the specified {@code store}.
144
+ * @param {Action} action - The redux action {@code DATA_CHANNEL_STATUS_CHANGED}
145
+ * which is being dispatched in the specified {@code store}.
146
+ * @private
147
+ * @returns {Object} The value returned by {@code next(action)}.
148
+ */
149
+function _syncReceiveVideoQuality(getState, next, action) {
150
+    const state = getState();
151
+    const {
152
+        conference
153
+    } = state['features/base/conference'];
154
+    const {
155
+        maxReceiverVideoQuality,
156
+        preferredVideoQuality
157
+    } = state['features/video-quality'];
158
+
159
+    _setReceiverVideoConstraint(
160
+        conference,
161
+        preferredVideoQuality,
162
+        maxReceiverVideoQuality);
163
+
164
+    return next(action);
165
+}
166
+
167
+
168
+/**
169
+ * Registers a change handler for state['features/base/conference'] to update
170
+ * the preferred video quality levels based on user preferred and internal
171
+ * settings.
172
+ */
173
+StateListenerRegistry.register(
174
+    /* selector */ state => {
175
+        const { conference } = state['features/base/conference'];
176
+        const {
177
+            maxReceiverVideoQuality,
178
+            preferredVideoQuality
179
+        } = state['features/video-quality'];
180
+
181
+        return {
182
+            conference,
183
+            maxReceiverVideoQuality,
184
+            preferredVideoQuality
185
+        };
186
+    },
187
+    /* listener */ (currentState, store, previousState = {}) => {
188
+        const {
189
+            conference,
190
+            maxReceiverVideoQuality,
191
+            preferredVideoQuality
192
+        } = currentState;
193
+        const changedConference = conference !== previousState.conference;
194
+        const changedPreferredVideoQuality = preferredVideoQuality !== previousState.preferredVideoQuality;
195
+        const changedMaxVideoQuality = maxReceiverVideoQuality !== previousState.maxReceiverVideoQuality;
196
+
197
+        if (changedConference || changedPreferredVideoQuality || changedMaxVideoQuality) {
198
+            _setReceiverVideoConstraint(conference, preferredVideoQuality, maxReceiverVideoQuality);
199
+        }
200
+        if (changedConference || changedPreferredVideoQuality) {
201
+            _setSenderVideoConstraint(conference, preferredVideoQuality);
202
+        }
203
+    });

+ 18
- 3
react/features/video-quality/reducer.js Parādīt failu

@@ -1,21 +1,36 @@
1
-import { VIDEO_QUALITY_LEVELS } from '../base/conference';
2 1
 import { SET_CONFIG } from '../base/config';
3 2
 import { ReducerRegistry, set } from '../base/redux';
4 3
 
4
+import { SET_MAX_RECEIVER_VIDEO_QUALITY, SET_PREFERRED_VIDEO_QUALITY } from './actionTypes';
5
+import { VIDEO_QUALITY_LEVELS } from './constants';
5 6
 import { validateMinHeightForQualityLvl } from './functions';
6 7
 import logger from './logger';
7 8
 
9
+const STORE_NAME = 'features/video-quality';
10
+
8 11
 const DEFAULT_STATE = {
9
-    minHeightForQualityLvl: new Map()
12
+    maxReceiverVideoQuality: VIDEO_QUALITY_LEVELS.HIGH,
13
+    minHeightForQualityLvl: new Map(),
14
+    preferredVideoQuality: VIDEO_QUALITY_LEVELS.HIGH
10 15
 };
11 16
 
12 17
 DEFAULT_STATE.minHeightForQualityLvl.set(360, VIDEO_QUALITY_LEVELS.STANDARD);
13 18
 DEFAULT_STATE.minHeightForQualityLvl.set(720, VIDEO_QUALITY_LEVELS.HIGH);
14 19
 
15
-ReducerRegistry.register('features/base/videoquality', (state = DEFAULT_STATE, action) => {
20
+ReducerRegistry.register(STORE_NAME, (state = DEFAULT_STATE, action) => {
16 21
     switch (action.type) {
17 22
     case SET_CONFIG:
18 23
         return _setConfig(state, action);
24
+    case SET_MAX_RECEIVER_VIDEO_QUALITY:
25
+        return set(
26
+            state,
27
+            'maxReceiverVideoQuality',
28
+            action.maxReceiverVideoQuality);
29
+    case SET_PREFERRED_VIDEO_QUALITY:
30
+        return set(
31
+            state,
32
+            'preferredVideoQuality',
33
+            action.preferredVideoQuality);
19 34
     }
20 35
 
21 36
     return state;

+ 1
- 1
react/features/video-quality/selector.js Parādīt failu

@@ -7,5 +7,5 @@
7 7
  * @returns {Map<number,number>}
8 8
  */
9 9
 export function getMinHeightForQualityLvlMap(state: Object): Map<number, number> {
10
-    return state['features/base/videoquality'].minHeightForQualityLvl;
10
+    return state['features/video-quality'].minHeightForQualityLvl;
11 11
 }

Notiek ielāde…
Atcelt
Saglabāt