瀏覽代碼

feat(video-quality):control sender resolution based on user pref

master
Jaya Allamsetty 5 年之前
父節點
當前提交
b5676c3729

+ 2
- 2
package-lock.json 查看文件

10884
       }
10884
       }
10885
     },
10885
     },
10886
     "lib-jitsi-meet": {
10886
     "lib-jitsi-meet": {
10887
-      "version": "github:jitsi/lib-jitsi-meet#f97c37d0140a0f12644ae29f4dd93757b8b8610f",
10888
-      "from": "github:jitsi/lib-jitsi-meet#f97c37d0140a0f12644ae29f4dd93757b8b8610f",
10887
+      "version": "github:jitsi/lib-jitsi-meet#47b292e332e6c6e13de74f17540a0e6a6a80e165",
10888
+      "from": "github:jitsi/lib-jitsi-meet#47b292e332e6c6e13de74f17540a0e6a6a80e165",
10889
       "requires": {
10889
       "requires": {
10890
         "@jitsi/sdp-interop": "1.0.2",
10890
         "@jitsi/sdp-interop": "1.0.2",
10891
         "@jitsi/sdp-simulcast": "0.3.0",
10891
         "@jitsi/sdp-simulcast": "0.3.0",

+ 1
- 1
package.json 查看文件

56
     "js-utils": "github:jitsi/js-utils#df68966e3c65b5c57fcd2670da1326a2c77518d1",
56
     "js-utils": "github:jitsi/js-utils#df68966e3c65b5c57fcd2670da1326a2c77518d1",
57
     "jsrsasign": "8.0.12",
57
     "jsrsasign": "8.0.12",
58
     "jwt-decode": "2.2.0",
58
     "jwt-decode": "2.2.0",
59
-    "lib-jitsi-meet": "github:jitsi/lib-jitsi-meet#f97c37d0140a0f12644ae29f4dd93757b8b8610f",
59
+    "lib-jitsi-meet": "github:jitsi/lib-jitsi-meet#47b292e332e6c6e13de74f17540a0e6a6a80e165",
60
     "libflacjs": "github:mmig/libflac.js#93d37e7f811f01cf7d8b6a603e38bd3c3810907d",
60
     "libflacjs": "github:mmig/libflac.js#93d37e7f811f01cf7d8b6a603e38bd3c3810907d",
61
     "lodash": "4.17.13",
61
     "lodash": "4.17.13",
62
     "moment": "2.19.4",
62
     "moment": "2.19.4",

+ 4
- 5
react/features/base/conference/actionTypes.js 查看文件

212
 
212
 
213
 /**
213
 /**
214
  * The type of (redux) action which sets the preferred maximum video height that
214
  * The type of (redux) action which sets the preferred maximum video height that
215
- * should be received from remote participants.
215
+ * should be sent to and received from remote participants.
216
  *
216
  *
217
  * {
217
  * {
218
- *     type: SET_PREFERRED_RECEIVER_VIDEO_QUALITY,
219
- *     preferredReceiverVideoQuality: number
218
+ *     type: SET_PREFERRED_VIDEO_QUALITY,
219
+ *     preferredVideoQuality: number
220
  * }
220
  * }
221
  */
221
  */
222
-export const SET_PREFERRED_RECEIVER_VIDEO_QUALITY
223
-    = 'SET_PREFERRED_RECEIVER_VIDEO_QUALITY';
222
+export const SET_PREFERRED_VIDEO_QUALITY = 'SET_PREFERRED_VIDEO_QUALITY';
224
 
223
 
225
 /**
224
 /**
226
  * The type of (redux) action which sets the name of the room of the
225
  * The type of (redux) action which sets the name of the room of the

+ 9
- 10
react/features/base/conference/actions.js 查看文件

48
     SET_MAX_RECEIVER_VIDEO_QUALITY,
48
     SET_MAX_RECEIVER_VIDEO_QUALITY,
49
     SET_PASSWORD,
49
     SET_PASSWORD,
50
     SET_PASSWORD_FAILED,
50
     SET_PASSWORD_FAILED,
51
-    SET_PREFERRED_RECEIVER_VIDEO_QUALITY,
51
+    SET_PREFERRED_VIDEO_QUALITY,
52
     SET_ROOM,
52
     SET_ROOM,
53
     SET_PENDING_SUBJECT_CHANGE,
53
     SET_PENDING_SUBJECT_CHANGE,
54
     SET_START_MUTED_POLICY
54
     SET_START_MUTED_POLICY
699
 }
699
 }
700
 
700
 
701
 /**
701
 /**
702
- * Sets the max frame height the user prefers to receive from remote participant
703
- * videos.
702
+ * Sets the max frame height the user prefers to send and receive from the
703
+ * remote participants.
704
  *
704
  *
705
- * @param {number} preferredReceiverVideoQuality - The max video resolution to
705
+ * @param {number} preferredVideoQuality - The max video resolution to send and
706
  * receive.
706
  * receive.
707
  * @returns {{
707
  * @returns {{
708
- *     type: SET_PREFERRED_RECEIVER_VIDEO_QUALITY,
709
- *     preferredReceiverVideoQuality: number
708
+ *     type: SET_PREFERRED_VIDEO_QUALITY,
709
+ *     preferredVideoQuality: number
710
  * }}
710
  * }}
711
  */
711
  */
712
-export function setPreferredReceiverVideoQuality(
713
-        preferredReceiverVideoQuality: number) {
712
+export function setPreferredVideoQuality(preferredVideoQuality: number) {
714
     return {
713
     return {
715
-        type: SET_PREFERRED_RECEIVER_VIDEO_QUALITY,
716
-        preferredReceiverVideoQuality
714
+        type: SET_PREFERRED_VIDEO_QUALITY,
715
+        preferredVideoQuality
717
     };
716
     };
718
 }
717
 }
719
 
718
 

+ 26
- 5
react/features/base/conference/middleware.js 查看文件

114
         const {
114
         const {
115
             conference,
115
             conference,
116
             maxReceiverVideoQuality,
116
             maxReceiverVideoQuality,
117
-            preferredReceiverVideoQuality
117
+            preferredVideoQuality
118
         } = currentState;
118
         } = currentState;
119
         const changedPreferredVideoQuality
119
         const changedPreferredVideoQuality
120
-            = preferredReceiverVideoQuality !== previousState.preferredReceiverVideoQuality;
120
+            = preferredVideoQuality !== previousState.preferredVideoQuality;
121
         const changedMaxVideoQuality = maxReceiverVideoQuality !== previousState.maxReceiverVideoQuality;
121
         const changedMaxVideoQuality = maxReceiverVideoQuality !== previousState.maxReceiverVideoQuality;
122
 
122
 
123
         if (changedPreferredVideoQuality || changedMaxVideoQuality) {
123
         if (changedPreferredVideoQuality || changedMaxVideoQuality) {
124
-            _setReceiverVideoConstraint(conference, preferredReceiverVideoQuality, maxReceiverVideoQuality);
124
+            _setReceiverVideoConstraint(conference, preferredVideoQuality, maxReceiverVideoQuality);
125
+        }
126
+        if (changedPreferredVideoQuality) {
127
+            _setSenderVideoConstraint(conference, preferredVideoQuality);
125
         }
128
         }
126
     });
129
     });
127
 
130
 
433
     }
436
     }
434
 }
437
 }
435
 
438
 
439
+/**
440
+ * Helper function for updating the preferred sender video constraint, based
441
+ * on the user preference.
442
+ *
443
+ * @param {JitsiConference} conference - The JitsiConference instance for the
444
+ * current call.
445
+ * @param {number} preferred - The user preferred max frame height.
446
+ * @returns {void}
447
+ */
448
+function _setSenderVideoConstraint(conference, preferred) {
449
+    if (conference) {
450
+        conference.setSenderVideoConstraint(preferred)
451
+            .catch(err => {
452
+                logger.error(`Changing sender resolution to ${preferred} failed - ${err} `);
453
+            });
454
+    }
455
+}
456
+
436
 /**
457
 /**
437
  * Notifies the feature base/conference that the action
458
  * Notifies the feature base/conference that the action
438
  * {@code SET_ROOM} is being dispatched within a specific
459
  * {@code SET_ROOM} is being dispatched within a specific
502
     const {
523
     const {
503
         conference,
524
         conference,
504
         maxReceiverVideoQuality,
525
         maxReceiverVideoQuality,
505
-        preferredReceiverVideoQuality
526
+        preferredVideoQuality
506
     } = getState()['features/base/conference'];
527
     } = getState()['features/base/conference'];
507
 
528
 
508
     _setReceiverVideoConstraint(
529
     _setReceiverVideoConstraint(
509
         conference,
530
         conference,
510
-        preferredReceiverVideoQuality,
531
+        preferredVideoQuality,
511
         maxReceiverVideoQuality);
532
         maxReceiverVideoQuality);
512
 
533
 
513
     return next(action);
534
     return next(action);

+ 5
- 5
react/features/base/conference/reducer.js 查看文件

21
     SET_MAX_RECEIVER_VIDEO_QUALITY,
21
     SET_MAX_RECEIVER_VIDEO_QUALITY,
22
     SET_PASSWORD,
22
     SET_PASSWORD,
23
     SET_PENDING_SUBJECT_CHANGE,
23
     SET_PENDING_SUBJECT_CHANGE,
24
-    SET_PREFERRED_RECEIVER_VIDEO_QUALITY,
24
+    SET_PREFERRED_VIDEO_QUALITY,
25
     SET_ROOM,
25
     SET_ROOM,
26
     SET_SIP_GATEWAY_ENABLED,
26
     SET_SIP_GATEWAY_ENABLED,
27
     SET_START_MUTED_POLICY
27
     SET_START_MUTED_POLICY
38
     maxReceiverVideoQuality: VIDEO_QUALITY_LEVELS.HIGH,
38
     maxReceiverVideoQuality: VIDEO_QUALITY_LEVELS.HIGH,
39
     password: undefined,
39
     password: undefined,
40
     passwordRequired: undefined,
40
     passwordRequired: undefined,
41
-    preferredReceiverVideoQuality: VIDEO_QUALITY_LEVELS.HIGH
41
+    preferredVideoQuality: VIDEO_QUALITY_LEVELS.HIGH
42
 };
42
 };
43
 
43
 
44
 /**
44
 /**
101
         case SET_PENDING_SUBJECT_CHANGE:
101
         case SET_PENDING_SUBJECT_CHANGE:
102
             return set(state, 'pendingSubjectChange', action.subject);
102
             return set(state, 'pendingSubjectChange', action.subject);
103
 
103
 
104
-        case SET_PREFERRED_RECEIVER_VIDEO_QUALITY:
104
+        case SET_PREFERRED_VIDEO_QUALITY:
105
             return set(
105
             return set(
106
                 state,
106
                 state,
107
-                'preferredReceiverVideoQuality',
108
-                action.preferredReceiverVideoQuality);
107
+                'preferredVideoQuality',
108
+                action.preferredVideoQuality);
109
 
109
 
110
         case SET_ROOM:
110
         case SET_ROOM:
111
             return _setRoom(state, action);
111
             return _setRoom(state, action);

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

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

+ 7
- 8
react/features/video-quality/components/OverflowMenuVideoQualityItem.web.js 查看文件

38
 
38
 
39
     /**
39
     /**
40
      * The currently configured maximum quality resolution to be received from
40
      * The currently configured maximum quality resolution to be received from
41
-     * remote participants.
41
+     * and sent to remote participants.
42
      */
42
      */
43
-    _receiverVideoQuality: number,
43
+    _videoQuality: number,
44
 
44
 
45
     /**
45
     /**
46
      * Callback to invoke when {@link OverflowMenuVideoQualityItem} is clicked.
46
      * Callback to invoke when {@link OverflowMenuVideoQualityItem} is clicked.
68
      * @returns {ReactElement}
68
      * @returns {ReactElement}
69
      */
69
      */
70
     render() {
70
     render() {
71
-        const { _audioOnly, _receiverVideoQuality } = this.props;
72
-        const icon = _audioOnly || !_receiverVideoQuality
71
+        const { _audioOnly, _videoQuality } = this.props;
72
+        const icon = _audioOnly || !_videoQuality
73
             ? IconVideoQualityAudioOnly
73
             ? IconVideoQualityAudioOnly
74
-            : VIDEO_QUALITY_TO_ICON[_receiverVideoQuality];
74
+            : VIDEO_QUALITY_TO_ICON[_videoQuality];
75
 
75
 
76
         return (
76
         return (
77
             <li
77
             <li
98
  * @private
98
  * @private
99
  * @returns {{
99
  * @returns {{
100
  *     _audioOnly: boolean,
100
  *     _audioOnly: boolean,
101
- *     _receiverVideoQuality: number
101
+ *     _videoQuality: number
102
  * }}
102
  * }}
103
  */
103
  */
104
 function _mapStateToProps(state) {
104
 function _mapStateToProps(state) {
105
     return {
105
     return {
106
         _audioOnly: state['features/base/audio-only'].enabled,
106
         _audioOnly: state['features/base/audio-only'].enabled,
107
-        _receiverVideoQuality:
108
-            state['features/base/conference'].preferredReceiverVideoQuality
107
+        _videoQuality: state['features/base/conference'].preferredVideoQuality
109
     };
108
     };
110
 }
109
 }
111
 
110
 

+ 12
- 12
react/features/video-quality/components/VideoQualitySlider.web.js 查看文件

6
 
6
 
7
 import { createToolbarEvent, sendAnalytics } from '../../analytics';
7
 import { createToolbarEvent, sendAnalytics } from '../../analytics';
8
 import { setAudioOnly } from '../../base/audio-only';
8
 import { setAudioOnly } from '../../base/audio-only';
9
-import { VIDEO_QUALITY_LEVELS, setPreferredReceiverVideoQuality } from '../../base/conference';
9
+import { VIDEO_QUALITY_LEVELS, setPreferredVideoQuality } from '../../base/conference';
10
 import { translate } from '../../base/i18n';
10
 import { translate } from '../../base/i18n';
11
 import JitsiMeetJS from '../../base/lib-jitsi-meet';
11
 import JitsiMeetJS from '../../base/lib-jitsi-meet';
12
 import { connect } from '../../base/redux';
12
 import { connect } from '../../base/redux';
51
     _p2p: Boolean,
51
     _p2p: Boolean,
52
 
52
 
53
     /**
53
     /**
54
-     * The currently configured maximum quality resolution to be received
55
-     * from remote participants.
54
+     * The currently configured maximum quality resolution to be sent and
55
+     * received from the remote participants.
56
      */
56
      */
57
-    _receiverVideoQuality: Number,
57
+    _sendrecvVideoQuality: Number,
58
 
58
 
59
     /**
59
     /**
60
      * Whether or not displaying video is supported in the current
60
      * Whether or not displaying video is supported in the current
326
      * @returns {void}
326
      * @returns {void}
327
      */
327
      */
328
     _mapCurrentQualityToSliderValue() {
328
     _mapCurrentQualityToSliderValue() {
329
-        const { _audioOnly, _receiverVideoQuality } = this.props;
329
+        const { _audioOnly, _sendrecvVideoQuality } = this.props;
330
         const { _sliderOptions } = this;
330
         const { _sliderOptions } = this;
331
 
331
 
332
         if (_audioOnly) {
332
         if (_audioOnly) {
337
         }
337
         }
338
 
338
 
339
         const matchingOption = _sliderOptions.find(
339
         const matchingOption = _sliderOptions.find(
340
-            ({ videoQuality }) => videoQuality === _receiverVideoQuality);
340
+            ({ videoQuality }) => videoQuality === _sendrecvVideoQuality);
341
 
341
 
342
         return _sliderOptions.indexOf(matchingOption);
342
         return _sliderOptions.indexOf(matchingOption);
343
     }
343
     }
352
      * @returns {void}
352
      * @returns {void}
353
      */
353
      */
354
     _onSliderChange(event) {
354
     _onSliderChange(event) {
355
-        const { _audioOnly, _receiverVideoQuality } = this.props;
355
+        const { _audioOnly, _sendrecvVideoQuality } = this.props;
356
         const {
356
         const {
357
             audioOnly,
357
             audioOnly,
358
             onSelect,
358
             onSelect,
362
         // Take no action if the newly chosen option does not change audio only
362
         // Take no action if the newly chosen option does not change audio only
363
         // or video quality state.
363
         // or video quality state.
364
         if ((_audioOnly && audioOnly)
364
         if ((_audioOnly && audioOnly)
365
-            || (!_audioOnly && videoQuality === _receiverVideoQuality)) {
365
+            || (!_audioOnly && videoQuality === _sendrecvVideoQuality)) {
366
             return;
366
             return;
367
         }
367
         }
368
 
368
 
379
      * @returns {void}
379
      * @returns {void}
380
      */
380
      */
381
     _setPreferredVideoQuality(qualityLevel) {
381
     _setPreferredVideoQuality(qualityLevel) {
382
-        this.props.dispatch(setPreferredReceiverVideoQuality(qualityLevel));
382
+        this.props.dispatch(setPreferredVideoQuality(qualityLevel));
383
 
383
 
384
         if (this.props._audioOnly) {
384
         if (this.props._audioOnly) {
385
             this.props.dispatch(setAudioOnly(false));
385
             this.props.dispatch(setAudioOnly(false));
396
  * @returns {{
396
  * @returns {{
397
  *     _audioOnly: boolean,
397
  *     _audioOnly: boolean,
398
  *     _p2p: boolean,
398
  *     _p2p: boolean,
399
- *     _receiverVideoQuality: boolean
399
+ *     _sendrecvVideoQuality: number
400
  * }}
400
  * }}
401
  */
401
  */
402
 function _mapStateToProps(state) {
402
 function _mapStateToProps(state) {
403
     const { enabled: audioOnly } = state['features/base/audio-only'];
403
     const { enabled: audioOnly } = state['features/base/audio-only'];
404
-    const { p2p, preferredReceiverVideoQuality } = state['features/base/conference'];
404
+    const { p2p, preferredVideoQuality } = state['features/base/conference'];
405
 
405
 
406
     return {
406
     return {
407
         _audioOnly: audioOnly,
407
         _audioOnly: audioOnly,
408
         _p2p: p2p,
408
         _p2p: p2p,
409
-        _receiverVideoQuality: preferredReceiverVideoQuality,
409
+        _sendrecvVideoQuality: preferredVideoQuality,
410
         _videoSupported: JitsiMeetJS.mediaDevices.supportsVideo()
410
         _videoSupported: JitsiMeetJS.mediaDevices.supportsVideo()
411
     };
411
     };
412
 }
412
 }

Loading…
取消
儲存