ソースを参照

feat(ReceiveVideoController): Add the ability to send constraints in the new format.

Add the ability to send the bridge messages for the receiver video constraints in the new format directly.
dev1
Jaya Allamsetty 4年前
コミット
d1505231a5
2個のファイルの変更54行の追加0行の削除
  1. 21
    0
      JitsiConference.js
  2. 33
    0
      modules/qualitycontrol/ReceiveVideoController.js

+ 21
- 0
JitsiConference.js ファイルの表示

@@ -3369,6 +3369,27 @@ JitsiConference.prototype.getSpeakerStats = function() {
3369 3369
     return this.speakerStatsCollector.getStats();
3370 3370
 };
3371 3371
 
3372
+/**
3373
+ * Sets the constraints for the video that is requested from the bridge.
3374
+ *
3375
+ * @param {Object} videoConstraints The constraints which are specified in the
3376
+ * following format. The message updates the fields that are present and leaves the
3377
+ * rest unchanged on the bridge. Therefore, any field that is not applicable anymore
3378
+ * should be cleared by passing an empty object or list (whatever is applicable).
3379
+ * {
3380
+ *      'lastN': 20,
3381
+ *      'selectedEndpoints': ['A', 'B', 'C'],
3382
+ *      'onStageEndpoints': ['A'],
3383
+ *      'defaultConstraints': { 'maxHeight': 180 },
3384
+ *      'constraints': {
3385
+ *          'A': { 'maxHeight': 720 }
3386
+ *      }
3387
+ * }
3388
+ */
3389
+JitsiConference.prototype.setReceiverConstraints = function(videoConstraints) {
3390
+    this.receiveVideoController.setReceiverConstraints(videoConstraints);
3391
+};
3392
+
3372 3393
 /**
3373 3394
  * Sets the maximum video size the local participant should receive from remote
3374 3395
  * participants.

+ 33
- 0
modules/qualitycontrol/ReceiveVideoController.js ファイルの表示

@@ -1,4 +1,5 @@
1 1
 import { getLogger } from 'jitsi-meet-logger';
2
+import isEqual from 'lodash.isequal';
2 3
 
3 4
 import * as JitsiConferenceEvents from '../../JitsiConferenceEvents';
4 5
 
@@ -123,6 +124,23 @@ export class ReceiverVideoConstraints {
123 124
         return changed;
124 125
     }
125 126
 
127
+    /**
128
+     * Updates the receiver constraints sent to the bridge.
129
+     *
130
+     * @param {Object} videoConstraints
131
+     * @returns {boolean} Returns true if the the value has been updated, false otherwise.
132
+     */
133
+    updateReceiverVideoConstraints(videoConstraints) {
134
+        const changed = !isEqual(this._receiverVideoConstraints, videoConstraints);
135
+
136
+        if (changed) {
137
+            this._receiverVideoConstraints = videoConstraints;
138
+            logger.debug(`Updating ReceiverVideoConstraints ${JSON.stringify(videoConstraints)}`);
139
+        }
140
+
141
+        return changed;
142
+    }
143
+
126 144
     /**
127 145
      * Updates the list of selected endpoints.
128 146
      *
@@ -257,4 +275,19 @@ export class ReceiveVideoController {
257 275
             }
258 276
         }
259 277
     }
278
+
279
+    /**
280
+     * Sets the receiver constraints for the conference.
281
+     *
282
+     * @param {Object} constraints The video constraints.
283
+     */
284
+    setReceiverConstraints(constraints) {
285
+        if (!this._receiverVideoConstraints) {
286
+            this._receiverVideoConstraints = new ReceiverVideoConstraints();
287
+        }
288
+
289
+        const constraintsChanged = this._receiverVideoConstraints.updateReceiverVideoConstraints(constraints);
290
+
291
+        constraintsChanged && this._rtc.setNewReceiverVideoConstraints(constraints);
292
+    }
260 293
 }

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