瀏覽代碼

feat(video-quality): be able to set an internal max

The internal max will be used for tile view. Whatever the
user has set for preferred video quality, the internal
maximum will be respected. This allows for the case where
the user prefers high definition video, but in tile view
it only makes sense to send low definition; ux wise the
user is allowed to continue messing with the video quality
slider.
master
Leonard Kim 7 年之前
父節點
當前提交
ee7d180cbb

+ 15
- 2
react/features/base/conference/actionTypes.js 查看文件

152
  */
152
  */
153
 export const SET_LASTN = Symbol('SET_LASTN');
153
 export const SET_LASTN = Symbol('SET_LASTN');
154
 
154
 
155
+/**
156
+ * The type of (redux) action which sets the maximum video height that should be
157
+ * received from remote participants, even if the user prefers a larger video
158
+ * height.
159
+ *
160
+ * {
161
+ *     type: SET_MAX_RECEIVER_VIDEO_QUALITY,
162
+ *     maxReceiverVideoQuality: number
163
+ * }
164
+ */
165
+export const SET_MAX_RECEIVER_VIDEO_QUALITY
166
+    = Symbol('SET_MAX_RECEIVER_VIDEO_QUALITY');
167
+
155
 /**
168
 /**
156
  * The type of (redux) action which sets the password to join or lock a specific
169
  * The type of (redux) action which sets the password to join or lock a specific
157
  * {@code JitsiConference}.
170
  * {@code JitsiConference}.
177
 export const SET_PASSWORD_FAILED = Symbol('SET_PASSWORD_FAILED');
190
 export const SET_PASSWORD_FAILED = Symbol('SET_PASSWORD_FAILED');
178
 
191
 
179
 /**
192
 /**
180
- * The type of (redux) action which sets the maximum video size should be
181
- * received from remote participants.
193
+ * The type of (redux) action which sets the preferred maximum video height that
194
+ * should be received from remote participants.
182
  *
195
  *
183
  * {
196
  * {
184
  *     type: SET_PREFERRED_RECEIVER_VIDEO_QUALITY,
197
  *     type: SET_PREFERRED_RECEIVER_VIDEO_QUALITY,

+ 20
- 1
react/features/base/conference/actions.js 查看文件

37
     SET_DESKTOP_SHARING_ENABLED,
37
     SET_DESKTOP_SHARING_ENABLED,
38
     SET_FOLLOW_ME,
38
     SET_FOLLOW_ME,
39
     SET_LASTN,
39
     SET_LASTN,
40
+    SET_MAX_RECEIVER_VIDEO_QUALITY,
40
     SET_PASSWORD,
41
     SET_PASSWORD,
41
     SET_PASSWORD_FAILED,
42
     SET_PASSWORD_FAILED,
42
     SET_PREFERRED_RECEIVER_VIDEO_QUALITY,
43
     SET_PREFERRED_RECEIVER_VIDEO_QUALITY,
569
     };
570
     };
570
 }
571
 }
571
 
572
 
573
+/**
574
+ * Sets the max frame height that should be received from remote videos.
575
+ *
576
+ * @param {number} maxReceiverVideoQuality - The max video frame height to
577
+ * receive.
578
+ * @returns {{
579
+ *     type: SET_MAX_RECEIVER_VIDEO_QUALITY,
580
+ *     maxReceiverVideoQuality: number
581
+ * }}
582
+ */
583
+export function setMaxReceiverVideoQuality(maxReceiverVideoQuality: number) {
584
+    return {
585
+        type: SET_MAX_RECEIVER_VIDEO_QUALITY,
586
+        maxReceiverVideoQuality
587
+    };
588
+}
589
+
572
 /**
590
 /**
573
  * Sets the password to join or lock a specific JitsiConference.
591
  * Sets the password to join or lock a specific JitsiConference.
574
  *
592
  *
641
 }
659
 }
642
 
660
 
643
 /**
661
 /**
644
- * Sets the max frame height to receive from remote participant videos.
662
+ * Sets the max frame height the user prefers to receive from remote participant
663
+ * videos.
645
  *
664
  *
646
  * @param {number} preferredReceiverVideoQuality - The max video resolution to
665
  * @param {number} preferredReceiverVideoQuality - The max video resolution to
647
  * receive.
666
  * receive.

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

34
     DATA_CHANNEL_OPENED,
34
     DATA_CHANNEL_OPENED,
35
     SET_AUDIO_ONLY,
35
     SET_AUDIO_ONLY,
36
     SET_LASTN,
36
     SET_LASTN,
37
+    SET_MAX_RECEIVER_VIDEO_QUALITY,
37
     SET_PREFERRED_RECEIVER_VIDEO_QUALITY,
38
     SET_PREFERRED_RECEIVER_VIDEO_QUALITY,
38
     SET_ROOM
39
     SET_ROOM
39
 } from './actionTypes';
40
 } from './actionTypes';
80
     case SET_LASTN:
81
     case SET_LASTN:
81
         return _setLastN(store, next, action);
82
         return _setLastN(store, next, action);
82
 
83
 
84
+    case SET_MAX_RECEIVER_VIDEO_QUALITY:
85
+        return _setMaximumReceiverVideoQuality(store, next, action);
86
+
83
     case SET_PREFERRED_RECEIVER_VIDEO_QUALITY:
87
     case SET_PREFERRED_RECEIVER_VIDEO_QUALITY:
84
         return _setPreferredReceiverVideoQuality(store, next, action);
88
         return _setPreferredReceiverVideoQuality(store, next, action);
85
 
89
 
434
 }
438
 }
435
 
439
 
436
 /**
440
 /**
437
- * Sets the maximum receive video quality and will turn off audio only mode if
441
+ * Sets an internal maximum for the video frame height to receive from remote
442
+ * videos. This maximum acts as a cap so user preferences cannot exceed a
443
+ * specified frame height.
444
+ *
445
+ * @private
446
+ * @param {Store} store - The redux store in which the specified {@code action}
447
+ * is being dispatched.
448
+ * @param {Dispatch} next - The redux {@code dispatch} function to dispatch the
449
+ * specified {@code action} to the specified {@code store}.
450
+ * @param {Action} action - The redux action
451
+ * {@code SET_MAXIMUM_RECEIVER_VIDEO_QUALITY} which is being dispatched in the
452
+ * specified {@code store}.
453
+ * @private
454
+ * @returns {Object} The value returned by {@code next(action)}.
455
+ */
456
+function _setMaximumReceiverVideoQuality({ getState }, next, action) {
457
+    const { conference, preferredReceiverVideoQuality }
458
+        = getState()['features/base/conference'];
459
+
460
+    if (conference) {
461
+        if (typeof preferredReceiverVideoQuality === 'undefined'
462
+            || preferredReceiverVideoQuality > action.maxReceiverVideoQuality) {
463
+            conference.setReceiverVideoConstraint(
464
+                action.maxReceiverVideoQuality);
465
+        }
466
+    }
467
+
468
+    return next(action);
469
+}
470
+
471
+/**
472
+ * Sets the preferred receive video quality and will turn off audio only mode if
438
  * enabled.
473
  * enabled.
439
  *
474
  *
440
  * @param {Store} store - The redux store in which the specified {@code action}
475
  * @param {Store} store - The redux store in which the specified {@code action}
451
         { dispatch, getState },
486
         { dispatch, getState },
452
         next,
487
         next,
453
         action) {
488
         action) {
454
-    const { audioOnly, conference }
455
-        = getState()['features/base/conference'];
489
+    const {
490
+        audioOnly,
491
+        conference,
492
+        maxReceiverVideoQuality
493
+    } = getState()['features/base/conference'];
456
 
494
 
457
     if (conference) {
495
     if (conference) {
458
-        conference.setReceiverVideoConstraint(
459
-            action.preferredReceiverVideoQuality);
496
+        const { preferredReceiverVideoQuality } = action;
497
+        const targetQuality = typeof maxReceiverVideoQuality === 'undefined'
498
+            ? preferredReceiverVideoQuality
499
+            : Math.min(maxReceiverVideoQuality, preferredReceiverVideoQuality);
500
+
501
+        conference.setReceiverVideoConstraint(targetQuality);
460
         audioOnly && dispatch(toggleAudioOnly());
502
         audioOnly && dispatch(toggleAudioOnly());
461
     }
503
     }
462
 
504
 

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

17
     SET_AUDIO_ONLY,
17
     SET_AUDIO_ONLY,
18
     SET_DESKTOP_SHARING_ENABLED,
18
     SET_DESKTOP_SHARING_ENABLED,
19
     SET_FOLLOW_ME,
19
     SET_FOLLOW_ME,
20
+    SET_MAX_RECEIVER_VIDEO_QUALITY,
20
     SET_PASSWORD,
21
     SET_PASSWORD,
21
     SET_PREFERRED_RECEIVER_VIDEO_QUALITY,
22
     SET_PREFERRED_RECEIVER_VIDEO_QUALITY,
22
     SET_ROOM,
23
     SET_ROOM,
69
     case SET_LOCATION_URL:
70
     case SET_LOCATION_URL:
70
         return set(state, 'room', undefined);
71
         return set(state, 'room', undefined);
71
 
72
 
73
+    case SET_MAX_RECEIVER_VIDEO_QUALITY:
74
+        return set(
75
+            state,
76
+            'maxReceiverVideoQuality',
77
+            action.maxReceiverVideoQuality);
78
+
72
     case SET_PASSWORD:
79
     case SET_PASSWORD:
73
         return _setPassword(state, action);
80
         return _setPassword(state, action);
74
 
81
 

Loading…
取消
儲存