ソースを参照

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 6年前
コミット
ee7d180cbb

+ 15
- 2
react/features/base/conference/actionTypes.js ファイルの表示

@@ -152,6 +152,19 @@ export const SET_FOLLOW_ME = Symbol('SET_FOLLOW_ME');
152 152
  */
153 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 169
  * The type of (redux) action which sets the password to join or lock a specific
157 170
  * {@code JitsiConference}.
@@ -177,8 +190,8 @@ export const SET_PASSWORD = Symbol('SET_PASSWORD');
177 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 197
  *     type: SET_PREFERRED_RECEIVER_VIDEO_QUALITY,

+ 20
- 1
react/features/base/conference/actions.js ファイルの表示

@@ -37,6 +37,7 @@ import {
37 37
     SET_DESKTOP_SHARING_ENABLED,
38 38
     SET_FOLLOW_ME,
39 39
     SET_LASTN,
40
+    SET_MAX_RECEIVER_VIDEO_QUALITY,
40 41
     SET_PASSWORD,
41 42
     SET_PASSWORD_FAILED,
42 43
     SET_PREFERRED_RECEIVER_VIDEO_QUALITY,
@@ -569,6 +570,23 @@ export function setLastN(lastN: ?number) {
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 591
  * Sets the password to join or lock a specific JitsiConference.
574 592
  *
@@ -641,7 +659,8 @@ export function setPassword(
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 665
  * @param {number} preferredReceiverVideoQuality - The max video resolution to
647 666
  * receive.

+ 47
- 5
react/features/base/conference/middleware.js ファイルの表示

@@ -34,6 +34,7 @@ import {
34 34
     DATA_CHANNEL_OPENED,
35 35
     SET_AUDIO_ONLY,
36 36
     SET_LASTN,
37
+    SET_MAX_RECEIVER_VIDEO_QUALITY,
37 38
     SET_PREFERRED_RECEIVER_VIDEO_QUALITY,
38 39
     SET_ROOM
39 40
 } from './actionTypes';
@@ -80,6 +81,9 @@ MiddlewareRegistry.register(store => next => action => {
80 81
     case SET_LASTN:
81 82
         return _setLastN(store, next, action);
82 83
 
84
+    case SET_MAX_RECEIVER_VIDEO_QUALITY:
85
+        return _setMaximumReceiverVideoQuality(store, next, action);
86
+
83 87
     case SET_PREFERRED_RECEIVER_VIDEO_QUALITY:
84 88
         return _setPreferredReceiverVideoQuality(store, next, action);
85 89
 
@@ -434,7 +438,38 @@ function _setLastN({ getState }, next, action) {
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 473
  * enabled.
439 474
  *
440 475
  * @param {Store} store - The redux store in which the specified {@code action}
@@ -451,12 +486,19 @@ function _setPreferredReceiverVideoQuality(
451 486
         { dispatch, getState },
452 487
         next,
453 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 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 502
         audioOnly && dispatch(toggleAudioOnly());
461 503
     }
462 504
 

+ 7
- 0
react/features/base/conference/reducer.js ファイルの表示

@@ -17,6 +17,7 @@ import {
17 17
     SET_AUDIO_ONLY,
18 18
     SET_DESKTOP_SHARING_ENABLED,
19 19
     SET_FOLLOW_ME,
20
+    SET_MAX_RECEIVER_VIDEO_QUALITY,
20 21
     SET_PASSWORD,
21 22
     SET_PREFERRED_RECEIVER_VIDEO_QUALITY,
22 23
     SET_ROOM,
@@ -69,6 +70,12 @@ ReducerRegistry.register('features/base/conference', (state = {}, action) => {
69 70
     case SET_LOCATION_URL:
70 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 79
     case SET_PASSWORD:
73 80
         return _setPassword(state, action);
74 81
 

読み込み中…
キャンセル
保存